Skip to main content
Plugins hook into the agent pipeline to add logging, metrics, caching, or custom behavior. They load in dependency order and unload cleanly.

Quick Start

Plugins are loaded lazily on the first arun() call. They register hooks on the agent’s pipeline phases.

Built-in Plugins

LoggingPlugin

Logs pipeline phase transitions and run lifecycle events.
Registers before:* and after:* hooks on all pipeline phases.

MetricsPlugin

Collects per-run timing metrics: phase durations, tool call count, total duration.

CachingPlugin

LRU cache for identical prompts. Cache key is SHA-256 of system prompt + user messages.

Creating Custom Plugins

Subclass Plugin and implement name and on_load:

Plugin Properties

Plugin Registry

Manage plugins programmatically:

Dependencies and Conflicts

Plugins declare dependencies with requires and conflicts with conflicts:
The registry uses topological sort (Kahn’s algorithm) to load plugins in dependency order. Missing dependencies or explicit conflicts raise ValueError.
Two plugins with overlapping modifies sets generate a warning but load successfully. Only conflicts blocks loading.

Imports