This directory contains runnable examples demonstrating how to build and interact with an A2A-compliant agent using the Python SDK.
| File | Role | Description |
|---|---|---|
hello_world_agent.py |
Server | A2A agent server |
cli.py |
Client | Interactive terminal client |
agent_card_signing.py |
Server + Client | Signing and verifying an Agent Card |
http://127.0.0.1:41241, which is the default URL used by the client.hello_world_agent.py — Agent ServerImplements an A2A agent that responds to simple greeting messages (e.g., “hello”, “how are you”, “bye”) with text replies, simulating a 1-second processing delay.
Demonstrates:
AgentExecutor and implementing execute() / cancel()TaskUpdaterhttp://127.0.0.1:41241/a2a/jsonrpchttp://127.0.0.1:41241/a2a/rest5005150052http://127.0.0.1:41241/.well-known/agent-card.jsonRun:
uv run python samples/hello_world_agent.py
cli.py — ClientAn interactive terminal client with full visibility into the streaming event flow. Each TaskStatusUpdate and TaskArtifactUpdate event is printed as it arrives.
Features:
--transport flag (JSONRPC, HTTP+JSON, GRPC)context_id persisted across messages, task_id per task)Run:
# Connect to the local hello_world_agent (default):
uv run python samples/cli.py
# Connect to a different URL, using gRPC:
uv run python samples/cli.py --url http://192.168.1.10:41241 --transport GRPC
Then type a message like hello and press Enter.
Type /quit or /exit to stop, or press Ctrl+C.
agent_card_signing.py — Agent Card SigningAn Agent Card is fetched before any trust has been established with the agent, so everything in it — transport URLs, security schemes, skills — is attacker-controlled until it is verified. This sample signs a card on the server and verifies it on the client.
Demonstrates:
create_agent_card_signer, wired into the card endpoint through create_agent_card_routes(card_modifier=...)/.well-known/jwks.json, referenced by the signature’s jku headercreate_signature_verifier, passed to A2ACardResolver.get_agent_card(signature_verifier=...) (the same argument is accepted by ClientFactory.create_from_url)The default demo mode starts the server, verifies its card, and then shows the three failures a verifier exists to catch: a card whose transport URL was rewritten in transit, a card with its signature stripped, and a genuine card whose jku the client does not trust.
Run:
# Server and client together (default):
uv run python samples/agent_card_signing.py
# Or run the two halves separately:
uv run python samples/agent_card_signing.py serve
uv run python samples/agent_card_signing.py verify --url http://127.0.0.1:41242
Requires the signing, encryption and fastapi extras (pip install 'a2a-sdk[signing,encryption,fastapi]'); they are already present when working from a uv sync of this repo.