Skip to content

A2A/MCP #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

A2A/MCP #329

wants to merge 20 commits into from

Conversation

tracyboehrer
Copy link
Member

@tracyboehrer tracyboehrer commented Jun 11, 2025

This is for socialization. This is early, and raw.

#311
#312

New packages

  1. Microsoft.Agents.Hosting.A2A
  2. Microsoft.Agents.Hosting.MCP

A2A

  1. A2AAdapter
    1. Converts to/from A2A
    2. Forwards to AgentApplication
    3. Currently only SSE message/stream and tasks/get
    4. It can handle (to some degree) StreamingResponses
    5. Hard-coded AgentCard response
    6. Activity Entities included in Message DataParts
      1. Including schema in DataPart.Metadata
  2. TaskStore
    1. Stores Task state
      1. Current status, artifacts
      2. Message History
      3. Works for polling or SSE
  3. A2A Http endpoints (which just forward to A2AAdapter)
  4. A2ASample
    1. Handling A2A, MCP, and AP
    2. Only A2A/MCP changes in Program.cs
      1. services.AddA2AAdapter()
      2. app.MapA2A()

MCP

  1. Similar to A2A, just not as far along
  2. It does handle connection flow (returns capabilities)
  3. Handles a single Tool call

Challenges

  1. If used by MCS to call an SDK Agent (as a "skill"), then A2A payloads/protocol don't have all of the same concepts. For example, InvokeResponse. We could include InvokeResponse as an A2A Artifact (in the Task).
  2. Schema generation. Currently using NewtonSoft, which doesn't understand System.Text.Json attributes.

@github-actions github-actions bot added ML: Samples Tags changes to samples ML: Core Tags changes to core libraries ML: Packages labels Jun 11, 2025
@tracyboehrer
Copy link
Member Author

tracyboehrer commented Jun 17, 2025

From A2A CLI, demonstrate StreamingResponses from AgentApplication

  1. User sends "-stream"
  2. AgentApplication performs mock StreamingResponse with citation.
  3. Issues
    1. Metadata in DataParts is incorrect in some cases.
    2. Not storing artifact updates in Task.

message/stream

[
    {
        "contextId": "2c33a5c4a5c3450fbb288a26d5f3fd45",
        "history": [
            {
                "contextId": "2c33a5c4a5c3450fbb288a26d5f3fd45",
                "kind": "message",
                "messageId": "253279e2-ce25-437f-8e43-152b08d8fbef",
                "parts": [
                    {
                        "kind": "text",
                        "text": "-stream"
                    }
                ],
                "role": "user",
                "taskId": "20d97fdfcaf14d0b857d7ed0f8dcaaf9"
            }
        ],
        "id": "20d97fdfcaf14d0b857d7ed0f8dcaaf9",
        "kind": "task",
        "status": {
            "state": "submitted"
        }
    },
    {
        "contextId": "2c33a5c4a5c3450fbb288a26d5f3fd45",
        "final": false,
        "kind": "status-update",
        "status": {
            "message": {
                "kind": "message",
                "messageId": "99bc23e915a14dc6bcb0d5b8ba7840c4",
                "parts": [
                    {
                        "kind": "text",
                        "text": "Please wait while I process your request."
                    },
                    {
                        "data": {
                            "streamId": "f6ae1c7e-c63c-411f-afbf-ed7d2632fa8b",
                            "streamType": "informative",
                            "streamSequence": 1,
                            "type": "streaminfo",
                            "properties": {}
                        },
                        "kind": "data",
                        "metadata": {
                            "mimeType": "application/vnd.microsoft.entity.streaminfo",
                            "type": "object",
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "streamId": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "streamType": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "streamSequence": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "streamResult": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "type": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                ],
                "role": "agent"
            },
            "state": "working",
            "timestamp": "2025-06-17T15:53:55.4262465+00:00"
        },
        "taskId": "20d97fdfcaf14d0b857d7ed0f8dcaaf9"
    },
    {
        "append": false,
        "artifact": {
            "artifactId": "f6ae1c7e-c63c-411f-afbf-ed7d2632fa8b",
            "parts": [
                {
                    "kind": "text",
                    "text": "a quick"
                },
                {
                    "data": {
                        "streamId": "f6ae1c7e-c63c-411f-afbf-ed7d2632fa8b",
                        "streamType": "streaming",
                        "streamSequence": 2,
                        "type": "streaminfo",
                        "properties": {}
                    },
                    "kind": "data",
                    "metadata": {
                        "mimeType": "application/vnd.microsoft.entity.streaminfo",
                        "type": "object",
                        "schema": {
                            "type": "object",
                            "properties": {
                                "streamId": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "streamType": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "streamSequence": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "streamResult": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "type": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                }
            ]
        },
        "contextId": "2c33a5c4a5c3450fbb288a26d5f3fd45",
        "kind": "artifact-update",
        "lastChunk": false,
        "taskId": "20d97fdfcaf14d0b857d7ed0f8dcaaf9"
    },
    {
        "append": false,
        "artifact": {
            "artifactId": "f6ae1c7e-c63c-411f-afbf-ed7d2632fa8b",
            "parts": [
                {
                    "kind": "text",
                    "text": "a quick brown fox "
                },
                {
                    "data": {
                        "streamId": "f6ae1c7e-c63c-411f-afbf-ed7d2632fa8b",
                        "streamType": "streaming",
                        "streamSequence": 3,
                        "type": "streaminfo",
                        "properties": {}
                    },
                    "kind": "data",
                    "metadata": {
                        "mimeType": "application/vnd.microsoft.entity.streaminfo",
                        "type": "object",
                        "schema": {
                            "type": "object",
                            "properties": {
                                "streamId": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "streamType": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "streamSequence": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "streamResult": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "type": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                }
            ]
        },
        "contextId": "2c33a5c4a5c3450fbb288a26d5f3fd45",
        "kind": "artifact-update",
        "lastChunk": false,
        "taskId": "20d97fdfcaf14d0b857d7ed0f8dcaaf9"
    },
    {
        "append": false,
        "artifact": {
            "artifactId": "f6ae1c7e-c63c-411f-afbf-ed7d2632fa8b",
            "parts": [
                {
                    "kind": "text",
                    "text": "a quick brown fox jumped over something[1]"
                },
                {
                    "data": {
                        "streamId": "f6ae1c7e-c63c-411f-afbf-ed7d2632fa8b",
                        "streamType": "streaming",
                        "streamSequence": 4,
                        "type": "streaminfo",
                        "properties": {}
                    },
                    "kind": "data",
                    "metadata": {
                        "mimeType": "application/vnd.microsoft.entity.streaminfo",
                        "type": "object",
                        "schema": {
                            "type": "object",
                            "properties": {
                                "streamId": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "streamType": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "streamSequence": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ]
                                },
                                "streamResult": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "type": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            }
                        }
                    }
                }
            ]
        },
        "contextId": "2c33a5c4a5c3450fbb288a26d5f3fd45",
        "kind": "artifact-update",
        "lastChunk": false,
        "taskId": "20d97fdfcaf14d0b857d7ed0f8dcaaf9"
    },
    {
        "contextId": "2c33a5c4a5c3450fbb288a26d5f3fd45",
        "kind": "message",
        "messageId": "8a3ee958dfc94b53b3209cb57d97cd78",
        "parts": [
            {
                "kind": "text",
                "text": "a quick brown fox jumped over something[1]"
            },
            {
                "data": {
                    "streamId": "f6ae1c7e-c63c-411f-afbf-ed7d2632fa8b",
                    "streamType": "final",
                    "streamResult": "success",
                    "type": "streaminfo",
                    "properties": {}
                },
                "kind": "data",
                "metadata": {
                    "mimeType": "application/vnd.microsoft.entity.streaminfo",
                    "type": "object",
                    "schema": {
                        "type": "object",
                        "properties": {
                            "streamId": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "streamType": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "streamSequence": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "streamResult": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "type": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            },
            {
                "data": {
                    "@type": "Message",
                    "@context": "https://schema.org",
                    "@id": "",
                    "additionalType": [
                        "AIGeneratedContent"
                    ],
                    "citation": [
                        {
                            "position": 1,
                            "appearance": {
                                "name": "title",
                                "url": "https://example.com/fox-jump",
                                "abstract": "1",
                                "@type": "DigitalDocument"
                            },
                            "@type": "Claim"
                        }
                    ],
                    "type": "https://schema.org/Message"
                },
                "kind": "data",
                "metadata": {
                    "mimeType": "application/vnd.microsoft.entity.https://schema.org/Message",
                    "type": "object",
                    "schema": {
                        "type": "object",
                        "properties": {
                            "atType": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "atContext": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "atId": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "additionalType": {
                                "type": [
                                    "array",
                                    "null"
                                ],
                                "items": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            },
                            "citation": {
                                "type": [
                                    "array",
                                    "null"
                                ],
                                "items": {
                                    "$ref": "#/definitions/ClientCitation"
                                }
                            },
                            "usageInfo": {
                                "$ref": "#/definitions/SensitivityUsageInfo"
                            },
                            "type": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            }
        ],
        "role": "agent",
        "taskId": "20d97fdfcaf14d0b857d7ed0f8dcaaf9"
    },
    {
        "contextId": "2c33a5c4a5c3450fbb288a26d5f3fd45",
        "history": [
            {
                "contextId": "2c33a5c4a5c3450fbb288a26d5f3fd45",
                "kind": "message",
                "messageId": "253279e2-ce25-437f-8e43-152b08d8fbef",
                "parts": [
                    {
                        "kind": "text",
                        "text": "-stream"
                    }
                ],
                "role": "user",
                "taskId": "20d97fdfcaf14d0b857d7ed0f8dcaaf9"
            },
            {
                "contextId": "2c33a5c4a5c3450fbb288a26d5f3fd45",
                "kind": "message",
                "messageId": "8a3ee958dfc94b53b3209cb57d97cd78",
                "parts": [
                    {
                        "kind": "text",
                        "text": "a quick brown fox jumped over something[1]"
                    },
                    {
                        "data": {
                            "streamId": "f6ae1c7e-c63c-411f-afbf-ed7d2632fa8b",
                            "streamType": "final",
                            "streamResult": "success",
                            "type": "streaminfo",
                            "properties": {}
                        },
                        "kind": "data",
                        "metadata": {
                            "mimeType": "application/vnd.microsoft.entity.streaminfo",
                            "type": "object",
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "streamId": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "streamType": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "streamSequence": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "streamResult": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "type": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    {
                        "data": {
                            "@type": "Message",
                            "@context": "https://schema.org",
                            "@id": "",
                            "additionalType": [
                                "AIGeneratedContent"
                            ],
                            "citation": [
                                {
                                    "position": 1,
                                    "appearance": {
                                        "name": "title",
                                        "url": "https://example.com/fox-jump",
                                        "abstract": "1",
                                        "@type": "DigitalDocument"
                                    },
                                    "@type": "Claim"
                                }
                            ],
                            "type": "https://schema.org/Message"
                        },
                        "kind": "data",
                        "metadata": {
                            "mimeType": "application/vnd.microsoft.entity.https://schema.org/Message",
                            "type": "object",
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "atType": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "atContext": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "atId": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "additionalType": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "citation": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "$ref": "#/definitions/ClientCitation"
                                        }
                                    },
                                    "usageInfo": {
                                        "$ref": "#/definitions/SensitivityUsageInfo"
                                    },
                                    "type": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                ],
                "role": "agent",
                "taskId": "20d97fdfcaf14d0b857d7ed0f8dcaaf9"
            }
        ],
        "id": "20d97fdfcaf14d0b857d7ed0f8dcaaf9",
        "kind": "task",
        "status": {
            "state": "completed",
            "timestamp": "2025-06-17T15:53:56.9980602+00:00"
        }
    }
]

@github-actions github-actions bot added the ML: Tests Tags changes to tests label Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ML: Core Tags changes to core libraries ML: Packages ML: Samples Tags changes to samples ML: Tests Tags changes to tests WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant