Uh oh!
There was an error while loading. Please reload this page.
.NET: Remove FunctionCalls and Tool Messages from Handoff passed messages - #3811
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in handoff orchestration where FunctionCall and Tool messages from handoff operations were being passed to target agents, causing the LLM to ignore the original user question. The fix filters out these internal workflow mechanics before sending messages to the target agent.
Changes:
- Added regression tests to verify that handoff function calls and tool results are not passed to target agents
- Added regression tests for multi-hop handoff scenarios to ensure proper message propagation
- Implemented FilterHandoffMessages method to remove handoff-related messages before sending to target agents
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/AgentWorkflowBuilderTests.cs | Added two comprehensive regression tests verifying that handoff targets do not receive handoff function messages in single and multi-hop scenarios |
| dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffAgentExecutor.cs | Added FilterHandoffMessages method to filter out handoff function calls and tool results; integrated filtering logic into the handoff message flow |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
90fda90 to
a8e72b7Comparea8e72b7 to
892fd4aCompare892fd4a to
7b9b34cCompareUh oh!
There was an error while loading. Please reload this page.
7b9b34c to
dc49414Comparedc49414 to
c9b5045Compare
Motivation and Context
The Handoff Orchestration currently does not filter out the HandoffTool FunctionCall messages or the Tool FunctionResult messages. This can cause odd behaviour, such as the LLM ignoring the original user question.
Description
FunctionCallandToolcontent (fixes.NET: [Bug]: Handoff orchestration does not pass message to the handoff agent #3161, .NET: [Workflows] Handoff tool response appears in chat history, causing inconsistent LLM behavior #3046)ChatMessagesbetween agentsContribution Checklist
Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.