.NET: Add Run overloads to expose ChatClientAgentRunOptions in IntelliSense#3115
Merged
.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>
Copilot
AI
changed the title
[WIP] Add overload for ChatClientAgent.RunAsync to enhance options discoverability
Add extension methods to expose ChatClientAgentRunOptions in IntelliSense
Jan 7, 2026
westey-m
reviewed
Jan 7, 2026
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentExtensionsTests.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentExtensions.cs
Outdated
Show resolved
Hide resolved
SergeyMenshykh
approved these changes
Jan 7, 2026
Contributor
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 |
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentExtensionsTests.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgentExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentExtensionsTests.cs
Outdated
Show resolved
Hide resolved
markwallace-microsoft
approved these changes
Jan 8, 2026
This was referenced Feb 9, 2026
This was referenced Feb 16, 2026
This was referenced Feb 23, 2026
Open
This was referenced Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.