Quick Start
How It Works
Key Features
Completion Promise
Agent signals “done” with a promise tag containing TEXT
Context Clearing
Fresh memory each iteration forces file-based state
Doom Loop Detection
Automatically stops on repeated identical actions
Iteration Limits
Prevents runaway execution with configurable max
Configuration
AutonomyConfig Options
| Option | Type | Default | Description |
|---|---|---|---|
max_iterations | int | 20 | Maximum loop iterations |
completion_promise | str | None | Text to detect in promise tags |
clear_context | bool | False | Clear chat history between iterations |
doom_loop_threshold | int | 3 | Repeated actions before stopping |
Using Config Dict
CLI Usage
- Basic
- With Promise
- With Context Clearing
- With Timeout
CLI Options
| Flag | Description |
|---|---|
-n, --max-iterations | Maximum iterations (default: 10) |
-p, --completion-promise | Promise text to signal completion |
-c, --clear-context | Clear chat history between iterations |
-t, --timeout | Timeout in seconds |
-m, --model | LLM model to use |
-v, --verbose | Show verbose output |
Result Object
Completion Reasons
promise
promise
Agent output contained a promise tag with TEXT matching the configured promise.
goal
goal
Agent output contained completion keywords like “task completed” or “done”.
max_iterations
max_iterations
Reached the maximum iteration limit without completion signal.
doom_loop
doom_loop
Detected repeated identical actions (agent stuck in a loop).
timeout
timeout
Execution exceeded the configured timeout.
error
error
An error occurred during execution.
Best Practices
Use Completion Promises
Always set a
completion_promise for reliable termination instead of relying on keyword detection.Enable Context Clearing for Long Tasks
Use
clear_context=True for tasks that should rely on file state rather than conversation memory.Set Reasonable Limits
Configure
max_iterations based on task complexity. Start low and increase if needed.Async Execution
Run autonomous loops asynchronously for concurrent agent execution:run_autonomous_async() uses achat() internally for non-blocking I/O, enabling true concurrent execution of multiple agents.
