Skip to content

.Net: Bug: The AgentChat history should contain all agent's messages #7183

@EdenTanami

Description

@EdenTanami

Describe the bug
In the current implementation, the ChatCompletionAgent returns only the final assistant response, the functions messages are appended to the channel's chat history.
So the ChatHistoryChannel returns to the AgentChat (and broadcast to the other channels) only the final assistant response.
Therefor the user, that creates the AgentChat, doesn't have access to the functions invocation.

Expected behavior

  1. All the messages that the ChatCompletionAgent creates during its invocation should be appended to the AgentChat's history.
  2. The ChatHistoryChannel shouldn't broadcast the function messages to the other channel as they aren't relevant to them and also not necessarily valid to them.
  3. Might need to filter the function messages when creating a new channel.

Additional context
Another thing that should be considered -
IAutoFunctionFilterInvocation enables terminating the function calling loop. In such cases the ChatCompletion returns to the caller the last function response (this response is also appended to the channel history).
Therefor the response's role should be checked before:

  1. Adding the chat completion response to the channel chat history (to avoid duplication).
  2. Broadcasting the chat completion response to the other channels (to not send them function response).

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

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codePR: in progressUnder development and/or addressing feedbackagentsbugSomething isn't working

Type

No type

Projects

Status

Sprint: Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions