Files
microsoft--agent-framework/python/packages/a2a/AGENTS.md
T
wehub-resource-sync db620d33df
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:39:25 +08:00

1.7 KiB

A2A Package (agent-framework-a2a)

Agent-to-Agent (A2A) protocol support for inter-agent communication.

Main Classes

  • A2AAgent - Client to connect to remote A2A-compliant agents.
  • A2AExecutor - Bridge to expose Agent Framework agents via the A2A protocol.
  • A2AServiceSessionId - Typed durable A2A continuation state shape stored in AgentSession.service_session_id.
  • A2AAgentSession - Deprecated compatibility session wrapper; prefer AgentSession + A2AServiceSessionId.

Usage

A2AAgent (Client)

from agent_framework.a2a import A2AAgent

# Connect to a remote A2A agent
a2a_agent = A2AAgent(url="http://remote-agent/a2a")
response = await a2a_agent.run("Hello!")

A2AExecutor (Server/Bridge)

from agent_framework.a2a import A2AExecutor
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.routes import create_agent_card_routes, create_jsonrpc_routes
from a2a.server.tasks import InMemoryTaskStore
from starlette.applications import Starlette

# Create an A2A executor for your agent
executor = A2AExecutor(agent=my_agent)

# Set up the request handler (agent_card is required)
request_handler = DefaultRequestHandler(
    agent_executor=executor,
    task_store=InMemoryTaskStore(),
    agent_card=my_agent_card,
)

# Build a Starlette app with A2A routes
app = Starlette(
    routes=[
        *create_agent_card_routes(my_agent_card),
        *create_jsonrpc_routes(request_handler, "/"),
    ]
)

Import Path

from agent_framework.a2a import A2AAgent, A2AExecutor, A2AServiceSessionId
# or directly:
from agent_framework_a2a import A2AAgent, A2AExecutor, A2AServiceSessionId