Parse $ARGUMENTS into:
URL_OR_ALIAS: first non-flag tokenMESSAGE: all remaining non-flag tokens joined as the message stringBACKGROUND: true if--backgroundpresent, false otherwiseSTREAM: true if--streampresentTIMEOUT: value after--timeoutif present (e.g.60s,2m)TASK_ID: value after--taskif presentCONTEXT_ID: value after--contextif present
Process
Check prerequisites: Verify that
a2ais installed before proceeding:if ! command -v a2a &>/dev/null; then echo "Error: 'a2a' CLI not found. Install with:" echo " go install github.com/a2aproject/a2a-go/v2/cmd/a2a@latest" exit 1 fiResolve alias, auth, and timeout: Resolve the URL, auth params, and timeout from settings:
URL=$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/a2a-helper.py" resolve "$URL_OR_ALIAS") AUTH_ARGS=() while IFS= read -r line; do AUTH_ARGS+=("$line") done < <(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/a2a-helper.py" auth "$URL") SETTINGS_TIMEOUT=$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/a2a-helper.py" timeout "$URL") TIMEOUT_VAL="${TIMEOUT:-${SETTINGS_TIMEOUT:-120s}}"Report effective timeout: Inform the user of the effective timeout before sending:
Timeout:
<TIMEOUT_VAL>(from:--timeoutflag / settings / default 120s)Build flags array:
- If
BACKGROUND: add--immediate - If
STREAM: add--stream - If
TIMEOUT_VALnon-empty: add--timeout "$TIMEOUT_VAL" - If
TASK_ID: add--task "$TASK_ID" - If
CONTEXT_ID: add--context "$CONTEXT_ID"
- If
Send the message:
a2a send "$URL" "$MESSAGE" "${FLAGS[@]}" "${AUTH_ARGS[@]}"Track the task: Extract the task ID from the output (look for
id:or"id":field). Always track the task:python3 "${CLAUDE_PLUGIN_ROOT}/scripts/a2a-helper.py" session add "$TASK_ID" "$URL" \ --alias "$URL_OR_ALIAS" --message "$MESSAGE"Handle output: Render the result based on mode (see
### Outputbelow) and handle failures orinput-requiredstatus.
Output
- Blocking (default): show the full response including artifacts. Parse and render text parts directly.
- Background: show the task ID and status. Inform the user they can check progress with the status skill.
- Streaming: relay output as it arrives.
If the task fails with a timeout error, suggest retrying with a longer value (e.g. --timeout 300s) or increasing timeout: in .claude/a2a.local.md.
If the task status is input-required, prompt the user for the required input and offer to continue
the task by running send again with --task <task-id>.
Example Usage
# Send a message (blocking — waits for response)
/a2a-send https://demo.a2a-protocol.org "Summarize the latest news about AI"
# Send in background — returns task ID immediately
/a2a-send my-agent --background "Run a long analysis job"
# Continue an existing task by passing --task <task-id>
/a2a-send my-agent --task task_abc123 "Here is the additional context you asked for"