Skip to content

.Net: ChatClientAgent (Non-Streaming initial impl) - #65

Merged
Roger Barreto (rogerbarreto) merged 14 commits into
microsoft:mainfrom
rogerbarreto:features/chatclientagent
Jun 11, 2025
Merged

.Net: ChatClientAgent (Non-Streaming initial impl)#65
Roger Barreto (rogerbarreto) merged 14 commits into
microsoft:mainfrom
rogerbarreto:features/chatclientagent

Conversation

@rogerbarreto

@rogerbarretoRoger Barreto (rogerbarreto) commented Jun 10, 2025

Copy link
Copy Markdown
Member

Motivation

This pull request introduces a series of changes to enhance the functionality of the Agent abstraction and its implementations, particularly focusing on the ChatClientAgent. Key updates include extending the Agent API, implementing the ChatClientAgent class with metadata and logging capabilities, and adding unit tests to validate the new functionality.

Enhancements to Agent API:

Implementation of ChatClientAgent:

Logging Enhancements:

Unit Tests:

Additional Updates:

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces non‐streaming implementation enhancements for a ChatClientAgent along with several new supporting classes and unit tests to validate the new functionality. Key changes include extending the Agent API to accept a CancellationToken, adding new implementations such as ChatClientAgent, ChatClientAgentThread, and associated metadata and run options classes, and updating unit tests to cover invocation, thread message retrieval, and logging.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
dotnet/tests/Microsoft.Agents.UnitTests/UnitTest1.csRemoved a placeholder test file.
dotnet/tests/Microsoft.Agents.UnitTests/ChatCompletion/ChatClientAgentThreadTests.csAdded tests to verify ChatClientAgentThread implements IMessagesRetrievableThread and its message-retrieval functionality.
dotnet/tests/Microsoft.Agents.UnitTests/ChatCompletion/ChatClientAgentTests.csAdded unit tests to validate ChatClientAgent definition, invocation, and streaming (skipped) functionality.
dotnet/tests/Microsoft.Agents.Abstractions.UnitTests/AgentTests.csUpdated MockAgent to reflect the new CreateThreadAsync signature with CancellationToken.
dotnet/src/Microsoft.Agents/Microsoft.Agents.csprojUpdated project properties to enable InjectSharedThrow.
dotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgentThread.csImplemented ChatClientAgentThread with async message retrieval and thread management.
dotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgentRunOptions.csIntroduced a run options class to include ChatOptions.
dotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgentMetadata.csAdded a metadata class to encapsulate agent-specific details.
dotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgentLogMessages.csAdded logging extensions for ChatClientAgent leveraging LoggerMessageAttribute.
dotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.csImplemented ChatClientAgent with metadata, logging, and integration with a chat client.
dotnet/src/Microsoft.Agents/AgentExtensions.csProvided extension methods to ensure a non-null agent name for telemetry purposes.
dotnet/src/Microsoft.Agents.Abstractions/Agent.csUpdated CreateThreadAsync signature to accept an optional CancellationToken.
Comments suppressed due to low confidence (2)

dotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgentLogMessages.cs:23

  • Consider assigning unique EventIds for each LoggerMessage method to simplify log filtering and troubleshooting, even though disabling warnings is suppressing conflicts.
[LoggerMessage(EventId = 0, Level = LogLevel.Debug, Message = "[{MethodName}] Agent {AgentId}/{AgentName} Invoking service {ServiceType}.")]

dotnet/tests/Microsoft.Agents.UnitTests/ChatCompletion/ChatClientAgentTests.cs:102

  • [nitpick] The assertion 'Assert.Single(result.Messages);' appears to be duplicated within the test. Removing redundant assertions can improve test clarity.
Assert.Single(result.Messages);

Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgentRunOptions.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Comment threaddotnet/src/Microsoft.Agents/ChatCompletion/ChatClientAgent.cs Outdated
Merged via the queue into microsoft:main with commit 89daf17Jun 11, 2025
Reuben Bond (ReubenBond) pushed a commit to ReubenBond/agent-framework that referenced this pull request Oct 28, 2025
* Add non-streaming impl
* Add missing UT
* AgentThread UT + ensuring behavior
* Fix warnings
* Increase code coverage
* Add UT
* Updated abstractions fixes
* Adding AgentInvokingChatClient for instruction handling logic
* Moving AsAgentInvokingClient to ChatClientExtensions
* Address PR Feedback
* Address PR feedback
* Address PR feedback
* Signature updates for chat run options
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ChatClientAgent initial implementation with Non-Streaming API

5 participants

@rogerbarreto@stephentoub@markwallace-microsoft@westey-m