Praison AI
Enterprise
Agents
Bot
Use Cases
University
Docs
Mini-project: Guarded autonomous repo maintainer
Run
import tempfile from pathlib import Path from praisonai import Agent, HooksConfig, RulesConfig, AutonomyConfig, AutonomyLevel, ExecutionConfig audit = [] def scan_stale_todos() -> str: """Return stale TODO items in repo.""" return 'Found 2 stale TODOs in src/billing.py' with tempfile.TemporaryDirectory() as tmp: rules_path = Path(tmp) / 'AGENTS.md' rules_path.write_text('# Rules\n- Propose PRs only; never push to main.\n') maintainer = Agent( name='RepoMaintainer', instructions='Call scan_stale_todos and summarize a 1-sentence PR proposal.', tools=[scan_stale_todos], rules=RulesConfig(files=[str(rules_path)], char_budget=2000, workspace_path=tmp), hooks=HooksConfig(on_tool_call=lambda ev: audit.append(ev.tool_name)), autonomy=AutonomyConfig(enabled=True, level=AutonomyLevel.SUGGEST, max_iterations=3, doom_loop_threshold=2, max_budget_usd=0.25), execution=ExecutionConfig(max_iter=3, max_budget=0.25, context_compaction=True), output='silent', ) print('Report:', maintainer.start('Run weekly repo hygiene check')) print('Audit :', audit)
Press Run. The result appears here.
Esc
Search in
All
Docs
University