Implement an agent executor
Unit 3 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
The interpreter's booth
At an international conference, an interpreter sits in a booth between the speaker and the audience, turning one language into another. An agent executor plays that role. It sits between the A2A protocol and your agent's own logic. Every request that arrives goes through the AgentExecutor interface. The executor reads the request, runs your agent, and sends the results back through a channel.
Execute and cancel
An executor has two jobs. Execute handles a request. It reads the details, like the user's message and the task it belongs to, from a request context, does the work, and puts the results on an event queue. Those results can be messages, task status updates, or artifacts, which are the outputs of a task, like a finished outline. Cancel stops a task that's still running, and a simple agent can just say that cancelling isn't supported.
A hello world walk-through
Here's the flow for a tiny hello world agent. A small helper class holds the actual logic, and just returns a greeting. The executor receives the request and calls that helper. It wraps the result as an event and puts it on the event queue. And the server sends that event back to whoever asked. In the current SDK, the order of events is checked. A reply is either one message on its own, or the task first, followed by its status and artifact updates.
Facts from Microsoft's documentation: Agent Framework: host agents with A2A (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.