Skip to content

server

diapason.a2a.server

A2A server — exposes agents via /.well-known/agent.json and /a2a/tasks.

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.