Skip to content

.NET: [Bug]: AgentSession ignored by agent.RunStreamingAsync after upgrade from 1.0.0-preview.260205.1 to 1.0.0-preview.260209.1 #3848

@IharYakimush

Description

@IharYakimush

Description

looks like streaming invocation of agent ignores session.

  1. Tell me a joke about a pirate. -> any joke
  2. repeat last joke -> It seems I haven't told a joke yet...

see code sample for details

Code Sample

IChatClient chatClient = this.ServiceProvider.GetRequiredKeyedService<IChatClient>("default");

var agent = chatClient.AsAIAgent(instructions: "You are good at telling jokes.", name: "Joker");

AgentSession session = await agent.CreateSessionAsync();

// Invoke the agent and output the text result.
AgentResponse response = await agent.RunAsync("Tell me a joke about a pirate.",session: session);
this.Output.WriteLine(response.ToString());

StringBuilder sb = new();
// Invoke the agent with streaming support.
await foreach (var update in agent.RunStreamingAsync("repeat last joke", session: session))
{
    sb.Append(update);
}

this.Output.WriteLine(sb.ToString());

Error Messages / Stack Traces

Package Versions

1.0.0-preview.260209.1

.NET Version

.NET 10

Additional Context

No response

Metadata

Metadata

Assignees

Labels

.NETbugSomething isn't workingv1.0Features being tracked for the version 1.0 GA

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions