USDocsHow it works

How a car buys a charge.

ADEV is the layer between AutoDock’s rotary towers and whatever is asking for power: an app, a dispatcher, or an agent with a wallet and no human attached. Five walkthroughs, in the order they happen.

01

One loop, three phases

Every consumer moves through the same three phases: a driver's app, a fleet dispatcher, or an AI agent sitting in the car. Only the transport changes, and both transports land on the same function.

Apps

Driver app

REST · /api/v1

AI clients

Claude · Cursor

MCP · /api/mcp

The loop

Discover → Decide → Dock

find · estimate · transact

One surface

The service layer

lib/services

Nothing is duplicated per transport. A tool and an endpoint are two doors into one function.

Source of truth

Simulation engine

2s tick · OCPP state machine

02

Booking a bay

The loop as it actually runs over HTTP. Nothing here needs an account: you can look at the whole network, price a charge and hold a bay without ever identifying yourself.

The caller

Driver app

no key, no account

Discover

Find a free bay

GET /availability?lat&lng&connector

Decide

Price the charge

POST /estimates/charge-time

Taper-aware: the estimate follows the real charge curve, so 20→80% and 80→100% are not the same minutes.

Dock

Hold it

POST /bookings · 20-min hold

The engine

Bay goes Reserved

honoured on the next tick

The hold expires on its own and the bay returns to the pool. Nothing has to poll it, and a lapsed hold is billed as a no-show.

03

Paying for it, without an account

The Dock phase for machines. Instead of demanding an API key, the server quotes a price with HTTP 402. The agent signs a stablecoin transfer that costs it nothing to sign, and the reservation exists only once that payment settles on Solana devnet.

The buyer

In-car agent

a keypair + USDC, no account

Step 1

Asks to reserve a bay

POST /api/v1/x402/bookings

Step 2

402 Payment Required

price · asset · payTo

Step 3

Agent signs

a USDC TransferChecked, off-chain

The agent never holds SOL. The merchant sponsors its own fees, so a car needs a stablecoin balance and nothing else.

Step 4

Server verifies

exactly one transfer, right ATA

Step 5

Sponsor settles

adds the fee-payer signature

Step 6

201 + receipt

reservation · PAYMENT-RESPONSE

No payment, no booking. The gate runs before the reservation is ever created.

04

How a robotaxi charges itself

The San Francisco network has no drivers to make the call. A vehicle drops below its reserve, an orchestrator scores every site it could reach, and the winner is whichever costs the fleet the least, measured in the one unit that matters.

The trigger

Below reserve

SoC 22% · reserve 26%

Think

State + constraints

connector · min kW · detour cap

Plan

Score every site

drive + queue + charge + energy + risk

Every term converts to minutes of fleet revenue forgone at $0.85/min, so the five become one number and the lowest wins outright.

Do

A bay is awarded

20-min hold · $2, credited · ETA published

Holding is free in practice: the $2 comes back off the session. Only a vehicle that never turns up pays, and it pays $5, for a 350 kW bay withheld from the pool for nothing.

Dock

Hands-free connect

rotary carriage engages

No human in the loop, end to end. That is the only way a robotaxi fleet charges at all.

05

What talks to what

Three surfaces, one service layer, one engine. The console is not privileged: it reads the same REST the public does, over the same simulation every other caller sees.

Humans

Ops console

Next.js · live SSE

Apps

REST

/api/v1/*

AI clients

MCP server

8 tools · HTTP

The service layer

One surface, both transports

lib/services

The engine

Deterministic simulation

seeded · 2s tick · lazy singleton

Same seed, same network, every time, so a demo is reproducible and a test can assert on it.

Persistence

Postgres

write-through

Write-through, not read-through: pull the database out and the network keeps running.

06

The actual numbers

Tick
2s
one simulation step
Seed
1337
fixed, the network is reproducible
Hold
20 min
$2 to book, credited · $5 no-show
Connectors
CCS2 · NACS · Type2 · CHAdeMO
per bay
MCP tools
8
Discover 4 · Decide 2 · Dock 2
x402 price
0.59 USDC
the India booking fee, on-chain
x402 network
Solana devnet
scheme exact · USDC
Fleet clock
$0.85/min
what an idle robotaxi costs

See it running

live