Skip to main content

hooks

Rust AI Agent SDK Hooks Module for PraisonAI Rust SDK. Provides a powerful hook system for intercepting and modifying agent behavior at various lifecycle points. Unlike callbacks (which are for UI events), hooks can intercept, modify, or block tool execution.

Features

  • Event-based hook system (BeforeTool, AfterTool, BeforeAgent, etc.)
  • Function hooks for in-process customization
  • Matcher patterns for selective hook execution
  • Decision outcomes (allow, deny, block)

Usage

Import

Classes

HookInput

Input data for hooks

HookResult

Result from a hook execution

HookDefinition

Hook definition

HookRegistry

Hook registry for managing hooks

HookRunner

Hook runner for executing hooks in a workflow

HookEvent

Event names for the hook system

HookDecision

Decision types for hook outputs

Rust Hooks

Rust Events

Rust Callbacks