Execute Tool Call • AI Agent SDK

execute_tool_call: Execute a tool call with all hooks and middleware.

execute_tool_call

Method

</div>

This is a method of the MiddlewareManager class in the middleware module.

Execute a tool call with all hooks and middleware.

Order:

  1. before_tool hooks (in order)
  2. wrap_tool_call middleware chain
  3. actual tool call
  4. after_tool hooks (in reverse order)
Diagram

uses

returns

Agent

Tool: execute_tool_call

Result

Signature

python
def execute_tool_call(request: ToolRequest, tool_fn: Callable[[ToolRequest], ToolResponse]) -> ToolResponse

Parameters

ParamField ToolRequest

No description available.

ParamField Callable

No description available.

Returns

ResponseField ToolResponse

The result of the operation.

Uses

  • tool_fn
  • run_before_tool
  • run_after_tool
  • execute

Source

View on GitHub

praisonaiagents/hooks/middleware.py at line 497


Related Documentation