A2A CLI Proposal #306
yarolegovich
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
A2A CLI Proposal
A command-line interface for the Agent-to-Agent protocol. Link netcat for agents.
re a2aproject/A2A#1325
Command Grammar
The agent URL is always the first positional argument. Flags can appear in any position after the verb. Verbs that operate on a single resource type drop the noun (
sendalways sends a message,cancelalways cancels a task). Verbs that span multiple resource types require it (get task,list tasks).Global Flags
These apply to every client-mode command.
--output <fmt>-otext(default),json.--transport <name>rest,jsonrpc,grpc. Default: auto-detect from card.--svc-param <k=v>=.--auth <creds>--svc-param "Authorization=<creds>".--tenant <id>--timeout <dur>30s.--verbose-vClient Commands
discover- Agent Card DiscoveryFetch and display an agent card from its well-known URL.
To fetch the extended card (if supported):
discoveris a convenience alias forget card <url>.send- Send a MessageSend a message to an agent and print the response.
--streamSendStreamingMessage. Events are printed incrementally.--immediateReturnImmediatelyinSendMessageConfig.--json <body>Messageobject.--parts <json>partsarray. AMessageis constructed withROLE_USERand the given parts.-f <file>--task <id>TaskIDon the message to continue an existing task.--context <id>ContextIDon the message.--history <n>nhistory messages in the response.get task- Get Task Details--history <n>nhistory messages.--with-artifactslist tasks- List Tasks--context <id>--status <state>submitted,working,completed,failed,canceled,rejected,input-required,auth-required.--limit <n>--page-token <t>--history <n>nhistory messages per task.--since <time>--with-artifactscancel- Cancel a TaskPrints the updated task status.
subscribe- Subscribe to Task EventsStreams events to stdout until the task reaches a terminal state. Output format matches
send --stream.Server Mode
a2a servestarts an A2A-compliant server backed by one of three modes.Common Server Flags
--port <n>8080.--host <addr>127.0.0.1.--name <name>--description <desc>--transport <proto>rest(default),jsonrpc,grpc.--card <file>--quiet--echo- Echo Modea2a serve --echo a2a serve --echo --port 9090 --name "Echo Agent"Returns the user's message text back as an agent response. The "ping" for agents - useful for connectivity testing and client development.
--proxy- Proxy ModeForward all requests to an upstream A2A agent. Logs traffic to stderr. Useful for debugging agent interactions, injecting service parameters, or acting as an authenticated gateway.
The proxy creates an
a2aclient.Clientfor the upstream agent and forwards each A2A operation. Service parameters specified via--svc-paramare injected into every forwarded request usinga2aclient.AttachServiceParams. The proxy's own agent card is derived from the upstream card with the local interface address substituted.--exec- Exec ModeRun any command as an A2A agent. Message text goes to stdin, stdout becomes the response artifact. The subprocess does not need to know anything about A2A.
Subprocess Interface
stdin: The first text part of the incoming A2A message.
stdout: Response content. Interpretation depends on whether
--chunkis set (see below).stderr: Logged by the CLI at debug level. On non-zero exit, stderr content is included in the failure status message.
Exit code:
0→TaskStateCompletedTaskStateFailedOutput Modes
Default (no
--chunk): The entire stdout is collected and emitted as a single text artifact when the process exits.With
--chunk=<delimiter>: stdout is read incrementally and split by the delimiter. Each piece is streamed as an artifact chunk event (Append: true) as soon as it's available. This enables streaming without requiring the subprocess to know about A2A's event model.The event sequence with
--chunk:Output Formatting
All commands support
-o jsonfor machine-readable output and emits raw protocol objects.Text mode is the default and is designed for human consumption in a terminal.
All reactions