-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Environment
- agent-framework==1.0.0b251216
- agent-framework-azure-ai==1.0.0b251216
- agent-framework==1.0.0b251209
- agent-framework-azure-ai==1.0.0b251209
Description
I created two agents using AzureAIClient and added them to a sequential workflow.
When I run the workflow, an error occurs.
This is unexpected because the same setup worked correctly last week using version 1.0.0b251209.
However, this week it crashes even when using the same version.
Error Message
'agent_framework_azure_ai._client.AzureAIClient'> service failed to complete the prompt: Error code: 400 -
{'error':
{'code': 'invalid_payload', 'message': 'Invalid payload', 'param': None, 'type': 'invalid_request_error', 'details':
[
{'code': 'ValidationError', 'message': 'type: Value is "array" but should be "string"', 'param': '/input', 'type': 'error'},
{'code': 'ValidationError', 'message': 'required: Required properties ["type"] are not present', 'param': '/input/1', 'type': 'error'},
{'code': 'ValidationError', 'message': 'type: Value is "array" but should be "string"', 'param': '/input/1/content', 'type': 'error'},
{'code': 'ValidationError', 'message': 'required: Required properties ["annotations"] are not present', 'param': '/input/1/content/0', 'type': 'error'}
],
'additionalInfo': {'request_id': '0ee672893116194c6d56a003b9ca6a8a'}
}
}
Reproduce
import os
from typing import Any
from agent_framework import (
ChatMessage,
Role,
SequentialBuilder,
)
from agent_framework.azure import AzureAIClient
from azure.ai.projects.aio import AIProjectClient
from azure.identity.aio import DefaultAzureCredential
project_client = AIProjectClient(
endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
credential=DefaultAzureCredential(),
)
credential = DefaultAzureCredential()
client1 = AzureAIClient(
project_client=project_client,
async_credential=credential,
)
client2 = AzureAIClient(
project_client=project_client,
async_acredential=credential,
)
agent1 = client1.create_agent(name="agent1", instructions="Help user to plan tasks")
agent2 = client1.create_agent(name="agent2", instructions="refine the givenplan")
workflow = SequentialBuilder().participants([agent1, agent2]).build()
events = await workflow.run("Good morning! Help me plan my day.")
outputs = events.get_outputs()
if outputs:
print("===== Final Conversation =====")
messages: list[ChatMessage] | Any = outputs[0]
for i, msg in enumerate(messages, start=1):
name = msg.author_name or (
"assistant" if msg.role == Role.ASSISTANT else "user"
)
print(f"{'-' * 60}\n{i:02d} [{name}]\n{msg.text}")
Related Issues
These issues all use AzureAIClient, which relies on the Azure AI Projects client.
The request format prepared by agent-framework is rejected by the Azure AI Projects
data plane REST APIs,
specifically the
create responses API,
used by the
Azure AI Project SDK.
- Python: AzureAIClient fails within GroupChatBuilder #2976
- Python: Multi‑turn with AgentFrameworkAgent + AzureAIClient to Azure AI Projects Foundry v2 agent fails on 2nd turn: agent_framework_azure_ai sends invalid input to agent/Responses #2964
- Python: [Python]
AzureAIClient400 error in workflow #3003
Root Cause
This issue may be caused by an input schema mismatch between the official OpenAI client and the OpenAI client obtained via AIProjectClient.get_openai_client() in Azure AI Projects.
agent-framework generates a structured input payload that is accepted by the official OpenAI Responses API, but the same payload is rejected by the OpenAI client created via the Azure AI Projects SDK (using the create responses API) with validation errors.
For more information, see: This issue in Azure AI Project SDK
Metadata
Metadata
Assignees
Labels
Type
Projects
Status