|
| 1 | +# a2acli skill |
| 2 | + |
| 3 | +Use this skill to interact with A2A-compatible agents from the command line using the `a2a` binary. |
| 4 | + |
| 5 | +## When to use |
| 6 | + |
| 7 | +- Inspect an agent's capabilities by fetching its agent card |
| 8 | +- Send one-shot or streaming messages to an A2A agent |
| 9 | +- Retrieve, list, cancel, or subscribe to tasks on an agent |
| 10 | +- Manage push notification configs for tasks |
| 11 | +- Diagnose A2A agent deployments or script A2A workflows in a shell |
| 12 | + |
| 13 | +## Install |
| 14 | + |
| 15 | +```sh |
| 16 | +# macOS |
| 17 | +brew tap a2aproject/a2a-rs https://github.com/a2aproject/a2a-rs |
| 18 | +brew trust a2aproject/a2a-rs |
| 19 | +brew install a2acli |
| 20 | + |
| 21 | +# Linux |
| 22 | +curl -fsSL https://raw.githubusercontent.com/a2aproject/a2a-rs/main/install.sh | bash |
| 23 | + |
| 24 | +# From source |
| 25 | +cargo install a2a-cli |
| 26 | +``` |
| 27 | + |
| 28 | +## Usage patterns |
| 29 | + |
| 30 | +### Agent reference (`AGENT_REF`) |
| 31 | + |
| 32 | +Every command takes an `AGENT_REF` as its first positional argument: |
| 33 | + |
| 34 | +| Value | Behaviour | |
| 35 | +| --- | --- | |
| 36 | +| `http://host` or `https://host` | Card is fetched from `<URL>/.well-known/agent-card.json`. | |
| 37 | +| Any `http`/`https` URL ending in `.json` | Used as-is — a direct link to the agent card JSON. | |
| 38 | +| Any other value | Treated as a local filesystem path and read directly. | |
| 39 | + |
| 40 | +```sh |
| 41 | +a2a discover http://localhost:3000 # base URL |
| 42 | +a2a discover https://example.com/agents/my-agent.json # direct card URL |
| 43 | +a2a discover ./agent-card.json # local file |
| 44 | +``` |
| 45 | + |
| 46 | +### Discover an agent |
| 47 | + |
| 48 | +```sh |
| 49 | +a2a discover <AGENT_REF> |
| 50 | +a2a discover <AGENT_REF> --extended |
| 51 | +``` |
| 52 | + |
| 53 | +### Send a message |
| 54 | + |
| 55 | +```sh |
| 56 | +# One-shot — prints the completed task |
| 57 | +a2a send <AGENT_REF> "<message>" |
| 58 | + |
| 59 | +# With context and task identity |
| 60 | +a2a send <AGENT_REF> "<message>" --context-id <ctx> --task-id <task> |
| 61 | + |
| 62 | +# Streaming — prints events as they arrive |
| 63 | +a2a stream <AGENT_REF> "<message>" |
| 64 | +``` |
| 65 | + |
| 66 | +### Manage tasks |
| 67 | + |
| 68 | +```sh |
| 69 | +a2a task get <AGENT_REF> <TASK_ID> |
| 70 | +a2a task list <AGENT_REF> [--status completed] [--context-id <ctx>] |
| 71 | +a2a task cancel <AGENT_REF> <TASK_ID> |
| 72 | +a2a task subscribe <AGENT_REF> <TASK_ID> # stream live events |
| 73 | +``` |
| 74 | + |
| 75 | +### Push notification configs |
| 76 | + |
| 77 | +```sh |
| 78 | +a2a push-config create <AGENT_REF> <TASK_ID> <CALLBACK_URL> \ |
| 79 | + --auth-scheme Bearer --auth-credentials <secret> |
| 80 | + |
| 81 | +a2a push-config list <AGENT_REF> <TASK_ID> |
| 82 | +a2a push-config get <AGENT_REF> <TASK_ID> <CONFIG_ID> |
| 83 | +a2a push-config delete <AGENT_REF> <TASK_ID> <CONFIG_ID> |
| 84 | +``` |
| 85 | + |
| 86 | +## Global flags |
| 87 | + |
| 88 | +| Flag | Env var | Description | |
| 89 | +| --- | --- | --- | |
| 90 | +| `--enabled-binding jsonrpc\|http-json` | | Pin the transport binding. Repeatable. Auto-negotiated if omitted. | |
| 91 | +| `--bearer-token <TOKEN>` | `A2A_BEARER_TOKEN` | Bearer token sent with every request. | |
| 92 | +| `--header <Name:Value>` | | Custom HTTP header. Repeatable. | |
| 93 | +| `-o pretty\|json` | | Output format. `pretty` = indented JSON (default). `json` = compact, one object per line. | |
| 94 | + |
| 95 | +## Config file |
| 96 | + |
| 97 | +Create `.a2a.yaml` in any ancestor directory (up to `$HOME`) to set defaults: |
| 98 | + |
| 99 | +```yaml |
| 100 | +enabled_bindings: |
| 101 | + - http-json |
| 102 | +bearer_token: my-token |
| 103 | +headers: |
| 104 | + - "X-Tenant: acme" |
| 105 | +output: json |
| 106 | +``` |
| 107 | +
|
| 108 | +CLI flags always win over config file values. Headers are additive. |
| 109 | +
|
| 110 | +## Pipe-friendly output |
| 111 | +
|
| 112 | +Use `-o json` with `jq` for scripting: |
| 113 | + |
| 114 | +```sh |
| 115 | +# Get the agent name |
| 116 | +a2a -o json discover http://localhost:3000 | jq -r '.name' |
| 117 | +
|
| 118 | +# Watch task state from a stream |
| 119 | +a2a -o json stream http://localhost:3000 "hello" | jq -r '.statusUpdate.status.state // empty' |
| 120 | +
|
| 121 | +# List completed task IDs |
| 122 | +a2a -o json task list http://localhost:3000 --status completed | jq -r '.tasks[].id' |
| 123 | +``` |
| 124 | + |
| 125 | +## Reference |
| 126 | + |
| 127 | +Full documentation: [`a2acli/README.md`](../a2acli/README.md) |
0 commit comments