Connect to your A2A agent
Unit 5 of 7 · Module 15: Discover Azure AI Agents with A2A
Before you start
Short explainers for ideas this lesson builds on. Watch these first if they're new to you.
Read this lesson
Calling the courier company
A client is how your app talks to an A2A agent. Think of calling a courier company. You look up their card to see what they offer and where to send orders, you place the order, and then you get either an instant answer or a tracking number. To connect, the client needs the server's base URL. It fetches the agent card from the well-known address, and it's set up from that card. That's the whole handshake: address, card, client.
Two kinds of request, two kinds of reply
You can send a request two ways. Non-streaming sends it and waits for the full answer, which suits simple, single-reply jobs. Streaming delivers the answer in pieces as the agent works, which suits long tasks and live progress. A request carries a role, like user, and the message content. The reply comes back in one of two forms. It's either a direct message, the answer itself, or a task, which is like a tracking number. You can check a task's status, fetch its artifacts when it's done, or cancel it. A good client handles both.
A few details
Every request gets its own ID, so replies can be matched up. Streamed replies arrive asynchronously, and you may see partial results before the final one. Simple agents reply with a message straight away, while bigger agents might juggle several tasks at once. In the current Python SDK, you resolve the card with A2ACardResolver, create a client with create_client, and call send_message. In Agent Framework, A2AAgent wraps a remote A2A agent so you can run it like any other agent. And a Foundry agent can call a remote A2A agent through the built-in A2A tool.
Facts from Microsoft's documentation: Agent Framework: A2A agent service; Connect to an A2A agent endpoint from Foundry Agent Service (CC BY 4.0), rewritten in Loop's own words and examples. Narration, animation, and quiz by Loop. Microsoft, Azure, and Microsoft Foundry are trademarks of Microsoft. Loop is independent and not affiliated with or endorsed by Microsoft.