Exercises

Solve 6 real-world hook, rule, and bounded-autonomy scenarios.

1. Your on_tool_call callback was defined as def log(name, args): and raised TypeError when the agent called a tool. How do you fix it?

2. An agent must never issue refunds over $100 even if a user tries prompt injection. Where must that rule live?

3. You want one callback to fire whenever ANY task in a 4-agent PraisonAIAgents team starts or completes. Which config class do you use?

4. Why does RulesConfig accept a char_budget parameter?

5. An autonomous agent keeps calling the exact same failing tool with identical arguments. Which AutonomyConfig field stops this pattern?

6. You schedule a Heartbeat watchdog every 5 minutes (288 runs/day). What is essential to configure on the watchdog agent?

Back to the Hooks and autonomy tutorial