Quanta

← Back to Briefings

A 12-Turn Budget for Teams Running Agents at Scale

Cost at volumeEN3 reads

An agent that keeps working is not necessarily making progress. It may be rereading the same files, retrying an impossible operation, or rewriting a plan without changing the outcome. For teams running sustained workloads, that behavior turns a small control-flow defect into repeated token charges, occupied workers, and a growing investigation queue.

The solution is not simply a cheaper model. It is an explicit contract for when work must stop. Here is a step-by-step walkthrough using an illustrative 12-turn ceiling, not a universal recommendation.

01 · Step 1: Define completion before the first call

Start with an observable result. For a repository maintenance task, completion might mean that the requested change exists, the specified tests pass, and the agent returns a summary. Reading more files or producing another plan does not qualify.

Define failure just as clearly. Missing credentials, unavailable dependencies, or contradictory requirements should produce a blocked result rather than another attempt at reasoning around the obstacle.

A useful terminal state is success, blocked, or exhausted. Every state should return enough evidence for the next operator to understand what happened.

02 · Step 2: Count the whole execution, not one response

A short response can trigger a long chain of tool calls and follow-up requests. Trace the complete job: model requests, tool executions, retries, delegated work, and final reporting. Give them a shared job identifier.

Record input tokens, output tokens, cache writes, and cache reads separately. On Quanta, every call is metered on real tokens, with cache writes and reads priced separately. A repeated prompt therefore needs an accounting explanation, not an assumption that caching makes repetition free.

Also track tool-service charges and worker occupancy where applicable. These are operational costs beyond the relay bill.

03 · Step 3: Enforce several budgets outside the model

For this walkthrough, cap each job at 12 model turns. Then add independent ceilings for elapsed time, cumulative token use, tool calls, and permitted spend. Stop when any ceiling is reached.

  • › Turn limit: bounds repeated planning and response cycles.
  • › Time limit: catches slow tools and stalled requests.
  • › Spend limit: constrains jobs with unexpectedly large contexts.
  • › Tool limit: prevents repeated side effects or excessive external queries.

Enforce these controls in the orchestrator. Asking the model to remember a budget is not equivalent to enforcing one. Reserve enough allowance to return a final status, and bound concurrent in-flight requests so they cannot silently overrun the remaining budget.

04 · Step 4: Stop retries that produce no new evidence

Distinguish transient errors from structural blockers. A temporary connection failure may justify a bounded retry with backoff. An authorization failure usually requires different credentials, not another identical request.

Track repeated actions using the tool name, normalized arguments, and relevant result. If the agent repeats an unsuccessful action without new evidence, stop or escalate. For mutating operations, require idempotency controls before allowing retries.

Progress should mean a changed artifact, a resolved uncertainty, or a verified result, not merely another paragraph of explanation.

05 · Step 5: Route models without resetting the ledger

A team might use DeepSeek V4 Flash for initial classification and Claude Sonnet 5.5 for a difficult repair. That is a routing decision, not permission to restart the job budget.

Quanta fits naturally when sustained workloads need a shared pay-as-you-go balance across models and compatibility with an OpenAI SDK. Open a Quanta account to consolidate that access, then keep per-job limits in your own orchestration layer. A shared balance is not a per-agent stop condition.

06 · Step 6: Test the stop paths before expanding volume

Run controlled cases with missing permissions, failing tests, unavailable tools, and circular instructions. Verify that each reaches a terminal state within its limits and leaves a useful audit trail.

Measure cost per completed task alongside blocked rate, exhausted rate, and repeated-action frequency. Lower spending alone can hide an agent that stops too early.

07 · Step 7: Treat exhausted jobs as engineering evidence

Review exhausted jobs before increasing their budgets. Some need more room; others reveal poor task definitions, broken tools, or missing permissions. Increasing every ceiling can merely finance the defect.

At heavy volume, the important question is not whether an agent can continue. It is whether the next action has a defensible chance of advancing the task, within a budget the team deliberately approved.