Quick Start
1
Level 1 — Bool (simplest)
Turn on autonomy with a single flag — defaults to the safe
suggest level.2
Level 2 — String (pick a level)
Pass a level name to unlock more independence.
3
Level 3 — Config class (full control)
Use
AutonomyConfig to tune iteration caps, doom-loop detection, and escalation.Autonomy Levels
How It Works
Completion Signals
The loop can stop on several signals — ranked by how reliably they mean “really done”.Configuration Options
Full list of options, types, and defaults —
AutonomyConfigSafety controls belong together.
max_iterations and doom_loop_threshold cap how long an agent runs; max_budget_usd and max_tokens cap how much it spends. Set both when running unattended — see Autonomy Budget for the spend/token kill-switch.Common Patterns
Pattern 1 — Auto-edit mode for coding tasks
Pattern 2 — Full-auto iterative mode
Pattern 3 — Budget-bounded autonomous runs
Cap an unattended run by money or tokens so it can’t burn dollars silently.Choosing a Cap
Pick the cap that matches what you care about most for the run.Handling budget_exhausted
When a cap trips, the run stops with completion_reason="budget_exhausted" and a metadata payload describing the spend.
The metadata dict carries the actual spend, the configured caps, and the status:
budget_action="pause" returns status="paused" and preserves the partial output so you can raise the cap and continue. budget_action="stop" returns status="stopped" — the run is killed unconditionally.Best Practices
Start with suggest level
Start with suggest level
Start with
autonomy=True (level suggest) to see what the agent proposes before giving it permission to edit files or run in a full loop. Graduate to auto_edit or full_auto when you trust the agent’s behavior.Set doom_loop_threshold conservatively
Set doom_loop_threshold conservatively
The default threshold of 3 means 3 identical actions trigger escalation. Lower this to 2 for high-stakes tasks, or raise it to 5 for tasks where retrying the same action is expected behavior (like polling).
Use completion_promise for iterative mode
Use completion_promise for iterative mode
In
full_auto mode, the agent loops until it detects completion. Set completion_promise="TASK_COMPLETE" and instruct the agent to output this signal when done, giving you clean loop termination.Cap unattended runs with max_budget_usd
Cap unattended runs with max_budget_usd
For
full_auto mode running unattended (nightly jobs, background workers), set max_budget_usd as a hard ceiling. Combine with budget_action="pause" so a hit cap preserves the partial output and lets you raise the cap and resume rather than restart from zero.Pick pause vs stop deliberately
Pick pause vs stop deliberately
budget_action="pause" returns a recoverable result — the partial output is preserved and metadata["status"] is "paused". budget_action="stop" marks it terminal (status="stopped"). Pick pause when a human might raise the cap and continue; pick stop when the run should be killed unconditionally.Related
Autonomy Loop — deep dive into iterative autonomy mode
Autonomy Budget — cap the money and tokens a run can burn
Gate the autonomous loop on an independent acceptance-criteria judge

