Skip to content

.Net: Bug: AgenGroupChat yields function response messages when it shouldn't #7075

@EdenTanami

Description

@EdenTanami

Describe the bug
According to the code of the AgenGroupChat's base abstract class - AgentChat, the group chat InvokeAsync should add to the History all the messages yielded by the agent and return to its caler only the assistant response (not tools related messages).
In practice, calling agentGroupChat.InvokeAsync returns both the final assistance response and the messages with tool role.

I reviewed the AgentChat code and saw that the condition of the returned messages is:
image
The if condition might be the problem - I saw that in my function response message there are 2 items, one isn't from the mentioned types-
image

To Reproduce
Steps to reproduce the behavior:

  1. Create an agent (ChatCompletionAgent) with kernel that contains plugin.
  2. Add the agent to a group chat.
  3. Add to the groupChat history user message that will trigger the the plugin.
  4. call the groupChat.InvokeAsync()
  5. See the tool message that returns.

Expected behavior
Only final assistant response returns from the groupChat InvokeAsync.

Screenshots
image

image

Platform
OS: Windows
IDE: Visual Studio,
Language: C#
Source: SK NuGet package version 1.15.0

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codeagentsbugSomething isn't workingexperimentalAssociated with an experimental feature

Type

No type

Projects

Status

Sprint: Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions