rpk ai agent a2a send
Send a text message to an agent over A2A and print the reply.
The message comes from the positional argument, or from stdin when the argument is omitted or "-" (so you can pipe a prompt in).
By default the call blocks until the agent replies. Replies that spawn a
long-running task print the task id so you can follow up with
rpk ai agent a2a task get|watch|cancel. For work that may outlive
--timeout (default 5m), prefer --stream or --no-block so the task id is
in hand from the start.
Conversation state: every reply prints a context-id (stderr in the default format, part of the JSON in -o json). Pass it back via --context-id to continue the same conversation. When a task ends in state input-required, answer it by sending again with both --task-id and --context-id from the reply.
Output: the agent’s reply text goes to stdout; ids and state go to
stderr as key: value lines so pipes stay clean. Use -o json for the
full A2A response (message or task object). With --stream, json and
yaml both emit one JSON event per line (JSONL).
Exit codes: 0 success or input-required, 4 task failed/canceled/ rejected, 1 anything else.
Examples
# Ask and wait for the answer
rpk ai agent a2a send financial-advisor "What moved the S&P 500 today?"
# Continue the conversation from a previous reply's context-id
rpk ai agent a2a send financial-advisor --context-id CTX "Why?"
# Answer a task that ended in input-required
rpk ai agent a2a send financial-advisor --task-id TASK --context-id CTX "Account A-17"
# Pipe the prompt from a file, get the full JSON reply
cat prompt.txt | rpk ai agent a2a send financial-advisor -o json
# Stream events as they happen
rpk ai agent a2a send financial-advisor --stream "Give me a market summary"
# Fire-and-forget: submit, then poll with `task get`
rpk ai agent a2a send financial-advisor --no-block "Deep analysis please"
Flags
| Value | Type | Description |
|---|---|---|
|
string |
continue an existing conversation (printed by a previous send). |
|
- |
help for send. |
|
- |
return immediately with the submitted task instead of waiting for completion. |
|
- |
stream the reply as A2A events (message/stream) instead of waiting for the final result. |
|
string |
continue an existing task (e.g. answer an input-required task). |
|
duration |
abort the call after this long (0 to wait forever) (default 5m0s). |
|
string |
output format: table|wide|json|yaml|markdown (env: RPAI_FORMAT) (default "table"). |
|
- |
disable colored output (env: NO_COLOR). |
|
string |
path to rpai config (env: RPAI_CONFIG) (default "/var/lib/redpanda/.rpai/config"). |
|
string |
override the selected environment’s AI Gateway URL for this invocation. |
|
string |
rpai profile name (env: RPAI_PROFILE). |
|
- |
verbose debug logging to stderr (env: RPAI_VERBOSE). |
|
string |
static bearer token override (ambient RPAI_TOKEN is ignored under rpk ai). |