Payment context survives one delegation hop — so paid tools can live where the work does.
- Put a paid tool behind a task() delegation and keep the payment lifecycle intact
- Cap paid calls per run — a deep agent decides for itself how many subagent hops a request warrants
- Guard against the supervisor answering a paid question from its own knowledge (giving it away free)
- Compare harnesses side by side with the sibling create_react_agent research agent
The buyer attaches an x402 token to the run. The supervisor never touches it — it delegates via the built-in task tool, and LangGraph copies configurable down into the subagent's tool calls. So @requires_payment works unchanged one hop away from where the token was supplied.
A deep agent can bill several times per user turn, so the tutorial caps it explicitly with NVM_MAX_PAID_CALLS_PER_RUN and sends a fresh nvm_run_id to scope the cap per-run rather than per-conversation.
"config": {"configurable": {
"payment_token": token,
"nvm_run_id": str(uuid.uuid4()),
}}| src/agent.py | create_deep_agent supervisor + research-sub owning the paid tool |
| src/buyer.py | sends token + nvm_run_id; prints the raw ToolMessage as source of truth |
Sandbox agent — real payment round-trips (402 → authorize → settle) with a per-session credit balance, no external service and no real money. Deep Agents needs its own virtualenv (LangChain v1); the paid tool sits one task() hop away in a subagent, and the token survives the delegation. See the README to run it against a hosted deployment.