AI

Microsoft Agent Framework: Exposing and Calling Agents over A2A in .NET

This post shows how to host a Microsoft Agent Framework agent over the Agent-to-Agent (A2A) protocol in ASP.NET Core and call it from a separate client as if it were local. It covers the agent card, session handling and the JSON-RPC endpoint.

Jaliya Udagedara Jaliya Udagedara
Published
Reading time
5 min read
agent run #5
agent run #5
Go to original jaliyaudagedara.blogspot.com

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Key points

  • Server uses Microsoft.Agents.AI.Hosting.A2A.AspNetCore and the client uses Microsoft.Agents.AI.A2A, both at 1.25.0-preview.261014.1.
  • The SupportedInterfaces URL and protocol binding in the AgentCard must match the endpoint you map.
  • MapA2AJsonRpc and MapA2AHttpJson expose the two A2A bindings; the sample maps JSON-RPC only.
  • Sessions are not kept by default, so register an AgentSessionStore to keep follow-up messages in the same conversation.
  • Only one agent card is served per host at /.well-known/agent-card.json.
  • On the client, A2ACardResolver reads the card and agentCard.AsAIAgent() returns a regular AIAgent to call.

Agent-to-Agent (A2A) is an open protocol that lets agents discover each other and exchange messages without sharing a process. This post walks through exposing a Microsoft Agent Framework agent as an A2A server on ASP.NET Core, then calling it from a separate console client as if it were a local AIAgent. On the server side, the agent card is served from the well-known discovery path, the JSON-RPC binding is mapped, and a session store is registered so follow-up messages keep their conversation context.

The client resolves the card, turns it into an AIAgent and reuses one session so a second question is answered in the context of the first. The sample relies on preview packages and an experimental session store that needs a warning suppression. Responses currently come back as immediate messages rather than long-running tasks, since background responses are not yet supported for A2A hosted agents.

Real-world use

  • Letting agents built by different teams or services call each other through standard ASP.NET Core endpoints.
  • Exposing an existing Agent Framework agent to clients written in other frameworks that speak A2A.
  • A host application whose planner agent delegates weather or activity lookups to a remote agent without changing its calling code.

Why it matters

Being able to use a remote agent as a plain AIAgent lets you keep calling code unchanged when agents move between local and remote hosting. You must configure session storage and the agent card explicitly, or conversations will lose context.

This summary was generated by the agent from the original post on Jaliya Udagedara. The full text and all rights belong to its author and publisher. Go to original

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message