.NET: Fix handoff function naming (#1370)

* Fix handoff function naming

We don't need the agent's name or a guid in the handoff name... we can just use simple numbering. There's a possibility that someone built an agent with a built-in function tool named "handoff_to_x"; if that turns out to be an issue, we could add back some longer bit of randomness.

* Update dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffAgentExecutor.cs

---------

Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
This commit is contained in:
Stephen Toub
2025-10-21 11:23:53 -04:00
committed by GitHub
Unverified
parent 731e3a7633
commit 22d76e5780
@@ -43,9 +43,11 @@ internal sealed class HandoffAgentExecutor(
},
};
int index = 0;
foreach (HandoffTarget handoff in handoffs)
{
var handoffFunc = AIFunctionFactory.CreateDeclaration($"{HandoffsWorkflowBuilder.FunctionPrefix}{handoff.Target.GetDescriptiveId()}", handoff.Reason, s_handoffSchema);
index++;
var handoffFunc = AIFunctionFactory.CreateDeclaration($"{HandoffsWorkflowBuilder.FunctionPrefix}{index}", handoff.Reason, s_handoffSchema);
this._handoffFunctionNames.Add(handoffFunc.Name);