What This Example Shows
- A
noulquestion that decides whether a task needs an agent before you pay for one - A
/v1/agent/completionscall that runs only when the gate says yes - A
scoreand anoulquestion, in one request, that judge the agent’s answer before it ships - What each step cost in a live run on production
Why This Matters
Agent calls are where the money goes. Many requests that reach an agent do not need one: a canned reply, a FAQ link or a refusal would do. And an agent’s answer can be off-topic or half-finished with nothing to catch it. A decision call costs a few hundredths of a cent, several hundred times less than the agent call it gates, so you can afford to check every request on the way in and every answer on the way out.Step 1: Setup
decide sends one decision completion and returns its answers. The gate and the judge both use it.
Step 2: Gate the Task
Only pay for an agent when the task needs one. Anoul below 0.5 means a canned reply is enough.
Step 3: Run the Agent
Step 4: Judge the Answer
The state is both the question and the answer, so the decision model grades the answer against what was asked. Both questions go in one request, and the state’s tokens are billed once.quality score or a low ship probability to a person, or back to the agent for another pass.
The Live Run
The script above, run on production withgpt-5-mini:
The Cost Math
- The gate cost $0.0000147, about 900 times less than the $0.013645 agent call.
- Gate and judge together cost $0.0000516, under 0.4% of the agent call.
- Gating costs $0.0000147 per request, and every skipped agent call saves about $0.0136. Skipping about one agent call in every 900 requests pays for gating all of them.
Next Steps
- Pick a Swarm and the Best Draft: the same pattern around
/v1/swarm/completions - Decision Models and SystemOne Reference: question types, errors and pricing
- Agent Completions Reference: every
agent_configfield