+ Workshop 04
WS-04 / 13:30
An Agent That Charges for Work
Enable payments so your Agent can sell services in a marketplace.
+ Continuity
Workshop 3 created a useful service. Today we make it chargeable.
The Mentor Agent can already receive a repo, reason, and return actionable guidance.
But a service is not a business until it defines price, access, execution, and delivery.
Today we add ERC-8004 identity and x402 authorization before work runs.
+ Commercial jump
From useful agent to paid service.
Work
Define the task the agent sells.
Price
Publish what it costs to run that task.
Gate
Require authorization before execution.
Delivery
Return result, receipt, and metadata.
+ Separate concepts
ERC-8004 does not charge. x402 does.
ERC-8004
- Agent identity
- Available services
- Registry and discovery
- Trust signals
x402
- Payment requirements
- HTTP 402 Payment Required
- Payment signature
- Execution receipt
Together, they let other systems find, evaluate, and pay an agent.
+ Architecture
The paid flow is an explicit chain.
+ x402 lifecycle
Payment lives inside the request cycle.
The client tries to execute, receives requirements, pays, retries, and then the agent works.
- 01 Toggle off: open demo
- 02 Toggle on: request without signature
- 03 Server returns 402
- 04 Client pays or uses fixture
- 05 Retry with PAYMENT-SIGNATURE
- 06 Agent executes
- 07 Server returns receipt
+ Main demo
Three tests show the full gate.
- 01 Toggle OFF + no PAYMENT-SIGNATURE -> 201, executes as demo
- 02 Toggle ON + no PAYMENT-SIGNATURE -> 402 Payment Required
- 03 Toggle ON + x402-fixture-paid -> 201, executes with receipt
- 04 Optional Base Sepolia -> paymentStatus settled
+ Production vs demo
The demo teaches the pattern. Production replaces the fixture.
Today
- Fixture signature x402-fixture-paid
- In-memory jobs
- Local ERC-8004 registration
- Visible switch for learning
Production
- @x402/hono facilitator
- Real receiver wallet
- ERC-8004 registry
- Persistence, limits, and audit logs
+ The journey
The agent now completes the value cycle.
Workshop 1 - Give our application a brain. ✅
Workshop 2 - Turn it into an agent. ✅
Workshop 3 - Give the agent a job. ✅
Workshop 4 - Execute payments with x402.
+ Final proof
WS-04 / Build
Charge for work.
Publish identity, turn on the gate, reject unpaid requests, and execute with a receipt.