- 01
Set max_turns on the runner
Pass a max_turns that matches a successful run, not the worst loop you can imagine. A turn limit ends a confused agent. It does not price the turns.
- 02
Point the default client at Fuse
The Agents SDK uses this client for model calls. The model name stays an OpenAI id you have enabled. The OpenAI client does not retry 402.
agent.pyimport os from agents import set_default_openai_client from openai import AsyncOpenAI set_default_openai_client( AsyncOpenAI( base_url="https://fuse.ospalabs.com/v1", api_key=os.environ["FUSE_API_KEY"], ) ) - 03
Give the agent its own key cap
A daily cap on the Fuse key is the production guardrail the issue was asking for. When it trips, that agent stops and other keys on the project do not.
- 04
Keep the usage object
The run result still includes token totals for the turns that completed. Use them for evals. Use the Fuse log for dollars, and the 402 for the stop.
Put a cost limit on the OpenAI Agents SDK
Updated November 2026
A thread on the Agents SDK asked what people enforce before an agent goes to production, after a loop fired thousands of API calls. The maintainer's answer was the usage object on the run result, plus the organization's monthly budget in the OpenAI platform. Both are real. Usage describes a run that finished. A monthly org budget is one number for every app on the account, and it acts on recorded spend.
max_turns caps how many turns one run may take. It is the right knob, and it is still a count. The dollar stop has to live where the HTTP call is made. Set the SDK's default OpenAI client to Fuse. Each model call is reserved at its worst case first, and the call that would cross the ceiling never leaves.
Questions
Is the organization monthly budget enough?
It is the outer wall. It is monthly, it is shared by every project in the org, and it does not give one agent a daily stop. Add the key cap in front of it.
Will tracing still work?
Yes. Tracing records what the SDK saw. Fuse records metadata for the same calls and never stores the prompts.