Demonstrates ARCP v1.1's cost.budget lease capability and the
BUDGET_EXHAUSTED error. The lease grants USD:1.00; the agent
charges 0.30 per iteration via a cost.* metric (decremented by
the runtime); after ~4 iterations the next pre-call authorization
hits zero remaining and throws.
The runtime emits debounced cost.budget.remaining metrics so the
client can plot the trajectory.
In one terminal:
pnpm tsx examples/cost-budget/server.tsIn a second terminal:
pnpm tsx examples/cost-budget/client.ts- §9.6
cost.budgetlease capability and per-currency counters. - Runtime auto-decrement on
cost.*metrics with matchingunit. - Runtime-emitted
cost.budget.remainingmetric (debounced). - §12
BUDGET_EXHAUSTEDerror code (non-retryable).
| Env var | Default | Used by |
|---|---|---|
ARCP_DEMO_PORT |
7891 |
server |
ARCP_DEMO_URL |
ws://127.0.0.1:7891/arcp |
client |
ARCP_DEMO_TOKEN |
demo-token |
both |