guide · running it safely

Running paid media from an AI agent without losing control

The agent proposes. A named human holds the money. Everything else is implementation detail.

Pointing an AI agent at a paid media account is not risky because the model might be wrong about a headline. It is risky because the interfaces underneath it were built for a person who can read a confusing response and stop. The four controls that actually matter are: the agent uses the same routes, tenant boundary and approval records as the browser, so there is no weaker second path; its authority is a revocable, versioned mandate with an explicit money ceiling and an expiry rather than an API key; consequential actions require a single-use approval bound to the exact bytes a human approved, and fail closed when the request does not match; and an ambiguous supplier response stops the run and waits for a person, rather than being retried. On AdBuyMCP eleven consequential operations have no agent tool at all, which is a stronger guarantee than a permission the agent is asked not to use.
Human-only operations
11, with no agent tool
Authority
Mandate: ceiling, expiry
Approval
Single use, exact digest
Length
11 min read
evidenceNo campaign outcomes
Book a working session
Bring a real brief and everything described here runs against it: the compiled plans, the fidelity scores, and the question of whether the campaign can be proved at all.
Book a working session →
On this page
if you read nothing else

What to remember

The whole guide is below. These are the parts that change a decision.

  1. 01

    The question is not what the agent is allowed to do. It is what it can reach at all, and the strongest answer is an operation with no tool behind it.

  2. 02

    An API key is not an authority model. A mandate that enumerates actions, currency, ceiling and expiry, and can be revoked, is.

  3. 03

    Approvals should bind to a digest of the exact action. An approval for something that merely resembles the request is not an approval.

  4. 04

    Retry is the expensive failure. An agent that cannot read a supplier's response and tries again has just created a second campaign nobody knows about.

  5. 05

    A human's web session must never be usable as an agent credential. If it is, the agent inherits everything the person can do, including approving its own work.

01

The risk is not the model, it is the interface underneath it

Most discussion of agent risk in advertising is about output quality: will it write a bad headline, will it pick the wrong segment. Those are real and they are recoverable. The unrecoverable failures are operational, and they come from the fact that advertising APIs were designed for a human operator who can look at a confusing response, frown, and go and check before pressing anything else.

An agent has no frown. Given a response it cannot parse, its default behaviour is to try again, and a retried activation against a vendor that did in fact accept the first one produces two live campaigns spending in parallel. That is not a hypothetical: it is the ordinary failure mode of any distributed system without idempotency, and it costs money at the exact rate the campaign was budgeted to.

So the design questions worth asking before you connect anything are boringly infrastructural. What can it reach? Whose authority does the call carry? What happens when a supplier answers ambiguously? Who can undo it? Everything else is a preference.

02

One execution path, or a second door

The first thing to establish about any agent integration is whether the agent's route into the system is the same one the user interface uses. Two paths mean two sets of rules, and the second set is always weaker, because it was written later and by someone thinking about tool ergonomics rather than about money.

In AdBuyMCP each of the 76 MCP tools is a thin wrapper over exactly one REST endpoint — the same endpoint the browser calls. One tenant boundary, one wallet gate, one approval record, one audit trail. An agent can do nothing through MCP that a person could not do in the product, and nothing that a person did not authorise, because there is no second execution path to hold different rules.

The corollary is the interesting half. Because the tool surface is a subset of the API rather than a mirror of it, operations can be omitted from it entirely. Eleven consequential operations have no MCP tool at all: resolving an approval, resolving a campaign provider attempt, acknowledging a booking-workflow step, resolving an asset job, replacing a mandate, revoking a mandate, closing a mission, saving a supplier dossier, verifying a supplier dossier, issuing a live execution grant, and revoking one. An operation with no tool is a stronger guarantee than a permission the agent is asked not to exercise, because there is nothing to exercise.

03

Authority as a data structure, not a setting

"Give the agent an API key" is not an authority model. A key is a binary: either the agent has everything the key can do, or it has nothing, and revoking it is an outage rather than a control.

The alternative is to make authority a durable object. Here the chain is mission, mandate, run, ordered steps, decision and evidence. A mission is a named objective owned by your workspace, and agents cannot close their own. A mandate is a revocable, versioned grant enumerating exactly which actions are allowed, in which currency, for how long, and up to what money ceiling. Work proceeds as ordered steps against that mandate, each recorded, and a step cannot be skipped or a run silently restarted.

Two properties of that model are worth copying whatever platform you are on. Authority is time-bounded, so an agent that is forgotten about stops being able to act rather than continuing indefinitely. And it is versioned and revocable as data, so withdrawing authority is an ordinary operation with an audit trail rather than an emergency credential rotation.

04

Approval bound to the exact bytes

The weakest common form of human-in-the-loop is a confirmation dialogue: the agent asks, a person says yes, and the agent then does something. What it actually does is not necessarily what was described, and the gap between the two is where the loss lives.

The stronger form binds the approval to a digest of the exact action. A human approves a specific set of bytes; the approval is single-use; and when a request arrives, it is checked against that digest. If it does not match, it fails closed rather than proceeding on the strength of something that looks similar. That converts "the agent did something I did not expect" from a plausible incident into a structural impossibility.

Two refinements matter as much as the mechanism. Approving evidence should not enable spend: on this platform, enabling spend on a staged live line is a separately granted action that an approval alone cannot perform, so a single yes cannot cascade into money moving. And an agent credential must not be able to resolve a human approval at all — an integration test proves an agent attempting to approve its own work receives a 403 requiring human approval.

05

Whose credential is it, anyway

The most consequential design decision in the AdBuyMCP server is a refusal: a human's ordinary web session cannot be forwarded as an agent's credential. The attempt fails with a 401 rather than quietly working.

That sounds like a technicality and it is the whole ballgame. If a logged-in person's session can be handed to an agent, the agent inherits everything that person can do — including, in most systems, approving work. Every guarantee above evaporates at that point, and it evaporates silently, because from the server's point of view a person is acting.

The implementation is that every request carries a verified actor class that cannot be changed by adding or removing headers. Human sessions are classified as human and web; the MCP client's fixed source marker makes the human-plus-agent pairing fail rather than take the browser path. An agent credential must be either a configured service token or a verified delegated token carrying a signed agent claim and a non-empty verified client identifier. Actor, source and client attribution are then persisted on every action, so the audit log answers "who did this" rather than "which account did this".

06

Failure, which is where agents actually cost money

Design the happy path badly and you get a wrong campaign. Design the failure path badly and you get two.

The rule that prevents the expensive version is that an ambiguous outcome stops the run. Where a supplier's response cannot be read confidently, the run raises an exception, halts, and waits for an explicit human resolution before resuming. It is never blindly retried. That single rule prevents the specific incident this whole design exists around: an agent that cannot tell whether an activation succeeded, trying again.

Underneath it sits the mechanism that makes retry safe when retry is right. Every outbound side effect writes a committed provider-attempt record before the call and settles it afterwards, keyed by a deterministic idempotency token that is passed to the vendor and reused on retry. After a crash, orphaned attempts are reconciled first: sandbox orphans close automatically, and live media or creative orphans move the line to reconciliation-required rather than being retried or assumed failed. You are given the vendor, the operation and the token, so the question "did this actually happen?" is answerable by checking rather than by guessing.

One more control belongs in the same family. An expired or blocked supplier authority raises a spend lock before any scheduler work runs, sends a single incident-bound emergency pause, and refuses to retry an ambiguous response. Only a signed human reconciliation clears it, and re-verifying then revoking again uses a fresh incident identifier rather than reopening the resolved one.

07

What this looks like to set up today, and what does not exist

MCP access to AdBuyMCP today is a private, single-tenant, self-hosted deployment behind a bearer token or your own tunnel. There is no public connector to add and no multi-tenant sign-in. The server runs over both streamable HTTP and stdio, works behind tunnels and load balancers without sticky routing, and is fail-closed at the boundary: production must set exact allowed hosts and browser origins, local execution binds to loopback unless a container deployment opts out explicitly, and a modern HTTP request that omits its protocol version header is rejected before dispatch.

Public multi-tenant MCP needs an OAuth 2.1 authorisation server issuing per-user, per-organisation, audience-bound tokens. The package deliberately does not embed one — it publishes protected-resource metadata and scope challenges, and startup fails if OAuth is mixed with static tokens — and choosing the issuer, the client registration, the callback allowlist, the consent model and the tenant claim is an open launch gate rather than a configuration step. A static bearer token is suitable only for a deployment serving one organisation.

One thing to hold lightly: the tool annotations. The server marks tools read-only, destructive, idempotent and open-world, and those labels look like a security control. They are not, and the server's own documentation says so. They are discovery hints that help a client decide what to surface and what to confirm. The boundary is the API's fail-closed execution hook, which rejects any consequential call that does not match a registered action and an approval granted for those exact bytes.

08

The questions to ask any agent-operated media product

Whatever you end up using, these are the questions worth asking before a budget is attached, and they are all answerable in a sentence by anyone who has thought about it.

Is there a second execution path?
If the agent's route is not the same one the interface uses, ask which rules the second one enforces and who wrote them.
What can the agent not reach at all?
A list of operations with no tool behind them is worth more than a page about permissions.
What bounds the authority?
Currency, ceiling, expiry, revocation. If the answer is an API key, there is no bound.
What is an approval bound to?
The exact action, or a description of it. Only the first survives an agent that improvises.
What happens on an ambiguous response?
Stop and ask, or retry. This single answer separates a safe integration from an expensive one.
Can the agent approve its own work?
Ask for the test that proves it cannot, rather than the policy that says it should not.

If the version of this that matters is the one about your own budget, that is a working session rather than a page.

Talk it through
what this guide does not claim

The limits, in the same size type as the rest

There is no hosted AdBuyMCP connector. What exists is a server you deploy and control, single-tenant, behind a bearer token, and public multi-tenant OAuth is an open launch gate rather than a setting. The local development mode disables authentication entirely and grants its single identity every human permission implicitly; it is labelled in the code as not being an authentication boundary, and it should never be exposed. The controls described here are properties of this platform's design and its test suite, not certifications: there is no ISO 27001, no SOC 2, no Cyber Essentials and no third-party penetration test, and we have never executed a live media buy, so none of these controls has yet been exercised against real spend at a real vendor.

If one of those limits is disqualifying, it is better established now than in week three, and a call establishes it in forty-five minutes.

Talk it through
where this came from

Every figure above, and the file it was read from

Named rather than linked. A URL nobody opened on the day it was attached is a citation in appearance only, so this names the code, the data module or the dated research report instead, and you can go and check.

  • 01apps/mcp in our repo — the tool list, the protocol negotiation, the transport boundary and the annotation counts
  • 02src/data/mcp.ts on this site — the eleven human-only operations, the authority chain, the actor-class refusal and the availability statement, all read off apps/mcp
  • 03src/data/how-it-works.ts on this site — the provider-attempt record, the idempotency token and the orphan reconciliation behaviour
  • 04src/data/security.ts and src/data/supply.ts on this site — the tenant boundary, the agent approval restrictions, the supplier spend lock and what is not held on assurance

2,392words, counted from this page rather than claimed. Where the platform’s README and its code disagree, the code wins.

// bring a brief

Everything above, run against your own audience.

Forty-five minutes. One sentence compiles into seven channel plans in front of you, with the fidelity score, the lawful-basis manifest and the measurement eligibility on screen rather than described.

Book a working session

45 minutes. Bring a real brief and we compile it live. · Design-partner phase · the sandbox needs no card and no credentials

Questions this guide gets asked

Answered in full here, and indexed alongside every other question this site answers at /faq.

Can an AI agent spend money without a human approving it?

Not on this platform, and the block is structural rather than a setting. Consequential calls fail closed unless the incoming request matches an approval a human granted for those exact bytes; spend runs against a mandate carrying an explicit money ceiling and an expiry; and enabling spend on a live line is a separately granted action that an approval alone cannot perform. Agents also cannot revoke or replace authority, close missions, or resolve approvals — those operations have no agent tool at all.

What actually goes wrong when an agent runs advertising?

The costly failures are operational rather than editorial. The common one is a retried activation after an ambiguous supplier response, which produces two live campaigns spending in parallel. The others are an agent inheriting a human's session and approving its own work, an authority that never expires and is forgotten, and an approval granted for one action being spent on a different one. All four are prevented by design decisions rather than by prompting, which is why the questions worth asking of a vendor are infrastructural.

Do I need to trust the model to use an agent safely?

Less than you would expect, and that is the point of putting the controls in the product rather than in the prompt. The model extracts semantics, drafts creative, explains plans and proposes optimisations. It does not compute budgets — deterministic code does the arithmetic against adapter forecasts — and it never emits a vendor segment identifier, because registry tables do that. Where its output has consequences, a human approval bound to the exact action stands between the proposal and the money.