Skip to content

Commit 7ef636b

Browse files
committed
docs(cli): add full CLI reference and a2acli-skill
Replace the stub a2acli/README.md with a complete command reference covering all subcommands, global options, config file, auth, output formats, and transport negotiation. Document the AGENT_REF resolution rules (base URL, direct .json URL, local file path) throughout. Add a2acli-skill/SKILL.md as a concise skill reference for AI-assisted CLI use. Update the root README's CLI section to use current command names and link to the full reference. Signed-off-by: Sam Betts <1769706+Tehsmash@users.noreply.github.com>
1 parent cfdb42b commit 7ef636b

3 files changed

Lines changed: 423 additions & 33 deletions

File tree

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,31 @@ HTTP+JSON, prints responses as JSON, and manages task push notification
142142
configs.
143143

144144
```sh
145-
cargo run --bin a2acli -- card
146-
cargo run --bin a2acli -- send "hello from rust"
147-
cargo run --bin a2acli -- stream "hello from rust"
148-
cargo run --bin a2acli -- list-tasks
149-
cargo run --bin a2acli -- push-config list task-123
145+
# Inspect an agent card
146+
a2a discover http://localhost:3000
147+
148+
# Send a one-shot message
149+
a2a send http://localhost:3000 "hello from rust"
150+
151+
# Send a streaming message
152+
a2a stream http://localhost:3000 "hello from rust"
153+
154+
# List tasks
155+
a2a task list http://localhost:3000
156+
157+
# Manage push notification configs
158+
a2a push-config list http://localhost:3000 task-123
150159
```
151160

152-
By default the CLI targets `http://localhost:3000`, which matches the bundled
153-
hello world server. Override the target with `--base-url https://host` for any
154-
compatible A2A server, use `--binding jsonrpc` or `--binding http-json` to pin
161+
Each command takes an agent reference as its first argument: a base URL
162+
(`http://host` → card fetched from `/.well-known/agent-card.json`), a direct
163+
URL to a card JSON file (`https://host/path/agent.json`), or a local file path.
164+
Use `--enabled-binding jsonrpc` or `--enabled-binding http-json` to pin
155165
transport selection, and pass `--bearer-token` or repeated `--header Name:Value`
156166
arguments when the server requires authentication.
157167

168+
See [`a2acli/README.md`](a2acli/README.md) for the full command reference.
169+
158170
## Depending On The Workspace
159171

160172
The crates are published on crates.io. To depend on the latest development version directly from Git:

a2acli-skill/SKILL.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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

Comments
 (0)