Skip to main content

Deployment architecture


Prerequisites

Before starting the gateway, generate a persistent ECDSA P-256 signing key and expose it as QWED_A2A_SIGNING_KEY_PEM. Attestation JWTs are signed with this key; without it the gateway fails closed (HTTP 503) on every request.
Every replica in the same logical deployment must load the same PEM. Different keys across replicas would produce different kids, and attestations issued by one instance would fail verification on another. Store the PEM in your secrets manager and inject it at runtime.

FastAPI application

Create your production entrypoint:

Docker

Build and run:

Available endpoints

Gateway authentication

POST /a2a/intercept requires a per-agent API key in the X-API-Key header. Keys are configured through QWED_A2A_API_KEYS, a JSON object mapping each API key to the agent ID it authenticates:
The authentication is fail-closed:
  • A missing or unknown X-API-Key returns 401 Invalid or missing API key.
  • If QWED_A2A_API_KEYS is unset, malformed, or contains no usable entries, every request returns 401 API authentication is not configured for this service. A deployment without configured keys denies all traffic.
  • Agent IDs in the map are normalized to the AgentMessage contract (trimmed, max 256 characters, no control characters). Entries that violate it are dropped and their keys denied.
The key’s agent ID is the identity the gateway trusts. Trust-boundary evaluation, rate limiting, telemetry, and the attestation JWT all bind to the authenticated agent. If the body’s sender_agent_id names a different agent, the gateway logs a warning and overrides it with the authenticated identity. Key rotation. The gateway reads QWED_A2A_API_KEYS fresh on every request, so rotating keys takes effect without a restart. Update the environment variable (for example through your secrets manager) and old keys stop matching immediately.

Health check response

Metrics response

JWKS endpoint

GET /.well-known/jwks.json returns the current signing public key so downstream services can verify attestation JWTs without an out-of-band key exchange.
The kid is derived from a SHA-256 fingerprint of the public key, so it remains stable across restarts as long as QWED_A2A_SIGNING_KEY_PEM is unchanged. When the PEM is missing or invalid, the endpoint responds with HTTP 503 Signing key unavailable — use this as a readiness signal for orchestrators and load balancers. See Crypto attestations for the full JWT structure and verification flow.

Environment variables


Monitoring

Sentry integration

QWED A2A includes built-in Sentry integration for error tracking:

Structured logging

All intercepts are logged with structured fields:

CI/CD integration

GitHub Actions

Mergify auto-merge


Integration with QWED ecosystem

QWED Core

A2A uses the same verification principles as the core QWED engine — deterministic, symbolic, and provable.

QWED MCP

MCP provides tool-level verification. A2A provides agent-to-agent communication verification. They complement each other.

QWED Finance

The A2A finance guard uses the same Decimal arithmetic patterns as QWED Finance, adapted for inter-agent payloads.

Agent Specification

The QWED-Agent spec defines trust levels and budget enforcement. A2A implements the verification gateway described in the spec.