Description
Currently, when HandoffBuilder._apply_auto_tools creates handoff tools for specialist agents, it doesn't use the agent's description. This means the auto-generated handoff tools have generic descriptions like "Handoff to the refund_agent agent" instead of more informative descriptions based on the actual agent's purpose.
Current Behavior
In _handoff.py:1160, the code calls:
tool = _create_handoff_tool(alias)
This creates a handoff tool with a generic description.
Expected Behavior
When the target Executor is an AgentExecutor, the code should extract the agent's description from AgentExecutor._agent.description and pass it to _create_handoff_tool:
description = None
executor = specialists.get(exec_id)
if isinstance(executor, AgentExecutor):
agent = getattr(executor, '_agent', None)
description = getattr(agent, 'description', None)
tool = _create_handoff_tool(alias, description)
Benefits
- More informative handoff tool descriptions for LLMs
- Better alignment with agent's actual purpose
- Improved tool selection by the coordinator agent
Files to Modify
python/packages/core/agent_framework/_workflows/_handoff.py: Update _apply_auto_tools method (around line 1149-1172)
Related Code
_create_handoff_tool already accepts an optional description parameter (line 69)
AgentExecutor._agent provides access to the wrapped agent (line 94 in _agent_executor.py)
Description
Currently, when
HandoffBuilder._apply_auto_toolscreates handoff tools for specialist agents, it doesn't use the agent's description. This means the auto-generated handoff tools have generic descriptions like "Handoff to the refund_agent agent" instead of more informative descriptions based on the actual agent's purpose.Current Behavior
In
_handoff.py:1160, the code calls:This creates a handoff tool with a generic description.
Expected Behavior
When the target Executor is an
AgentExecutor, the code should extract the agent's description fromAgentExecutor._agent.descriptionand pass it to_create_handoff_tool:Benefits
Files to Modify
python/packages/core/agent_framework/_workflows/_handoff.py: Update_apply_auto_toolsmethod (around line 1149-1172)Related Code
_create_handoff_toolalready accepts an optionaldescriptionparameter (line 69)AgentExecutor._agentprovides access to the wrapped agent (line 94 in_agent_executor.py)