Host an A2A server
Unit 4 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
Opening the shop
An agent with skills and a card still needs a shop front before anyone can visit. Hosting it as a server makes it reachable over HTTP. The server shows off the agent card, takes incoming A2A requests and passes them to the executor, and keeps track of each task, including streamed replies and conversations that span several turns.
Three parts
A server has three parts. The agent card is the sign in the window, published at a standard address: slash dot well-known slash agent-card dot json. The request handler is the clerk at the counter. It sends each request to the executor's execute or cancel, and records every task in a task store, like an order book. Even a simple agent needs one. The in-memory store is fine for learning, but real services need a durable store. Then the server application wraps it all up, using Starlette in Python, and an ASGI server like Uvicorn opens the doors on a network port.
In code
In the current Python SDK, it goes like this. Define the skill and the agent card, with an interface that gives the URL and uses JSON-RPC. Create a DefaultRequestHandler with your executor, an in-memory task store, and the agent card. Then build a Starlette app from two sets of routes, one that serves the agent card and one for JSON-RPC requests. Run it with Uvicorn, on port nine thousand nine hundred ninety-nine, for example. If you use Agent Framework, its A2AExecutor turns any agent into an A2A executor for you. And Microsoft Foundry can even do all of this for you. Switch on incoming A2A for a prompt agent, and Foundry publishes its card and accepts requests. It only handles text, doesn't stream, and callers sign in with Microsoft Entra ID.
Facts from Microsoft's documentation: Agent Framework: host agents with A2A; Enable incoming A2A on a Foundry agent (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.