Uh oh!
There was an error while loading. Please reload this page.
.NET: Add Run overloads to expose ChatClientAgentRunOptions in IntelliSense - #3115
Conversation
…entAgentRunOptions Co-authored-by: westey-m <164392973+westey-m@users.noreply.github.com>
Co-authored-by: westey-m <164392973+westey-m@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR adds extension methods to improve IntelliSense discoverability of ChatClientAgentRunOptions when using ChatClientAgent. Previously, developers had to rely on documentation to know that ChatClientAgentRunOptions could be passed to methods accepting AgentRunOptions.
Key changes:
- Added
ChatClientAgentExtensionsclass with 12 extension methods acceptingChatClientAgentRunOptionsinstead of the baseAgentRunOptions - Each extension method casts the specialized options to the base type and delegates to existing methods
- Added comprehensive unit tests covering 8 of the 12 extension methods (RunAsync and RunStreamingAsync variants)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentExtensions.cs | New extension methods class providing 12 overloads for RunAsync, RunStreamingAsync, and generic RunAsync that explicitly accept ChatClientAgentRunOptions |
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentExtensionsTests.cs | New test file with unit tests for the extension methods, covering RunAsync and RunStreamingAsync variants but missing tests for the 4 generic RunAsync methods |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Motivation and Context
ChatClientAgentRunOptionsprovides specialized configuration forChatClientAgent.RunAsyncbut is not discoverable through IntelliSense. Users must read documentation to learn they can pass it to methods acceptingAgentRunOptions.Related: #521
Description
Added extension methods on
ChatClientAgentthat explicitly acceptChatClientAgentRunOptionsfor improved API discoverability.Implementation:
ChatClientAgentExtensionsclass with 12 extension methods covering allRunAsync,RunStreamingAsync, and genericRunAsync<T>overloadsChatClientAgentRunOptionstoAgentRunOptionsand delegates to existing base methodsChatClientAgentalready handles these optionsBefore:
After:
Contribution Checklist
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.