Azure / Azure/azure-sdk-for-python
MCP-enabled agents fail as second step in sequential YAML workflows with "Object/Array type mismatch" error
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 5.6k
- フォーク
- 3.4k
- 平均マージ
- 2日 2時間
- マージ済み PR(30日)
- 213
説明
## Environment
- **azure-ai-projects SDK version**: >=2.0.0b1
- **Python version**: 3.x
- **Date observed**: January 2026
## Description
When invoking an agent with MCP tools as the second step in a declarative YAML workflow, the workflow fails with an error indicating a type mismatch between Object and Array.
## Error Message
```
Unhandled workflow failure - #validateuser_agent (InvokeAzureAgent) ->
The requested operation requires an element of type 'Object', but the target element has type 'Array'.
```
## Steps to Reproduce
1. Create a prompt agent without MCP tools (Agent A)
2. Create a prompt agent with MCP tools (Agent B)
3. Create a sequential YAML workflow that invokes Agent A, then Agent B
4. Run the workflow
## Expected Behavior
Both agents execute successfully in sequence.
## Actual Behavior
- Agent A completes successfully
- Agent B fails immediately with the type mismatch error
- The error occurs regardless of input format (text, messages, static text)
## Workaround Verified
Using the same agent (without MCP) twice in sequence works correctly, confirming the workflow syntax is valid.
## Minimal Reproduction Code
```python
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import WorkflowAgentDefinition
from azure.identity import DefaultAzureCredential
workflow_yaml = """
kind: workflow
trigger:
kind: OnConversationStart
id: sequential_workflow
actions:
- kind: CreateConversation
id: create_conversation
conversationId: Local.ConversationId
- kind: InvokeAzureAgent
id: agent_no_mcp
conversationId: "=Local.ConversationId"
agent:
name: AgentWithoutMCP
input:
text: "=System.LastMessageText"
- kind: InvokeAzureAgent
id: agent_with_mcp
conversationId: "=Local.ConversationId"
agent:
name: AgentWithMCPTools # <-- This fails
input:
text: "Process the above."
- kind: EndConversation
id: end
"""
# Create and run workflow
with DefaultAzureCredential() as credential:
with AIProjectClient(endpoint=endpoint, credential=credential) as client:
workflow = client.agents.create_version(
agent_name="test-workflow",
definition=WorkflowAgentDefinition(workflow=workflow_yaml),
)
# Run workflow - second agent fails
```
## Additional Context
- The MCP agent works correctly when invoked standalone
- The MCP agent works correctly when invoked as the first (and only) agent in a workflow
- The issue only occurs when MCP agent is invoked after another agent in a sequential workflow
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
AIProjectClient、WorkflowAgentDefinition、create_version を使用した最小再現から始めます。MCP エージェントが 1 番目の場合と 2 番目の場合のシーケンシャルワークフローを比較し、それらのステップ間で InvokeAzureAgent が共有される会話と入力をどのように処理するかを調べます。完了条件は、Object/Array type mismatch が発生せず、両方のエージェントが順番に正常実行されることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- azure, python
- 領域
- ai, backend-api-design
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100