To Tool Function • AI Agent SDK
to_tool_function: Convert this handoff to a tool function that can be called by the LLM.
to_tool_function
Method
</div>
This is a method of the Handoff class in the handoff module.
Convert this handoff to a tool function that can be called by the LLM.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%
graph LR
agent["Agent"] -- "uses" --> tool["Tool: to_tool_function"]
tool -- "returns" --> result["Result"]
style tool fill:#189AB4,color:#fff
style agent fill:#8B0000,color:#fff
style result fill:#8B0000,color:#fffSignature
def to_tool_function(source_agent: 'Agent') -> CallableParameters
ParamField
AgentThe agent that will be using this handoff
Returns
ResponseField
CallableA callable function that performs the handoff
Uses
time.timelogger.infoHandoffResulton_delegationlogger.warninglogger.errorinspect.Parameterinspect.Signature
Source
View on GitHubpraisonaiagents/agent/handoff.py at line 1057