autonomy • AI Agent SDK
Agent Autonomy Module.
autonomy
AI Agent
Agent Autonomy Module.
Provides agent-centric autonomy configuration and helpers. This module integrates escalation, doom loop detection, and observability directly into the Agent class as first-class capabilities.
Unified Architecture: – AutonomyStage is an alias for EscalationStage (single source of truth) – AutonomyTrigger delegates to EscalationTrigger (DRY) – DoomLoopTracker adds recovery actions on top of basic detection
Usage:
from praisonaiagents import Agent
# Enable autonomy with defaults
agent = Agent(instructions="...", autonomy=True)
# Enable with custom config
agent = Agent(
instructions="...",
autonomy={
"max_iterations": 30,
"doom_loop_threshold": 5,
"auto_escalate": True
}
)
# Run autonomous task
result = agent.run_autonomous("Refactor the auth module")
print(result.success, result.output)Import
from praisonaiagents.agent import autonomyClasses
Configuration for Agent autonomy features.
AutonomySignalSignals detected from prompts for autonomy decisions.
AutonomyTriggerDetects signals from prompts for autonomy decisions.
AutonomyResultResult of an autonomous execution.
DoomLoopTrackerTracks actions to detect doom loops with graduated recovery.
AutonomyMixinHelper-only trait for autonomy utilities.
Constants
| Name | Value |
|---|---|
VALID_AUTONOMY_LEVELS | {'suggest', 'auto_edit', 'full_auto'} |
_ESCALATION_TO_AUTONOMY_SIGNAL | {'simple_question': 'simple_question', 'file_references': 'file_references', 'code_blocks': 'code_blocks', 'edit_intent': 'edit_intent', 'test_intent': 'test_intent', 'refactor_intent': 'refactor_inte... |
_AUTONOMY_TO_ESCALATION_SIGNAL | {v: k for k, v in _ESCALATION_TO_AUTONOMY_SIGNAL.items()} |
VALID_AUTONOMY_MODES | {'caller', 'iterative'} |
_LEVEL_TO_DEFAULT_MODE | {'suggest': 'caller', 'auto_edit': 'caller', 'full_auto': 'iterative'} |