Skip to main content
Attach callbacks to agent lifecycle events for monitoring, logging, and custom behavior.

Quick Start

1

Step Callback

Monitor each agent step:
2

Tool Call Callback

Monitor tool executions:

Configuration Options


Common Patterns

Pattern 1: Logging All Events

Pattern 2: Custom Middleware


Best Practices

Callbacks run synchronously. Keep them fast to avoid slowing down the agent.
Middleware is ideal for logging, metrics, authentication, etc.
Wrap callback logic in try/except to prevent callback errors from crashing the agent.

See also — don’t confuse the three systems. HooksConfig on this page is the live path, consumed by Agent(hooks=...). It is not the same as .praisonai/hooks.json (the standalone Memory HooksManager utility you call yourself). For the full live-hooks package see Hooks.

Hooks System

Learn about the hooks system

Memory HooksManager

Standalone .praisonai/hooks.json utility you invoke yourself

Observability

Monitoring and tracing