Agent(autonomy=True).
How It Works
Escalation Stages
Quick Start
Stages and Signals
| Stage | Name | Typical trigger |
|---|---|---|
| 0 | DIRECT | Simple questions (simple_question) |
| 1 | HEURISTIC | File paths, code blocks |
| 2 | PLANNED | Edit, test, or build intent |
| 3 | AUTONOMOUS | Multi-step refactor, complex keywords |
| Signal | Trigger examples |
|---|---|
simple_question | ”what is”, “define”, “explain” |
file_references | Paths like src/main.py |
edit_intent | ”edit”, “modify”, “fix” |
refactor_intent | ”refactor”, “restructure” |
complex_keywords | ”analyse”, “optimise”, “refactor” |
CLI
Pipeline Components
Underpraisonaiagents/escalation/:
- Doom loop detector — identical calls and no-progress patterns
- Loop guard — idempotency-aware tool-call guardrails on every
Agent. See Loop Guard. - Pipeline orchestration — escalation triggers and recovery
- Observability hooks — metrics for escalation events
Best Practices
Enable with autonomy=True
Enable with autonomy=True
Pass
autonomy=True or an AutonomyConfig — the agent selects the stage automatically during execution.Inspect signals before heavy runs
Inspect signals before heavy runs
Call
analyze_prompt() to preview complexity without an LLM call when building UIs or routing logic.Tune doom_loop_threshold
Tune doom_loop_threshold
Lower the threshold (e.g.
3) for agents that may repeat tool calls; raise it for exploratory coding tasks.Stay agent-centric
Stay agent-centric
No standalone pipeline objects — escalation, loop guard, and doom-loop detection live on
Agent.Related
Doom Loop Detection
Pattern-based detection of stuck agent loops
Subagent Delegation
Delegate subtasks when autonomy escalates

