Skip to content

.Net Agent Orchestration: Incomplete response for HandoffOrchestration #12718

@crickman

Description

@crickman

Agent dialog:

The second President of the United States was John Adams.
He served from March 4, 1797, to March 4, 1801.
A leading Founding Father, he had been George Washington's Vice President before succeeding him.
Adams was a member of the Federalist Party.
He was defeated for a second term by Thomas Jefferson in the election of 1800.

Orchestration response:

Provided information about the second US President, John Adams, including his term dates, prior role as Vice President, party affiliation, and significance in American history.

Repro Code

using Microsoft.Agents.Orchestration;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.AI.Agents;
using OpenAI;

string oaikey = Environment.GetEnvironmentVariable("AI:OpenAI:ApiKey")!;
IChatClient client = new OpenAIClient(oaikey).GetOpenAIResponseClient("o4-mini").AsIChatClient();

Agent triage = new ChatClientAgent(client, new()
{
    Name = "Triage Agent",
    Instructions = "You determine which agent to use based on the user's homework question.",
});

Agent historyTutor = new ChatClientAgent(client, new()
{
    Name = "HistoryTutor",
    Description = "A tutor specializing in historical events and context.",
    Instructions = "You provide assistance with historical queries. Explain important events and context clearly.",
});

Agent mathTutor = new ChatClientAgent(client, new()
{
    Name = "MathTutor",
    Description = "A tutor specializing in mathematics and problem-solving.",
    Instructions = "You provide help with math problems. Explain your reasoning at each step and include examples.",
});

var handoffs = new HandoffOrchestration(OrchestrationHandoffs
    .StartWith(triage)
    .Add(triage, historyTutor, mathTutor))
{
    StreamingResponseCallback = (update) => { Console.WriteLine(update); return default; }
};

var result = await handoffs.InvokeAsync("Who was the second president of the United States?");
Console.WriteLine(await result);

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codeagentsbugSomething isn't workingmulti-agentIssues for multi-agent orchestration

Type

Projects

Status

Bug

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions