Skip to content

Commit f98ddcb

Browse files
committed
docs: refresh CLI and conformance references
1 parent 798c4fc commit f98ddcb

28 files changed

Lines changed: 101 additions & 121 deletions

docs/architecture.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,19 @@ Clients can pin to a specific agent version:
142142

143143
```python
144144
handle = await client.submit(
145-
agent="summarise",
145+
agent="summarise@2",
146146
input={"url": "https://example.com"},
147-
agent_version="2",
148147
)
149148
```
150149

151150
Runtimes register versioned agents:
152151

153152
```python
154-
runtime.register_agent("summarise", summarise_v1, version="1")
155-
runtime.register_agent("summarise", summarise_v2, version="2")
153+
runtime.register_agent_version("summarise", "1", summarise_v1)
154+
runtime.register_agent_version("summarise", "2", summarise_v2)
156155
```
157156

158-
If the client omits `agent_version`, the runtime uses the latest registered version.
157+
If the client omits the version suffix, the runtime uses the latest registered version.
159158

160159
## Middleware
161160

docs/cli.md

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,47 @@ pip install arcp
1313

1414
### `arcp serve`
1515

16-
Start an ARCP runtime serving agents from a Python module.
16+
Run the built-in demo runtime.
1717

1818
```bash
19-
arcp serve my_module:runtime --host 0.0.0.0 --port 8080
19+
arcp serve --token demo-token --principal cli-user
2020
```
2121

2222
**Arguments:**
2323

2424
| Argument | Default | Description |
2525
|---|---|---|
26-
| `MODULE:ATTR` | required | Python import path to an `ARCPRuntime` instance |
2726
| `--host` | `127.0.0.1` | Bind address |
28-
| `--port` | `8080` | Bind port |
29-
| `--reload` | off | Auto-reload on file changes (dev only) |
27+
| `--port` | `7777` | Bind port |
28+
| `--token` | required | Demo bearer token to accept |
29+
| `--principal` | `cli-user` | Principal bound to the accepted token |
30+
| `--db` | off | Optional SQLite event log path |
3031

3132
### `arcp submit`
3233

3334
Submit a job to a running runtime and print the result.
3435

3536
```bash
36-
arcp submit ws://localhost:8080/arcp summarise '{"url":"https://example.com"}' \
37-
--token my-bearer-token
37+
arcp submit --url ws://localhost:7777/arcp --agent echo \
38+
--input '{"url":"https://example.com"}' --token my-bearer-token
3839
```
3940

4041
**Arguments:**
4142

4243
| Argument | Description |
4344
|---|---|
44-
| `URL` | WebSocket URL of the runtime |
45-
| `AGENT` | Agent name |
46-
| `INPUT` | JSON-encoded input (use `@file.json` to read from file) |
45+
| `--url` | WebSocket URL of the runtime |
46+
| `--agent` | Agent name |
47+
| `--input` | JSON-encoded input |
4748
| `--token` | Bearer token |
48-
| `--lease-max-cost` | Maximum spend in USD (e.g. `0.10`) |
49-
| `--lease-expires-in` | Maximum wall time in seconds |
50-
| `--idempotency-key` | Idempotency key |
51-
| `--stream` | Print result chunks as they arrive |
49+
| `--lease` | Lease JSON object |
5250

5351
### `arcp tail`
5452

5553
Tail the event stream for a job in real time.
5654

5755
```bash
58-
arcp tail ws://localhost:8080/arcp JOB_ID --token my-bearer-token
56+
arcp tail --url ws://localhost:7777/arcp --job-id JOB_ID --token my-bearer-token
5957
```
6058

6159
Prints each `JobEvent` as a JSON line. Press `Ctrl-C` to stop.
@@ -65,30 +63,7 @@ Prints each `JobEvent` as a JSON line. Press `Ctrl-C` to stop.
6563
Replay a recorded event stream from a JSONL file.
6664

6765
```bash
68-
arcp replay events.jsonl
66+
arcp replay --db events.sqlite --session SESSION_ID
6967
```
7068

71-
Useful for debugging: record a live stream with `arcp tail --output events.jsonl`, then replay it offline.
72-
73-
## Environment variables
74-
75-
All CLI options can also be set via environment variables:
76-
77-
| Variable | CLI equivalent |
78-
|---|---|
79-
| `ARCP_TOKEN` | `--token` |
80-
| `ARCP_HOST` | `arcp serve --host` |
81-
| `ARCP_PORT` | `arcp serve --port` |
82-
83-
## Shell completion
84-
85-
```bash
86-
# bash
87-
arcp --install-completion bash
88-
89-
# zsh
90-
arcp --install-completion zsh
91-
92-
# fish
93-
arcp --install-completion fish
94-
```
69+
Useful for debugging: record a live stream from `tail` and replay it from the SQLite event log.

docs/conformance.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,43 @@ This page records which sections of the [ARCP v1.1 specification](https://arcp.d
66

77
| Spec section | Title | Status | Source |
88
|---|---|---|---|
9-
| §4 | Versioning | ✅ Full | `arcp/_version.py` |
10-
| §5 | Transport framing | ✅ Full | `arcp/_transport/` |
11-
| §6 | Sessions | ✅ Full | `arcp/runtime/session.py` |
12-
| §6.1 | Authentication — Bearer | ✅ Full | `arcp/runtime/auth.py` |
13-
| §6.1 | Authentication — custom verifier | ✅ Full | `arcp/runtime/auth.py` |
14-
| §6.2 | Agent versions | ✅ Full | `arcp/runtime/registry.py` |
15-
| §6.3 | Stream resume | ✅ Full | `arcp/runtime/resume.py` |
16-
| §7 | Jobs | ✅ Full | `arcp/runtime/job_runner.py` |
17-
| §7.1 | Idempotency keys | ✅ Full | `arcp/runtime/idempotency.py` |
18-
| §7.2 | Job cancellation | ✅ Full | `arcp/runtime/job_runner.py` |
19-
| §8 | Job events | ✅ Full | `arcp/_envelope.py` |
20-
| §8.1 | `job.queued` | ✅ Full | `arcp/_envelope.py` |
21-
| §8.2 | `job.started` | ✅ Full | `arcp/_envelope.py` |
22-
| §8.3 | `job.log` | ✅ Full | `arcp/runtime/context.py` |
23-
| §8.4 | `job.progress` | ✅ Full | `arcp/runtime/context.py` |
24-
| §8.5 | `job.result_chunk` | ✅ Full | `arcp/runtime/context.py` |
25-
| §8.6 | `job.completed` | ✅ Full | `arcp/runtime/job_runner.py` |
26-
| §8.7 | `job.failed` | ✅ Full | `arcp/runtime/job_runner.py` |
27-
| §8.8 | `job.cancelled` | ✅ Full | `arcp/runtime/job_runner.py` |
28-
| §8.9 | `job.heartbeat` | ✅ Full | `arcp/runtime/heartbeat.py` |
29-
| §9 | Leases | ✅ Full | `arcp/runtime/lease.py` |
30-
| §9.1 | Cost budgets | ✅ Full | `arcp/runtime/lease.py` |
31-
| §9.2 | Time budgets (`expires_in_s`) | ✅ Full | `arcp/runtime/lease.py` |
32-
| §9.3 | `expires_at` (absolute timestamp) | ✅ Full | `arcp/runtime/lease.py` |
33-
| §10 | Delegation | ✅ Full | `arcp/runtime/delegation.py` |
34-
| §11 | Observability | ✅ Full | `arcp/middleware/otel.py` |
35-
| §12 | Errors | ✅ Full | `arcp/_errors.py` |
36-
| §13 | Capability negotiation | ✅ Full | `arcp/runtime/capabilities.py` |
37-
| §14 | List jobs | ✅ Full | `arcp/runtime/job_store.py` |
38-
| §15 | Vendor extensions | ✅ Full | `arcp/_extensions.py` |
9+
| §4 | Versioning | ✅ Full | `src/arcp/_version.py` |
10+
| §5 | Transport framing | ✅ Full | `src/arcp/_transport/` |
11+
| §6 | Sessions | ✅ Full | `src/arcp/_runtime/session.py` |
12+
| §6.1 | Authentication — Bearer | ✅ Full | `src/arcp/_auth/bearer.py` |
13+
| §6.1 | Authentication — custom verifier | ✅ Full | `src/arcp/_auth/jwt.py` |
14+
| §6.2 | Agent versions | ✅ Full | `src/arcp/_runtime/server.py` |
15+
| §6.3 | Stream resume | ✅ Full | `src/arcp/_runtime/session.py` |
16+
| §7 | Jobs | ✅ Full | `src/arcp/_runtime/_handlers.py` |
17+
| §7.1 | Idempotency keys | ✅ Full | `src/arcp/_store/idempotency.py` |
18+
| §7.2 | Job cancellation | ✅ Full | `src/arcp/_runtime/_handlers.py` |
19+
| §8 | Job events | ✅ Full | `src/arcp/_envelope.py` |
20+
| §8.1 | `job.queued` | ✅ Full | `src/arcp/_envelope.py` |
21+
| §8.2 | `job.started` | ✅ Full | `src/arcp/_envelope.py` |
22+
| §8.3 | `job.log` | ✅ Full | `src/arcp/_runtime/_handlers.py` |
23+
| §8.4 | `job.progress` | ✅ Full | `src/arcp/_runtime/_handlers.py` |
24+
| §8.5 | `job.result_chunk` | ✅ Full | `src/arcp/_runtime/_handlers.py` |
25+
| §8.6 | `job.completed` | ✅ Full | `src/arcp/_runtime/_handlers.py` |
26+
| §8.7 | `job.failed` | ✅ Full | `src/arcp/_runtime/_handlers.py` |
27+
| §8.8 | `job.cancelled` | ✅ Full | `src/arcp/_runtime/_handlers.py` |
28+
| §8.9 | `job.heartbeat` | ✅ Full | `src/arcp/_runtime/_handlers.py` |
29+
| §9 | Leases | ✅ Full | `src/arcp/_runtime/lease.py` |
30+
| §9.1 | Cost budgets | ✅ Full | `src/arcp/_runtime/lease.py` |
31+
| §9.2 | Time budgets (`expires_in_s`) | ✅ Full | `src/arcp/_runtime/lease.py` |
32+
| §9.3 | `expires_at` (absolute timestamp) | ✅ Full | `src/arcp/_runtime/lease.py` |
33+
| §10 | Delegation | ✅ Full | `src/arcp/_runtime/_handlers.py` |
34+
| §11 | Observability | ✅ Full | `src/arcp/middleware/otel.py` |
35+
| §12 | Errors | ✅ Full | `src/arcp/_errors.py` |
36+
| §13 | Capability negotiation | ✅ Full | `src/arcp/_runtime/server.py` |
37+
| §14 | List jobs | ✅ Full | `src/arcp/_runtime/_handler_list_jobs.py` |
38+
| §15 | Vendor extensions | ✅ Full | `src/arcp/_extensions.py` |
3939

4040
## Notes
4141

4242
### §6.3 Stream resume
4343

44-
Resume tokens are opaque strings returned in the `job.started` event. Pass the token in a new `submit()` call with `resume_token=...` to replay missed events from that point forward.
44+
Resume remains session-scoped in the current implementation. Treat the older
45+
`resume_token` submit flow as deferred until the runtime exposes it publicly.
4546

4647
### §9.3 `expires_at`
4748

docs/guides/jobs.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ print(result.result)
2323
| `input` | `dict` | Arbitrary JSON-serialisable payload |
2424
| `lease_request` | `dict` | Budget constraints (see [Leases](leases.md)) |
2525
| `idempotency_key` | `str` | Deduplicate re-submissions (see below) |
26-
| `agent_version` | `str` | Pin to a specific agent version |
27-
| `resume_token` | `str` | Resume an interrupted stream |
28-
| `resume_from_seq` | `int` | Replay from this event sequence number |
26+
| `lease_constraints` | `dict` | Optional absolute expiry and related constraints |
27+
| `max_runtime_sec` | `int` | Maximum runtime before timeout |
28+
| `trace_id` | `str` | Optional trace correlation id |
29+
| `parent_job_id` | `str` | Parent job for delegation or tracing |
2930

3031
## Registering an agent
3132

@@ -47,23 +48,23 @@ The `ctx` object gives agents access to logging, progress, streaming, cost repor
4748
```python
4849
async def my_agent(input, ctx):
4950
await ctx.log("info", "starting")
50-
await ctx.progress(0, 100)
51+
await ctx.progress(0, total=100)
5152

5253
for i in range(10):
5354
chunk = await do_work(i)
5455
await ctx.result_chunk(chunk)
55-
await ctx.progress((i + 1) * 10, 100)
56-
await ctx.report_cost(0.001) # USD
56+
await ctx.progress((i + 1) * 10, total=100)
57+
await ctx.metric({"name": "cost.inference", "value": 0.001, "unit": "USD"})
5758

5859
return {"done": True}
5960
```
6061

6162
| Method | Description |
6263
|---|---|
6364
| `ctx.log(level, message)` | Emit a `job.log` event |
64-
| `ctx.progress(done, total)` | Emit a `job.progress` event |
65+
| `ctx.progress(current, total=..., units=..., message=...)` | Emit a `job.progress` event |
6566
| `ctx.result_chunk(chunk)` | Emit a `job.result_chunk` event |
66-
| `ctx.report_cost(usd)` | Accumulate cost against the lease |
67+
| `ctx.metric(body)` | Emit a `metric` event |
6768
| `ctx.principal` | The authenticated client identity |
6869
| `ctx.job_id` | The current job ID |
6970
| `ctx.session_id` | The current session ID |
@@ -85,7 +86,7 @@ async for event in handle.events():
8586
```python
8687
handle = await client.submit(agent="slow", input={})
8788
await asyncio.sleep(1.0)
88-
await handle.cancel()
89+
await client.cancel_job(handle.job_id)
8990
# handle.done raises JobCancelledError
9091
```
9192

docs/guides/leases.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ handle = await client.submit(
1414
)
1515
```
1616

17-
The agent reports costs via `ctx.report_cost(usd)`:
17+
The agent reports costs via `ctx.metric(...)`:
1818

1919
```python
2020
async def gpt_4_summary(input, ctx):
2121
response = await call_openai(input["text"])
2222
cost = response.usage.total_tokens * 0.00003
23-
await ctx.report_cost(cost)
23+
await ctx.metric({"name": "cost.openai", "value": cost, "unit": "USD"})
2424
return {"summary": response.text}
2525
```
2626

docs/guides/observability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ trace.set_tracer_provider(provider)
4545
| `arcp.jobs.active` | Gauge | Currently running jobs |
4646
| `arcp.jobs.total` | Counter | Total jobs submitted |
4747
| `arcp.job.duration_ms` | Histogram | Job wall-clock duration |
48-
| `arcp.job.cost_usd` | Histogram | Job cost (from `ctx.report_cost`) |
48+
| `arcp.job.cost_usd` | Histogram | Job cost (from `ctx.metric({"name": "cost.*", ...})`) |
4949
| `arcp.events.total` | Counter | Total events emitted |
5050

5151
## Propagating trace context

docs/guides/resume.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ If a connection drops while a job is running, the client can **resume** the even
88

99
1. The runtime emits a `job.started` event containing a `resume_token`.
1010
2. The client stores the token and the last acknowledged `event_seq`.
11-
3. If the connection drops, the client reconnects and calls `submit()` again with `resume_token=...`.
11+
3. If the connection drops, the client reconnects and calls `client.resume(..., resume=SessionResume(...))`.
1212
4. The runtime replays events from `event_seq + 1` onward.
1313

1414
The job itself is **not** re-executed. Only the event stream is replayed.

docs/recipes/ack-backpressure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pauses production and emits a `status` event with
88
Source: [`../../examples/ack_backpressure/`](../../examples/ack_backpressure/).
99

1010
```sh
11-
uv run python -m examples.ack_backpressure.runtime &
11+
uv run python -m examples.ack_backpressure.server &
1212
uv run python -m examples.ack_backpressure.client
1313
```
1414

docs/recipes/agent-versions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ the example asserts both jobs ran the expected handler.
88
Source: [`../../examples/agent_versions/`](../../examples/agent_versions/).
99

1010
```sh
11-
uv run python -m examples.agent_versions.runtime &
11+
uv run python -m examples.agent_versions.server &
1212
uv run python -m examples.agent_versions.client
1313
```
1414

1515
## See also
1616

1717
- Guide: [Sessions](../guides/sessions.md) — agent versions (§6.2).
18-
- Guide: [Jobs](../guides/jobs.md)`agent_version` submit option.
18+
- Guide: [Jobs](../guides/jobs.md)versioned agent names.

docs/recipes/cancel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ terminal envelope ships.
88
Source: [`../../examples/cancel/`](../../examples/cancel/).
99

1010
```sh
11-
uv run python -m examples.cancel.runtime &
11+
uv run python -m examples.cancel.server &
1212
uv run python -m examples.cancel.client
1313
```
1414

0 commit comments

Comments
 (0)