-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Bug Description
The fix in commit 184ee9d5 intended to pass instructions to Azure AI Foundry agents, but it uses the wrong variable name.
Location
File: agent_framework_azure_ai/_client.py
Method: _get_agent_reference_or_create
Line: ~357
The Bug
The current code at line 357:
for instructions in [messages_instructions, run_options.get("instructions")]But the method signature at line 293-299 is:
async def _get_agent_reference_or_create(
self,
run_options: dict[str, Any],
messages_instructions: str | None,
chat_options: Mapping[str, Any] | None = None, # <-- This is the correct variable
) -> dict[str, str]:The instructions field is in chat_options, not in run_options. The base class explicitly excludes instructions from run_options (similar to how response_format is handled on line 351-352).
The Fix
Change line 357 from:
for instructions in [messages_instructions, run_options.get("instructions")]To:
for instructions in [messages_instructions, chat_options.get("instructions")]Impact
All agents created via Azure AI Foundry are created WITHOUT their YAML-defined instructions, making them respond with generic behavior instead of following their configured personas/instructions.
Steps to Reproduce
- Create a YAML agent definition with
kind: Promptand custom instructions - Run a workflow using
AzureAIClient - Observe that the agent in Azure AI Foundry has no instructions (visible in Foundry portal)
- The agent responds generically instead of following the instructions
Environment
- agent-framework version: 1.0.0b260130
- azure-ai-projects version: 2.0.0b3
- Python: 3.12
Workaround
Apply this patch manually:
sed -i 's/run_options.get("instructions")/chat_options.get("instructions")/g' \
/path/to/site-packages/agent_framework_azure_ai/_client.pyRelated
This bug was introduced in the same commit that was supposed to fix it: 184ee9d5
The commit correctly identified the issue but used the wrong variable name in the fix.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status