Skip to content

Python: HandoffBuilder: Use agent description in auto-generated handoff tools #2713

Closed

Description

@lbbniu

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)

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Dec 9, 2025
  2. changed the title [-]HandoffBuilder: Use agent description in auto-generated handoff tools[/-] [+]Python: HandoffBuilder: Use agent description in auto-generated handoff tools[/+] on Dec 9, 2025
  3. moved this from Bug to In Progress in Agent Frameworkon Dec 11, 2025
  4. moved this from In Progress to Done in Agent Frameworkon Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

orchestrationUsage: [Issues, PRs], Target: multi-agent orchestration (high-level patterns)pythonUsage: [Issues, PRs], Target: Python

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions