Python: Fix AzureAIAgentClient dropping agent instructions#3563
Merged
eavanvalkenburg merged 1 commit intomicrosoft:mainfrom Feb 1, 2026
Merged
Python: Fix AzureAIAgentClient dropping agent instructions#3563eavanvalkenburg merged 1 commit intomicrosoft:mainfrom
eavanvalkenburg merged 1 commit intomicrosoft:mainfrom
Conversation
…flows In _prepare_options(), the 'instructions' key was excluded from run_options but never re-added. This caused instructions passed via as_agent(instructions=...) to be silently dropped, making agents in sequential workflows ignore their configured instructions. Fixes microsoft#3507
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in AzureAIAgentClient where agent instructions passed via the instructions parameter to as_agent() were being silently dropped, causing agents in workflows to ignore their configured instructions.
Changes:
- Added code to extract and include instructions from the options dictionary in
_prepare_options() - Added unit tests verifying instructions are properly included from options alone and merged with system message instructions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/azure-ai/agent_framework_azure_ai/_chat_client.py | Fixed _prepare_options() to extract and append instructions from options dict after processing system messages |
| python/packages/azure-ai/tests/test_azure_ai_agent_client.py | Added two comprehensive unit tests for instruction handling from options and merging behavior |
dmytrostruk
approved these changes
Feb 1, 2026
eavanvalkenburg
approved these changes
Feb 1, 2026
eavanvalkenburg
pushed a commit
to eavanvalkenburg/agent-framework
that referenced
this pull request
Feb 1, 2026
…flows (microsoft#3563) In _prepare_options(), the 'instructions' key was excluded from run_options but never re-added. This caused instructions passed via as_agent(instructions=...) to be silently dropped, making agents in sequential workflows ignore their configured instructions. Fixes microsoft#3507
4 tasks
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
In
AzureAIAgentClient._prepare_options(), theinstructionskey was in theexclude_keysset with a comment "handled via messages", but instructions from the options dict were never actually extracted and added to the final instructions list. Only instructions from system/developer messages were being included.Description
AzureAIAgentClientsilently dropped instructions passed via options, causing agents in sequential workflows to ignore their configured instructions_prepare_options()Contribution Checklist