Skip to main content

Hooks Overview

Hooks are decorator-based lifecycle handlers that let you observe and modify agent behavior at key execution points.

Hook Categories

Egregore provides 5 hook categories:

Basic Usage

Hook Registration

Use decorators directly on agent instance:

Hook Context Objects

Every hook receives a context object with relevant data:

Common Use Cases

Logging and Monitoring

Error Handling

Content Filtering

Validation

Hook Execution Order

Multiple hooks execute in registration order:

What’s Next?

Tool Hooks

Tool execution lifecycle

Context Hooks

Context tree operations

Streaming Hooks

Real-time content processing

Message Hooks

Message handling and modification