Bounded autonomy with AutonomyConfig and AutonomyLevel
Dial autonomy explicitly instead of all-or-nothing
Production teams rarely want a completely unsupervised agent on day one. AutonomyConfig lets you pick an AutonomyLevel and pair it with hard guardrails: max_iterations, doom_loop_threshold, and max_budget_usd.
Example
from praisonai import Agent, AutonomyConfig, AutonomyLevel
auto_cfg = AutonomyConfig(
enabled=True,
level=AutonomyLevel.SUGGEST,
max_iterations=3,
doom_loop_threshold=2,
max_budget_usd=0.50,
)
agent = Agent(
name='BoundedWorker',
instructions='Suggest one quick README improvement in one sentence.',
autonomy=auto_cfg,
output='silent',
)
print('Level:', auto_cfg.level.value, '| Max iter:', auto_cfg.max_iterations, '| Budget: $' + str(auto_cfg.max_budget_usd))
print('Reply:', agent.start('Suggest one README improvement.'))Example explained
- AutonomyLevel.SUGGEST — Keeps human oversight active while automating safe intermediate steps.
- doom_loop_threshold=2 — Detects when an agent repeats the same failing action twice in a row and breaks the loop.
- max_budget_usd=0.50 — Enforces a hard dollar ceiling on autonomous runs.
Inspect all available AutonomyLevel tiers
Promote an agent gradually from read-only / supervised to higher autonomy only after its evaluation scorecard passes consistently.
Example
from praisonai import AutonomyLevel
for lvl in AutonomyLevel:
print('-', lvl.name, '->', lvl.value)Example explained
- for lvl in AutonomyLevel — Lists every built-in autonomy tier supported by the PraisonAI SDK.
Common pitfall: enabling autonomy without a budget or loop cap
An autonomous agent without max_iterations and doom_loop_threshold can repeat a failing tool call 50 times overnight. Always set both ceilings explicitly.
Reference: documentation