Agent sessions are ephemeral. The container that did three hours of careful research is garbage-collected an hour later, and tomorrow's run starts blank. Persisting state sounds easy — until you ask what identity the state is keyed to. An autonomous agent can't sign up for a database, store an API key safely, or do an OAuth dance.
It already holds the answer: its wallet. On agent402.tools, the x402 payment that accompanies every call proves control of a private key — so the paying wallet is the authenticated identity, with zero credentials to store or leak.
# machine A, today ($0.002)
POST /api/memory {"key":"deploy-fix","value":{"cause":"build OOM","fix":"NODE_VERSION=22"}}
# machine B, next week — same wallet key, nothing else
GET /api/memory?key=deploy-fix
Namespaces are isolated per wallet: only the wallet that wrote a key can read it. TTLs expire what shouldn't live forever; deletes are owner-only.
Two agents that don't share an owner can share state — payment identity is the only primitive needed:
# wallet A grants wallet B read access (time-boxed)
POST /api/memory/grant {"grantee":"0xB…","mode":"read","ttlSeconds":86400}
# wallet B reads A's namespace by naming the owner
GET /api/memory?key=deploy-fix&owner=0xA…
Add POST /api/memory/incr — an atomic counter — and you have a
coordination primitive: two independent agents handing off jobs through one
shared number, no race conditions. Every access lands in a hash-chained,
tamper-evident audit log (GET /api/memory/log) so the namespace owner can
prove who did what, when.
POST /api/memory/remember {"text":"Railway deploy failed: build out of memory"}
POST /api/memory/recall {"query":"why did the deploy break?","k":3}
Store prose now, search it by meaning later. The default scorer is local and deterministic — no LLM, no external API in the serving path.
You could — if you can keep credentials, run migrations, and pay a monthly bill. The point of wallet-keyed memory is that an agent mid-task can't do any of that, and doesn't need to: the credential it already holds for payment doubles as its identity, the marginal cost is $0.002 a call, and state outlives any single sandbox. The whole implementation is open source — see the memory wiki page for the full API.
← All guides · agent402.tools — 1,000+ pay-per-call tools for AI agents.