-
Notifications
You must be signed in to change notification settings - Fork 1k
.NET: Merge AgentRunOptions.AdditionalProperties into ChatOptions.AdditionalProperties #3184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.NET: Merge AgentRunOptions.AdditionalProperties into ChatOptions.AdditionalProperties #3184
Conversation
There was a problem hiding this comment.
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 implements the merging of AgentRunOptions.AdditionalProperties into ChatOptions.AdditionalProperties to enable proper propagation of additional properties through the agent execution stack. The PR also refactors ChatOptions merging tests into a dedicated test file for better organization.
Changes:
- Added logic to merge
AgentRunOptions.AdditionalPropertiesintoChatOptions.AdditionalPropertieswith highest precedence - Refactored ChatOptions merging unit tests from
ChatClientAgentTests.csinto a new dedicated fileChatClientAgent_ChatOptionsMergingTests.cs - Enhanced the
ChatOptionsMergingPrioritizesRequestOptionsOverAgentOptionsAsynctest to verify three-level precedence (agent → request → run options)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs | Added ApplyAgentRunOptionsOverrides logic to merge AgentRunOptions.AdditionalProperties into ChatOptions.AdditionalProperties; minor code style improvement in AdditionalProperties iteration |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgent_ChatOptionsMergingTests.cs | New dedicated test file containing all ChatOptions merging tests, including enhanced test for three-level precedence validation |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentTests.cs | Removed ChatOptions merging tests (moved to dedicated file) |
Motivation and Context
We should pass AgentRunOptions.AdditionalProperties to ChatOptions.AdditionalProperties in ChatClientAgent so that additional properties are replicated all the way down the stack.
The allows us to set a property on AgentRunOptions.AdditionalProperties without needing to break out of the abstraction and then access the property in a function tool via
FunctionInvokingChatClient.CurrentContext.Options?.AdditionalProperties#3179
Description
Contribution Checklist