Docs · Setup · For AI agents

Set up AdRails for a client with an AI agentTwo commands · adrails.dev

Direct answer. There is no AdRails account to create. Once a human has provided three Google items, an agent installs the package and runs adsops-mcp init and adsops-mcp doctor. init reads the live campaign and writes a git repo with a config, a desired-state file that matches the account exactly, and a policy file whose budget cap is today's budget. Commits stay off until a human reviews the caps and turns them on.

Last tested with AdRails 0.3.0 · Python 3 · macOS and Linux · Apache-2.0 · local stdio
What the human does once

Three Google items, then hand off

  • A service-account key. In Google Cloud, a project with the Google Ads API enabled and a service account; save its JSON key on the machine that runs AdRails.
  • A developer token. Google Ads > Tools > API Center. Export it as ADSOPS_GOOGLE_DEVELOPER_TOKEN where the server runs. A new token works only on test accounts until Google grants Basic access. Never paste it into a chat.
  • Access for the service account. Google Ads > Admin > Access and security: add the key's client_email with Standard access to the client account, or to your manager account and pass --login-customer-id.
Steps

What the agent runs

  1. Install and scaffold one campaign

    init reads the campaign's name, status, end date and budget, and writes three files in a new git repo. It refuses to overwrite anything. Use one directory per campaign so each client's caps and history stay separate. --json gives machine-readable output.

    shell
    pipx install adrails
    adsops-mcp init --dir ~/adrails/acme --customer-id 123-456-7890 \
      --campaign-id 2233445566 --sa ~/.adsops/sa.json --json
  2. Check everything with doctor

    doctor prints one row per check: the key file, whether the developer token is set (never its value), live access, the files, clean git and the guard heartbeat. Each failure carries the exact fix; relay it to the human as written. Exit code 0 means every check passed.

    shell
    adsops-mcp --config ~/adrails/acme/config.json doctor
    PASS  service_account_file  service account: ads-bot@acme.iam.gserviceaccount.com
    FAIL  developer_token  missing
          fix: Google Ads > Tools > API Center: copy your developer token, then export ...
  3. Register the server and read a plan

    Register the local server in the client, then call adsops_status and adsops_plan. Because the state file matches the live campaign, the first plan has zero operations.

    shell
    claude mcp add adrails -- adsops-mcp --config ~/adrails/acme/config.json
  4. Hand the caps to the human

    The policy file starts conservative: the budget cap equals today's budget, enabling is off, a plan ID is required and commits are off. The human edits the caps they want, sets commit_policy.allow_commit and allow_set to true in config.json, and commits. The agent must not edit the policy file, and no AdRails tool writes it.

  5. Schedule the spend guard

    Run adsops-mcp --config ~/adrails/acme/config.json guard-all every 15 minutes from launchd, systemd or cron (templates in the repo's deploy/). Until the guard has a fresh heartbeat, budget raises and re-enables are refused.

AdRails reduces risk; it does not remove it. The guard is a threshold with automatic pause attempts, not a hard spend ceiling, and Google can deliver up to 2x the average daily budget on a given day. Keep a billing limit in Google Ads as the real ceiling. See what the guardrails do and don't prevent.

FAQ

Agent setup questions

Can an AI agent sign a client up for AdRails?

There is nothing to sign up for. AdRails is free, open-source software with no account. The agent installs it and runs two commands; the human provides the three Google items once.

Can the agent raise the budget after setup?

No. The budget cap starts at today's budget and lives in the policy file, which only a human edits. A raise past the cap is refused with outside guard range.

Does it work for an agency with many clients?

Yes. Add the service account under your manager account, pass --login-customer-id, and run init once per campaign in its own directory.

Does it work with ChatGPT?

Not directly. AdRails runs as a local process and has no hosted URL by design, so it needs a client that can launch one: Claude Code, Claude Desktop, Cursor, the Grok CLI and others. See MCP clients.