-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Trying to run workflow with AzureAIClient but got error:
agent_framework.exceptions.ServiceResponseException: <class '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': '6898a7898798c5ac324a06a56cd983c7'}}}
I'm using agent-framework-azure-ai 1.0.0b251218. Here's the repro code (modify the AzureAIAgentClient getting started sample with AzureAIClient):
import asyncio
from agent_framework import AgentRunUpdateEvent, ChatAgent, WorkflowBuilder, WorkflowOutputEvent
from agent_framework.azure import AzureAIClient
from azure.identity.aio import AzureCliCredential
from dotenv import load_dotenv
load_dotenv()
def create_writer_agent(client: AzureAIClient) -> ChatAgent:
return client.create_agent(
name="Writer",
instructions=(
"You are an excellent content writer. You create new content and edit contents based on the feedback."
),
)
def create_reviewer_agent(client: AzureAIClient) -> ChatAgent:
return client.create_agent(
name="Reviewer",
instructions=(
"You are an excellent content reviewer. "
"Provide actionable feedback to the writer about the provided content. "
"Provide the feedback in the most concise manner possible."
),
)
async def main() -> None:
async with AzureCliCredential() as cred, AzureAIClient(credential=cred) as client:
workflow = (
WorkflowBuilder()
.register_agent(lambda: create_writer_agent(client), name="writer")
.register_agent(lambda: create_reviewer_agent(client), name="reviewer", output_response=True)
.set_start_executor("writer")
.add_edge("writer", "reviewer")
.build()
)
last_executor_id: str | None = None
events = workflow.run_stream("Create a slogan for a new electric SUV that is affordable and fun to drive.")
async for event in events:
if isinstance(event, AgentRunUpdateEvent):
eid = event.executor_id
if eid != last_executor_id:
if last_executor_id is not None:
print()
print(f"{eid}:", end=" ", flush=True)
last_executor_id = eid
print(event.data, end="", flush=True)
elif isinstance(event, WorkflowOutputEvent):
print("\n===== Final output =====")
print(event.data)
if __name__ == "__main__":
asyncio.run(main())Note: the first agent succeeded but the workflow failed:
python .\azureaiagent-workflow.py
Writer: "Charge Into Fun – Affordable Power, Unstoppable Ride."Traceback (most recent call last):
File "C:\Users\qidon\AIApps\debug-workflow\.venv\Lib\site-packages\agent_framework\openai\_responses_client.py", line 132, in _inner_get_streaming_response
async for chunk in await client.responses.create(stream=True, **run_options):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\qidon\AIApps\debug-workflow\.venv\Lib\site-packages\openai\resources\responses\responses.py", line 2480, in create
return await self._post(
^^^^^^^^^^^^^^^^^
...<42 lines>...
)
^
File "C:\Users\qidon\AIApps\debug-workflow\.venv\Lib\site-packages\openai\_base_client.py", line 1797, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\qidon\AIApps\debug-workflow\.venv\Lib\site-packages\openai\_base_client.py", line 1597, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: 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': '6898a7898798c5ac324a06a56cd983c7'}}}
And my pip list (just pip install agent-framework-azure-ai):
Package Version
------------------------------------- ------------
agent-framework-azure-ai 1.0.0b251218
agent-framework-core 1.0.0b251218
aiohappyeyeballs 2.6.1
aiohttp 3.13.2
aiosignal 1.4.0
annotated-types 0.7.0
anyio 4.12.0
attrs 25.4.0
azure-ai-agents 1.2.0b5
azure-ai-projects 2.0.0b2
azure-core 1.37.0
azure-identity 1.25.1
azure-storage-blob 12.27.1
certifi 2025.11.12
cffi 2.0.0
charset-normalizer 3.4.4
click 8.3.1
colorama 0.4.6
cryptography 46.0.3
distro 1.9.0
frozenlist 1.8.0
h11 0.16.0
httpcore 1.0.9
httpx 0.28.1
httpx-sse 0.4.3
idna 3.11
importlib_metadata 8.7.1
isodate 0.7.2
jiter 0.12.0
jsonschema 4.25.1
jsonschema-specifications 2025.9.1
mcp 1.25.0
msal 1.34.0
msal-extensions 1.3.1
multidict 6.7.0
openai 2.14.0
opentelemetry-api 1.39.1
opentelemetry-sdk 1.39.1
opentelemetry-semantic-conventions 0.60b1
opentelemetry-semantic-conventions-ai 0.4.13
packaging 25.0
pip 25.3
propcache 0.4.1
pycparser 2.23
pydantic 2.12.5
pydantic_core 2.41.5
pydantic-settings 2.12.0
PyJWT 2.10.1
python-dotenv 1.2.1
python-multipart 0.0.21
pywin32 311
referencing 0.37.0
requests 2.32.5
rpds-py 0.30.0
sniffio 1.3.1
sse-starlette 3.0.4
starlette 0.50.0
tqdm 4.67.1
typing_extensions 4.15.0
typing-inspection 0.4.2
urllib3 2.6.2
uvicorn 0.40.0
websockets 15.0.1
yarl 1.22.0
zipp 3.23.0
Metadata
Metadata
Assignees
Labels
Type
Projects
Status