Use the CLI for A2A workflows
Message responses and errors default to readable text for interactive use. Pass--output json for full protocol responses, or --output ndjson before
streaming commands when you need structured event output for automation or
agent-driven workflows. Commands without a custom text formatter may still emit
JSON in the default mode.
Warnings print to stderr by default, so you see when an agent requires an
extension you did not request or when its card routes requests somewhere
unexpected. Add -v for informational logs or -d for debug logs.
Inspect an agent card first
Fetch the card for a configured server:extendedAgentCard:
Send a message
Send a basic message to a configured server:Send files and structured data
Messages are not limited to text. Attach files with--file and structured
data with --data; both options are repeatable and work on message send and
message stream.
A local path is read and sent inline as a file part, with the media type
sniffed from the file:
http(s) URL is sent by reference, so the agent fetches it:
--text is optional when at least one part is attached.
When an agent replies with non-text parts, the text output summarizes them
rather than dumping bytes into the terminal. A file part renders as
[file: pixel.png, image/png, inline bytes, 70 bytes] (or with its URI when
sent by reference), and a data part renders as a fenced JSON block. Whole
numbers in data parts render as integers even though the protocol carries
every number as a double. Use --output json to get the full parts, including
inline bytes as base64.
Save what the agent sends back
Received file and data parts are summarised on screen; to get them onto disk, pass--save-artifacts DIR to message send, message stream, or
task get:
<task-id>-<n>.json. Names are kept to
their final component and never overwrite an existing file (report-2.pdf).
Text parts are not saved; they are already on screen. In --output json
mode the saved paths go to stderr so stdout stays a single JSON document.
Shape the request
The CLI exposes theSendMessageConfiguration fields the protocol attaches to
a message.
Tell the agent which media types you can render:
task get or attach with task resubscribe:
--no-wait and --stream are mutually exclusive.
Request A2A extensions
Agents can declare extensions on their card. Ask for one on a single call with-e/--extension (repeatable):
A2A-Extensions header on every request. To
request an extension on every call to a server, list it in the server’s
configuration instead; see Servers. If an agent marks an
extension as required and you did not request it, Handler warns, since the
agent may refuse or degrade the request.
Stream the response
Stream task events and response text from a configured server:event: summaries for task state
changes, tool calls, tool results, data/file parts, and response text before the
final answer content. That makes it clear when the agent is still working even
if the model’s text arrives in one larger chunk. Handler also prints the full
task ID once when the stream starts so you can resubscribe if the server
connection is interrupted.
If you already use message send in scripts, adding --stream switches that
same command to streaming mode. Otherwise, prefer the more explicit
message stream command in examples and documentation.
Use newline-delimited JSON when you want structured stream events:
grpc extra
(uv tool install 'a2a-handler[grpc]'). The card’s preference order decides.
When the agent offers no binding this install speaks, the error names what the
agent offers and what Handler can do about it.
If you need to tune networking behavior, Handler exposes global timeout flags
and matching environment variables. Values are seconds, or none to disable a
specific timeout:
HANDLER_CONNECT_TIMEOUT,
HANDLER_READ_TIMEOUT, HANDLER_WRITE_TIMEOUT, HANDLER_POOL_TIMEOUT, and
HANDLER_STREAM_READ_TIMEOUT, including from a workspace .env file. Streaming
disables the read timeout by default so long-running tasks are not aborted during
idle gaps between SSE events.
Continue a saved conversation
Handler persists conversation identifiers locally so you can continue later:input-required: the
saved task is still open, so --continue sends your reply on it.
Inspect the saved session for a configured server:
Send custom payloads or headers
For agent-friendly invocation and integration testing, Handler exposes raw JSON input, structured output, and repeatable header flags:--bearer-env or --api-key-env.
Custom headers and credentials are only sent to the origin of the agent URL
you configured; see Authentication.
List an agent’s tasks
List every task the agent holds, following pagination to the end:submitted, working, completed, failed, canceled,
input_required, rejected, and auth_required; hyphens are accepted too.
Tune what each page carries. All pages are always fetched, so --page-size
only changes the number of round trips; the protocol caps it at 100:
--output json carries a
truncated field, and --output ndjson emits a final truncated record.
Work with tasks directly
Fetch the latest task status:resubscribe is useful when a task uses streaming events and you need to attach
again after a dropped server connection, or to follow a task you started with
--no-wait.
Configure push notifications for tasks
Point a task at a webhook receiver:--config-id. List them,
with tokens redacted:
Manage saved sessions
Handler stores session metadata locally so repeated CLI calls can reuse conversation state. List all saved sessions:session clear when you want a clean slate without deleting the server
definition itself.