Execute Tool • AI Agent SDK
execute_tool: Execute a tool dynamically based on the function name and arguments.
execute_tool
Method
</div>
Execute a tool dynamically based on the function name and arguments. Injects agent state for tools with Injected[T] parameters.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%
graph LR
agent["Agent"] -- "uses" --> tool["Tool: execute_tool"]
tool -- "returns" --> result["Result"]
style tool fill:#189AB4,color:#fff
style agent fill:#8B0000,color:#fff
style result fill:#8B0000,color:#fffSignature
def execute_tool(function_name: Any, arguments: Any) -> AnyParameters
ParamField
AnyNo description available.
ParamField
AnyNo description available.
Returns
ResponseField
AnyThe result of the operation.
Uses
logging.debugAgentState
Source
View on GitHubpraisonaiagents/agent/agent.py at line 3842