Skip to content

Index

diapason.a2a

Agent-to-Agent protocol — Google A2A spec implementation.

A2AAgentTool

Bases: BaseTool

Wraps an external A2A agent as a BaseTool.

Follows the MCPToolAdapter pattern for external tool integration.

A2AClient

Client for calling external A2A-compatible agents.

Discovers agent capabilities via /.well-known/agent.json and sends tasks via /a2a/tasks.

cancel_task(task_id)

Cancel a running task.

discover()

Fetch the agent card from /.well-known/agent.json.

get_task(task_id)

Get the status of a previously submitted task.

send_task(input_text, **kwargs)

Send a task to the remote agent and return the result.

A2ARequest dataclass

JSON-RPC 2.0 request for A2A.

A2AResponse dataclass

JSON-RPC 2.0 response for A2A.

A2AServer

A2A server that processes incoming tasks via agent execution.

Can be mounted as routes in the FastAPI server.

When auth_token is set, every :meth:handle_request call must present a matching bearer token or it is rejected before any agent runs. The token is advertised on the agent card's authentication field. When unset, the server is unauthenticated — only mount it on a trusted network.

authenticate(token)

Constant-time check of a presented bearer token.

Returns True when no auth_token is configured (auth disabled).

get_routes()

Return route definitions for mounting in a web framework.

handle_request(request_data, *, token=None)

Process a JSON-RPC 2.0 A2A request.

token is the bearer credential extracted by the transport (e.g. the HTTP Authorization header). It is validated before dispatch when the server is configured with an auth_token.

A2ATask dataclass

An A2A task with state machine.

AgentCard dataclass

Agent discovery card served at /.well-known/agent.json.