Skip to content

Python: [Python] Exception occurs when using Sequential Workflow with AzureAIClient #2926

Closed

Description

@q33566

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.

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

Activity

  1. changed the title [-][Python] Exception occurs when using Sequential Workflow with AzureAIClient[/-] [+]Python: [Python] Exception occurs when using Sequential Workflow with AzureAIClient[/+] on Dec 17, 2025
  2. moved this from In Progress to Done in Agent Frameworkon Jan 5, 2026
  3. moonbox3 commented on Jan 5, 2026

    @moonbox3
    Contributor

    Thanks for filing, Kurt (@q33566). The fix (more a workaround, until the Azure SDK fixes their bug upstream) is in #3076.

    When I run your sample, I get an output:

    from typing import Any
    
    from agent_framework import (
        ChatMessage,
        Role,
        SequentialBuilder,
    )
    from agent_framework.azure import AzureAIClient
    from azure.identity.aio import DefaultAzureCredential
    
    
    async def main():
        async with (
            DefaultAzureCredential() as credential,
            AzureAIClient(credential=credential).create_agent(
                name="agent1",
                instructions="Help user to plan tasks",
            ) as agent1,
            AzureAIClient(credential=credential).create_agent(
                name="agent2",
                instructions="Refine the given plan",
            ) as agent2,
        ):
            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}")
    
    
    if __name__ == "__main__":
        import asyncio
    
        asyncio.run(main())

    Output:

    ===== Final Conversation =====
    ------------------------------------------------------------
    01 [user]
    Good morning! Help me plan my day.
    ------------------------------------------------------------
    02 [agent1]
    Good morning! I’d be happy to help you plan your day. Could you tell me a bit about what you need to accomplish today and any appointments or commitments you have? Also, let me know if you prefer a detailed hourly schedule or just a general task list.
    ------------------------------------------------------------
    03 [agent2]
    Good morning! I’d be happy to help you plan your day. To get started, could you please share:
    
    - Any appointments or meetings you have scheduled
    - Tasks or projects you want to accomplish
    - Personal activities or breaks you want to include
    - Your preferred wake-up and sleep times
    - Any specific priorities or deadlines
    
    With that info, I can create a tailored plan to help you have a productive and balanced day!
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

orchestrationUsage: [Issues, PRs], Target: multi-agent orchestration (high-level patterns)pythonUsage: [Issues, PRs], Target: Python

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions