Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change that prevents per-call execution settings from overwriting agent defaults.
No open issues 🎉
What changed in this PR
This PR prevents per-call execution settings from permanently replacing ChatCompletionAgent defaults, while preserving public signatures and argument precedence.
Changes:
- Copies the agent’s execution-settings map before merging invocation overrides.
- Adds regression and control cases for
get_responseandinvoke, checking that subsequent calls retain defaults and input arguments remain unchanged.
| File | Description |
|---|---|
python/tests/unit/agents/test_agent_settings_isolation.py |
Tests settings isolation with and without per-call overrides. |
python/semantic_kernel/agents/agent.py |
Copies the defaults map before applying overrides. |
Review effort: Balanced
This branch was successfully deployed
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
A per-call model override permanently changes a ChatCompletionAgent's defaults. For example, an agent configured with temperature 0.1 receives a single invocation override of 0.9; the next call without overrides also uses 0.9. Both get_response and invoke reproduce this behavior.
Description
Copy the agent's execution-settings map before merging invocation overrides. Ordinary argument precedence and public signatures stay the same.
Validation: two regression cases fail on unchanged main and two controls pass. The fix passes 97 related agent/channel/argument tests, Ruff 0.9.6 lint/format, Bandit, wheel build and four public consumers using the installed wheel. The full optional-provider matrix was not run.
Related: #14680 handles a business argument named settings; #13598 changes KernelArguments constructors/operators. Neither copies this agent map before updating it.
Contribution Checklist
Prepared and verified with OpenAI Codex assistance.