Skip to content

Commit 6272827

Browse files
committed
docs: move examples to docs/recipes/ with updated links (closes #28 partially)
1 parent 8b2fd94 commit 6272827

22 files changed

Lines changed: 389 additions & 0 deletions

docs/recipes/ack-backpressure.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Ack back-pressure
2+
3+
The runtime emits events faster than the client acknowledges them;
4+
once the unacked window exceeds the configured limit, the runtime
5+
pauses production and emits a `status` event with
6+
`phase: "backpressure"`, then resumes once acks catch up.
7+
8+
Source: [`../../examples/ack_backpressure/`](../../examples/ack_backpressure/).
9+
10+
```sh
11+
uv run python -m examples.ack_backpressure.runtime &
12+
uv run python -m examples.ack_backpressure.client
13+
```
14+
15+
## See also
16+
17+
- Guide: [Job events](../guides/job-events.md) — event acknowledgement.

docs/recipes/agent-versions.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Agent versions
2+
3+
The runtime registers two versions of `weekly-report`; the client
4+
submits one job against `weekly-report@2026.05.0` and a second
5+
against bare `weekly-report` (resolved to the default version), and
6+
the example asserts both jobs ran the expected handler.
7+
8+
Source: [`../../examples/agent_versions/`](../../examples/agent_versions/).
9+
10+
```sh
11+
uv run python -m examples.agent_versions.runtime &
12+
uv run python -m examples.agent_versions.client
13+
```
14+
15+
## See also
16+
17+
- Guide: [Sessions](../guides/sessions.md) — agent versions (§6.2).
18+
- Guide: [Jobs](../guides/jobs.md)`agent_version` submit option.

docs/recipes/cancel.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Cancel
2+
3+
The client sends `job.cancel`; the runtime cancels the agent task and
4+
emits a terminal `job.error` with code `CANCELLED`. The agent body
5+
receives `asyncio.CancelledError` and may run cleanup before the
6+
terminal envelope ships.
7+
8+
Source: [`../../examples/cancel/`](../../examples/cancel/).
9+
10+
```sh
11+
uv run python -m examples.cancel.runtime &
12+
uv run python -m examples.cancel.client
13+
```
14+
15+
## See also
16+
17+
- Guide: [Jobs](../guides/jobs.md) — Cancellation.
18+
- Spec: [ARCP v1.1 §7.3](https://arcp.dev/spec/v1.1#section-7.3).

docs/recipes/cost-budget.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Cost budget
2+
3+
A client submits a job with `max_cost_usd: 0.05`; the agent
4+
reports successive cost increments until the budget reaches zero,
5+
and the next `ctx.report_cost(...)` call fails with `LeaseExceededError`.
6+
7+
Source: [`../../examples/cost_budget/`](../../examples/cost_budget/).
8+
9+
```sh
10+
uv run python -m examples.cost_budget.runtime &
11+
uv run python -m examples.cost_budget.client
12+
```
13+
14+
## See also
15+
16+
- Guide: [Leases](../guides/leases.md) — cost budgets.

docs/recipes/custom-auth.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Custom auth
2+
3+
A runtime mounts a custom `BearerVerifier` that consults an external
4+
identity store, replacing the `StaticBearerVerifier` used in the
5+
quickstart. Demonstrates the seam between transport-level
6+
authentication and the rest of the protocol.
7+
8+
Source: [`../../examples/custom_auth/`](../../examples/custom_auth/).
9+
10+
```sh
11+
uv run python -m examples.custom_auth.runtime &
12+
uv run python -m examples.custom_auth.client
13+
```
14+
15+
## See also
16+
17+
- Guide: [Authentication](../guides/auth.md).
18+
- Spec: [ARCP v1.1 §6.1](https://arcp.dev/spec/v1.1#section-6.1).

docs/recipes/delegate.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Delegate
2+
3+
A parent agent submits a child job to a peer runtime through
4+
`JobContext.delegate(...)`, propagating `parent_job_id` and
5+
`trace_id`, and requesting a strict-subset lease. Demonstrates how
6+
delegation composes the recursive case of jobs / events / leases.
7+
8+
Source: [`../../examples/delegate/`](../../examples/delegate/).
9+
10+
```sh
11+
uv run python -m examples.delegate.runtime &
12+
uv run python -m examples.delegate.client
13+
```
14+
15+
## See also
16+
17+
- Guide: [Delegation](../guides/delegation.md).
18+
- Guide: [Architecture](../architecture.md) — Delegation (§10).
19+
- Spec: [ARCP v1.1 §10](https://arcp.dev/spec/v1.1#section-10).

docs/recipes/heartbeat.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Heartbeat
2+
3+
The runtime emits `session.ping` at a short interval; the client
4+
replies with `session.pong`. The example then simulates a stalled
5+
client to surface `HEARTBEAT_LOST` and a `session.error` close.
6+
7+
Source: [`../../examples/heartbeat/`](../../examples/heartbeat/).
8+
9+
```sh
10+
uv run python -m examples.heartbeat.runtime &
11+
uv run python -m examples.heartbeat.client
12+
```
13+
14+
## See also
15+
16+
- Guide: [Job events](../guides/job-events.md)`job.heartbeat`.

docs/recipes/host-aiohttp.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Host: aiohttp
2+
3+
Attaches `arcp.middleware.aiohttp.arcp_aiohttp_handler(runtime)` to an
4+
`aiohttp.web.Application` route, serving ARCP from an aiohttp host
5+
process.
6+
7+
Source: [`../../examples/host_aiohttp/`](../../examples/host_aiohttp/).
8+
9+
```sh
10+
uv run python -m examples.host_aiohttp.server &
11+
uv run python -m examples.host_aiohttp.client
12+
```
13+
14+
## See also
15+
16+
- Guide: [Architecture](../architecture.md) — aiohttp middleware.
17+
- Guide: [Transports](../transports.md).

docs/recipes/host-asgi.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Host: ASGI
2+
3+
Mounts `arcp.middleware.asgi.arcp_asgi_app(runtime, allowed_hosts=[...])`
4+
at `/arcp` inside a Starlette application, serving ARCP alongside
5+
ordinary HTTP routes via uvicorn.
6+
7+
Source: [`../../examples/host_asgi/`](../../examples/host_asgi/).
8+
9+
```sh
10+
uv run python -m examples.host_asgi.server &
11+
uv run python -m examples.host_asgi.client
12+
```
13+
14+
## See also
15+
16+
- Guide: [Architecture](../architecture.md) — ASGI middleware.
17+
- Guide: [Transports](../transports.md).

docs/recipes/host-tracing.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Host: OpenTelemetry
2+
3+
Wraps the runtime's accept loop with
4+
`arcp.middleware.otel.with_tracing(...)` to propagate W3C trace
5+
context across the wire and emit v1.1 span attributes per spec §11.
6+
The example uses the OTel console exporter so traces are visible
7+
without an external collector.
8+
9+
Source: [`../../examples/host_tracing/`](../../examples/host_tracing/).
10+
11+
```sh
12+
uv run python -m examples.host_tracing.runtime &
13+
uv run python -m examples.host_tracing.client
14+
```
15+
16+
## See also
17+
18+
- Guide: [Observability](../guides/observability.md).
19+
- Spec: [ARCP v1.1 §11](https://arcp.dev/spec/v1.1#section-11).

0 commit comments

Comments
 (0)