The model does not get the card
An agent can draft the campaign. The call that spends the money is a different function, and it refuses to run until a person has approved that draft.
AdTeam takes a business from a brief to a live campaign: research, strategy, copy, design, launch, then a look at how it did. I joined when that was a Bubble app, mostly run by hand, and I led a lot of the engineering that replaced it. The agents draft those stages. A person approves the campaign before money goes out. That approval is not a disclaimer under the demo. It is a branch in the code.
Startups keep asking how to "add agents" to a product. The demo is easy. The draft looks like magic and the room leans in. The product starts the moment the same process is allowed to buy something, send something, or publish something. I split those into two functions and I make the second one boring.
A draft is not a side effect
Each stage returns a draft the next stage can read: research, then strategy, then copy, then design. The handoff is data, with an id and a status. Nothing in that chain holds a credential that can spend. Launch is a separate call. It loads the draft, checks that a person moved it to approved, and only then talks to the advertising side. A double submit hits the same idempotency key, so a retry is not a second campaign.
type Draft = {
id: string;
status: "draft" | "approved" | "launched";
idempotencyKey: string;
};
async function launch(draft: Draft) {
if (draft.status !== "approved") {
throw new Error("Refusing to launch a draft that is not approved.");
}
await ads.createCampaign({
draftId: draft.id,
idempotencyKey: draft.idempotencyKey,
});
}That is the check, stripped down. The production path has more states and more failure. The part I will not collapse is the check. If the model can call launch from inside the same loop that writes the copy, the approval is a comment. The usual way that happens is a tool list with every function the application has, because registering them all was faster than choosing. The tool list is the permission set. A draft stage gets tools that read and write drafts. The launch stage does not run until the status says approved.
Retries follow the same cut. Retry a read. Retry a generation. Do not retry a charge unless the key makes the second call a no-op. A backoff around a function that spends money is how a blip becomes a duplicate invoice. The model will also call a tool twice because it forgot, not because your HTTP client timed out. The idempotency key has to live in the draft, not in the hope that the model is careful.
The model was on the wrong page
The other startup habit is putting the model on the first paint. AdTeam's product listing went from about fifteen seconds to about one second in later benchmarks. Part of that fifteen seconds was the page starting model work the user had not asked for yet. Fewer API calls, pagination, better queries, cache the data everyone hits, and load the expensive generation when someone actually invokes it. k6 told us which of those moved the number.
A slow list page is a product problem even if the agent demo is impressive. Buyers live in the list. The generation can take longer if a person is waiting on that generation and can see that they are. Hiding a model call inside a page load makes both worse: the list is late, and you pay for completions nobody reads.
Two different agents
I use a coding agent to write a first draft of code, and I read the diff before it ships. That is a review on my machine. It is not the system I am describing.
An agent in the product can be wrong in front of a customer, and wrong in a way that leaves the building. The draft is allowed to be wrong. That is why a person is in the loop before spend, and why I keep the cases customers actually hit and change the automation when a new one shows up. I don't treat a good prompt as a substitute for the status check. Prompts drift, models get swapped, and a tool description gets edited by someone who wanted a smoother demo. The branch that looks at draft.status is still there after all of that.
If you are putting an agent in a product, ship the approval and the idempotency key before you ship a longer chain of stages. The chain is what the pitch is about. The key is what keeps the pitch from billing twice.