Repository navigation
Closed
Labels
pythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythonworkflowsUsage: [Issues, PRs], Target: WorkflowsUsage: [Issues, PRs], Target: Workflows
Description
HI,
Current Setup : i have created multiple agents in AIFoundry with gpt4.1 model, each agent will have list of MCP apis attached to them under actions section
Error Info :
Error 1 :
Coordinator: {"selected_participant":"Agent1","instruction":"<instruction>","finish":false,"final_message":null}executor broke JSON is invalid: Expecting value: line 1 column 1 (char 0)
Error 2 : Coordinator/ manager agent JSON is getting duplicated as shown below
Coordinator: {"selected_participant":"<agentname>","instruction":"<instruction>","finish":false,"final_message":null}{"selected_participant":"<agentname>","instruction":"<instruction>","finish":false,"final_message":null}executor broke 1 validation error for ManagerSelectionResponse
Invalid JSON: trailing characters at line 1 column 208 [type=json_invalid, input_value='{"selected_participant":...e,"final_message":null}', input_type=str]
For further information visit https://errors.pydantic.dev/2.12/v/json_invalid
After which i came across below 2 link and i have tried what ever is suggest in those but the issue still exists.
- Python: agent_framework.exceptions.ServiceResponseException: <class 'agent_framework_azure_ai._client.AzureAIClient'> service failed to complete the prompt: Error code: 400 - {'error': {'message': "Invalid schema for response_format 'ManagerSelectionResponse'.... #2681
- Python: fix: GroupChat ManagerSelectionResponse JSON Schema for OpenAI Structured Outpu… #2750
I have tried to provide strict agent instructions to not generate improper json and also tried providing additional_chat_options as shown below :
response_schema = {
"title": "ManagerSelectionResponse",
"type": "object",
"description": "Response from manager agent with speaker selection decision.",
"properties": {
"selected_participant": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Selected Participant",
"description": "Name of participant to speak next (None = finish conversation)",
},
"instruction": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Instruction",
"description": "Optional instruction to provide to the selected participant",
},
"finish": {
"type": "boolean",
"default": False,
"title": "Finish",
"description": "Whether the conversation should be completed",
},
"final_message": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Final Message",
"description": "Optional text content for final message",
},
},
# OpenAI strict mode requires all properties to be in required array
"required": ["selected_participant", "instruction", "finish", "final_message"],
"additionalProperties": False,
}
managerAgent = ChatAgent(
chat_client= AzureAIAgentClient(
credential=credential,
project_endpoint = os.getenv("AZURE_PROJECT_ENDPOINT"),
model_deployment_name = os.getenv("AZURE_MODEL_DEPLOYMENT"),
agent_id="<agent_id>"
),
name="Coordinator" ,
additional_chat_options={
"response_format": {
"type": "json_schema",
"json_schema": {
"name": response_schema["title"],
"strict": True,
"schema": response_schema,
},
},
}
)
workflow = (
GroupChatBuilder()
.set_manager(managerAgent, display_name="Orchestrator")
.participants([<agent list>])
.build()
)
I also noticed in above issue links they have utilized AzureOpenAIChatClient but in my project i have used AzureAIAgentClient.
Note :
- All the agents which are configured inside the workflow return basic string as output not JSON.
- i am doing
async for event in workflow.run_stream(user_message):to obtain agent streaming output.
Metadata
Metadata
Assignees
Labels
pythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: PythonworkflowsUsage: [Issues, PRs], Target: WorkflowsUsage: [Issues, PRs], Target: Workflows
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]Invalid schema for response_format 'ManagerSelectionResponse'[/-][+]Python: Invalid schema for response_format 'ManagerSelectionResponse'[/+]moonbox3 commentedon Jan 12, 2026
This should already be fixed? We need to add a
model_config = ConfigDict(extra="forbid")to the Pydantic model -- which should be there. What version of the package are you using, GokulNathan (@legendgokul) ?legendgokul commentedon Jan 12, 2026
Currently using agent-framework 1.0.0b251001
moonbox3 commentedon Jan 12, 2026
We've had a lot of fixes since October 1. :) I remember fixing this bug a long time ago. Please consider upgrading to our latest version (1.0.0b260107). There are breaking changes from October 1 as we work to solidify the APIs. You can find latest syntax and samples here: https://github.com/microsoft/agent-framework/blob/main/python/samples/getting_started/workflows/orchestration/group_chat_agent_manager.py
moonbox3 commentedon Jan 12, 2026
Closing the issue for now. If you continue to hit problems, please either re-open or file a new issue. Thank you.
legendgokul commentedon Jan 12, 2026
sorry the current project contains version : 1.0.0b251218 ( DEC 19 release ), still we are facing same issue.
I will try updating my project to latest Jan 8th release and will validate if the issue still exists.
legendgokul commentedon Jan 12, 2026
HI Evan Mattson (@moonbox3) i have validated with latest version and i am still able to see above mentioned issues.