Give the agent a token countdown it can see: `task_budget` pacing, and the budget size that triggers fake refusals
Task budgets (`task-budgets-2026-03-13` beta header) add `output_config.task_budget` — an advisory token cap across a whole agentic loop, injected server-side as a countdown only the model sees, so it paces itself and wraps up gracefully instead of being cut off by `max_tokens`. Now supported on Opus 5, it fills the gap effort can't: effort tunes depth per step, task budgets tune total breadth. Two non-obvious gotchas justify reading the doc: a budget that's too small for the task "may cause refusal-like behavior" — the model declines or scopes down rather than starting work it can't finish, so raise the budget before debugging other params — and decrementing `remaining` client-side both invalidates your prompt cache and under-reports the budget, making the agent quit early.
↳ Follow the thread