Skip to content

$5-a-day demo recipe: the agent buys until the budget says no (#29 pattern) #209

Description

@hellno

Standalone; the x402-track demo deliverable in the full #29 shape. Depends on #34 (budget primitive + fixtures), #206 (local facilitator recipe), #208 (agent 402 client); #207 provides the visible gauge (the transcript notes which beats are GUI vs headless).

The demo, audience view

  1. Policy: policy.x402-daily.json — USDC allowed (asset_allow), a 5.00 USDC/day token_budget, a per-payment cap (e.g. $2.50), everything else default-deny. Dollar framing throughout: the pitch is "$5 a day", not wei.
  2. Agent hits a paid API (the local x402 server fixture from x402 phase 2: exact/EIP-3009 payments on the Ethereum reference path, fully local demo loop #34, facilitator per Spike: x402 build shape — hand-rolled EIP-3009 vs x402-rs, and prove the fully-local facilitator loop #206). First call: 402 → the daemon authorizes $2.00 within budget → content returned. The gauge reads $2.00 / $5.00.
  3. Second call: $2.50 → $4.50 / $5.00.
  4. Third call ($2.00): would breach the daily budget → typed budget-exhausted deny (x402 phase 2: exact/EIP-3009 payments on the Ethereum reference path, fully local demo loop #34's X-series reason) → the agent reports "out of budget until tomorrow (UTC rollover)". Optional approval beat: the human raises the budget in-app, the retry succeeds.
  5. Lockdown (Rename the global stop to Lockdown #203) ends the session.

Deliverables (the #29 triple)

  • policy.x402-daily.json.
  • The transcript: exact prompts, expected tool results, expected UI states.
  • An acceptance test (mock daemon) asserting the three decisions — allow, allow, budget-deny — and the UTC-rollover reset.
  • just demo-x402: wires fork world + x402 server fixture + facilitator + agent env in one target.

Acceptance

  1. just demo-x402 + transcript reproduce end-to-end on a fresh clone.
  2. Acceptance test green in CI.
  3. Screenshots: the payment card, the gauge at $4.50, and the budget-deny (GUI beats via x402 payment surfaces in the GUI: authorization card, per-asset budget gauge, paid-domain activity rows #207).
  4. DoD green: cargo fmt --all --check, just check, cargo test --workspace, no new/changed deps without approval.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions