run_autonomous
Method
This is a method of the Agent class in the agent module.Run an autonomous task execution loop. This method executes a task autonomously, using the agent’s tools and capabilities to complete the task. It handles:
- Progressive escalation based on task complexity
- Doom loop detection and recovery
- Iteration limits and timeouts
- Completion detection (keyword-based or promise-based)
- Optional context clearing between iterations
Signature
Parameters
str
required
The task to execute
Optional
Override max iterations (default from config)
Optional
Timeout in seconds (default: no timeout)
Optional
Optional string that signals completion when wrapped in <promise>TEXT</promise> tags in the response
bool
default:"False"
Whether to clear chat history between iterations (forces agent to rely on external state like files)
Returns
Any
AutonomyResult with success status, output, and metadata
Exceptions
ValueError
ValueError
If autonomy is not enabled
Usage
Uses
ValueErrortime_module.timeisoformatdatetime.nowget_recommended_stageAutonomyResultchatclear_history
Source
View on GitHub
praisonaiagents/agent/agent.py at line 1904
