Skip to content

Run an example agent

Terminal window
git clone https://github.com/parivox/parivox-a2a-examples.git
cd parivox-a2a-examples/agents/research-specialist-sdk
python -m venv .venv && .venv/bin/pip install -r requirements.txt
A2A_ALLOW_ANONYMOUS=1 .venv/bin/python -m app.main

Then fetch the card:

Terminal window
curl localhost:8080/.well-known/agent-card.json

Or run it in a container, from the repository root:

Terminal window
docker compose up research-specialist-sdk

Without an OPENAI_API_KEY the agent serves deterministic canned content and still exercises the full protocol.

Every agent is configured entirely through environment variables. See each agent’s .env.example.

Variable Meaning
A2A_API_KEY Shared secret required in the X-API-Key header on RPC calls
A2A_ALLOW_ANONYMOUS Set to 1 to run without an API key (local development and CI only)
PORT Listen port, default 8080

An agent refuses to start unless one of A2A_API_KEY or A2A_ALLOW_ANONYMOUS is set, so an unauthenticated deployment has to be a deliberate act rather than an omission.

Verified against a2a-sdk 1.1.2. These bite immediately if you’re used to 0.3:

  • A2A-Version: 1.0 is a required request header. Omit it and the server assumes 0.3 and rejects the call with JSON-RPC error -32009.
  • Method names are gRPC-style, not slash-style: SendMessage, SendStreamingMessage, GetTask, CancelTask, SubscribeToTask, not message/send or message/stream.
  • Event ordering is strict. A task stream must emit the Task first, then any number of statusUpdate / artifactUpdate events, and end on a terminal status. A status update before the Task fails with -32006.
  • The Agent Card lives at /.well-known/agent-card.json and advertises its RPC endpoint under supportedInterfaces, each with a url, protocolBinding and protocolVersion.

A streamed task looks like this on the wire (SSE data: frames, JSON-RPC envelopes):

data: {"result":{"task":{"id":"…","status":{"state":"TASK_STATE_SUBMITTED"}}},…}
data: {"result":{"statusUpdate":{"status":{"state":"TASK_STATE_WORKING",…}}},…}
data: {"result":{"artifactUpdate":{"artifact":{"name":"report.md","parts":[…]}}},…}
data: {"result":{"statusUpdate":{"status":{"state":"TASK_STATE_COMPLETED"}}},…}

CI in the examples repository runs the official a2a-tck against each agent started as a local container:

Terminal window
./run_tck.py --sut-host http://localhost:8080 --transport jsonrpc --level must

It enforces the protocol-level subset of the must tests (card discovery, task lifecycle, streaming order, error-code mapping and cancellation) and deliberately deselects the TCK’s scenario-fixture tests, which check for behavior specific to the TCK’s own reference agent. The reasoning is recorded in the repository’s ci.yml.