Skip to main content

MiddlewareManager

Defined in the middleware module.
AI Agent Manages middleware for an agent. Provides methods to execute before/after hooks and middleware chains for both model and tool calls.

Constructor

hooks
Optional
No description available.

Methods

has_model_hooks()

Check if any model hooks are registered.

has_tool_hooks()

Check if any tool hooks are registered.

run_before_model()

Run all before_model hooks.

run_after_model()

Run all after_model hooks (in reverse order).

run_before_tool()

Run all before_tool hooks.

run_after_tool()

Run all after_tool hooks (in reverse order).

execute_model_call()

Execute a model call with all hooks and middleware.

execute_tool_call()

Execute a tool call with all hooks and middleware.

Source

View on GitHub

praisonaiagents/hooks/middleware.py at line 328

Middleware Feature