-
Notifications
You must be signed in to change notification settings - Fork 660
Description
Please read this first
- Have you read the docs? Yes
- Have you searched for related issues? Others may have faced similar issues. Yes
Problem
Handoffs are currently implemented as tools, which (afaik) subject them to tool-level configs. One of these configs is parallel_tool_calls, which allows for multiple tool calls to be generated in a single turn. When enabled, multiple handoffs can also be generated in a single turn. However, by definition, handoffs are serial, so the SDK currently deals with this by rejecting all but the first generated handoff with a custom string: "Multiple handoffs detected, ignoring this one."
Empirically, I've noticed that keeping references to SDK-rejected handoffs in the conversation history leads to handoff performance degradation. Agents end up being deterred from handing off to the agents that were SDK-rejected in prior turns, though the rejection was not a reflection of the quality of the handoff or any user intent. I've also verified that removing references to SDK-rejected handoffs addresses the issue.
Suggested Fix
Ask: Instead of rejecting handoffs post-generation, can we exempt handoffs from parallel_tool_calls so they aren't generated in the first place?