Quick Start
Plugin Types
Tool Plugin
Hook Plugin
Agent Plugin
LLM Plugin
Plugin Hooks
| Hook | When Triggered | Use Case |
|---|---|---|
BEFORE_AGENT | Before agent processes input | Input validation, logging |
AFTER_AGENT | After agent produces output | Output formatting, caching |
BEFORE_TOOL | Before tool execution | Permission checks, rate limiting |
AFTER_TOOL | After tool returns result | Result transformation |
BEFORE_LLM | Before LLM API call | Token counting, prompt injection |
AFTER_LLM | After LLM response | Response caching, analytics |
ON_ERROR | When error occurs | Error logging, recovery |
ON_START | When plugin starts | Initialization |
ON_STOP | When plugin stops | Cleanup |
Plugin Manager
Discovery & Loading
Function Plugin
Create simple function-based plugins:Best Practices
Use appropriate plugin types
Use appropriate plugin types
Choose
ToolPlugin for adding capabilities, HookPlugin for intercepting events, AgentPlugin for modifying behavior.Handle errors gracefully
Handle errors gracefully
Always wrap plugin logic in try-catch blocks to prevent breaking the agent pipeline.
Keep plugins lightweight
Keep plugins lightweight
Plugins run in the hot path - avoid heavy computations or blocking operations.
Version your plugins
Version your plugins
Use semantic versioning to track plugin compatibility with SDK versions.

