Simplified API Reference
PraisonAI provides simplified helper functions following consistent naming patterns for common operations.Naming Convention
| Pattern | Purpose | Example |
|---|---|---|
add_X | Register something | add_hook, add_tool |
get_X | Retrieve something | get_tool, get_profile |
has_X | Check existence | has_hook, has_tool |
remove_X | Unregister | remove_hook, remove_tool |
list_X | List all items | list_tools, list_profiles |
Hooks
Intercept and modify agent behavior at lifecycle points.add_hook
Register a hook for an event.event(str | HookEvent): Event name like'before_tool','after_tool','before_llm', etc.callback(callable, optional): Hook function. If omitted, returns decorator.priority(int): Hook priority (lower = runs first). Default: 10matcher(str, optional): Pattern to match (e.g.,'write_*')
before_tool, after_tool, before_llm, after_llm, before_agent, after_agent, session_start, session_end, on_error, on_retry
has_hook
Check if hooks exist for an event.remove_hook
Remove a hook by ID.Tools
Manage tool registration.add_tool
Register a tool function.has_tool
Check if a tool exists.get_tool
Get a tool by name.remove_tool
Remove a tool.list_tools
List all registered tools.Agent Profiles
Pre-configured agent personas.add_profile
Register a custom profile.get_profile
Get a profile by name.has_profile
Check if profile exists.remove_profile
Remove a profile.list_profiles
List all profiles.general, coder, planner, reviewer, explorer, debugger
Display Callbacks
Hook into agent display output for custom UIs.add_display_callback
Register a callback for display events.interaction, tool_call, error, instruction, self_reflection, generating
add_approval_callback
Register callback for tool approval prompts.Hook Return Values
Hooks can return simple values instead ofHookResult:
| Return | Meaning |
|---|---|
None or no return | Allow the operation |
True | Allow the operation |
False | Deny the operation |
"reason" | Deny with custom message |
HookResult(...) | Full control (advanced) |

