Operate a desk · How-to
Operate a desk
The operator keeps a desk funded, watches its health, reviews catalog listings and steps in when a task, a seat or an agent needs a person. Every operator action is a request signed by an operator wallet.
This page covers each of those jobs with the operator command that does it. The output below comes from a development desk on a fork, so its figures are test values; Run a desk with your own settings sets one up with an operator wallet you hold. Releasing new code, rotating key epochs and the measured settings are in Releasing the enclave.
Operator wallets and signatures
Section titled “Operator wallets and signatures”A desk has no operator accounts or passwords. It lists the wallets that may operate it in SA_OPERATORS, and every
request to /v1/ops/* carries a signature from one of them over the request itself (/metrics also takes a scraper’s
token, below):
Shipped Agents operatorDesk <the desk's publicUrl><METHOD> <path and query>At <unix seconds>Nonce <a fresh random string>Body <sha256 of the body, hex>The wallet signs that text with personal_sign and sends it in the X-Wallet, X-Wallet-At, X-Wallet-Nonce and
X-Wallet-Signature headers. The desk accepts a signature for 60 seconds and each nonce once; it keeps the nonces it
has seen in its database, so a restart does not reopen them. Signatures and
authentication has the details.
The CLI does the signing. Give it the operator’s key and the desk:
export SA_OPERATOR_KEY=0x...export SHIPPED_AGENTS_URL=http://127.0.0.1:8642npm run cli -- ops agentsThe commands run from a checkout of the repository, where npm run cli -- starts the command line (-s keeps npm’s own lines out of the output). The CLI reads
the desk’s publicUrl from /v1/config and signs for that address. It prints the desk’s JSON answer and exits 0 when
the desk accepts, 1 when it refuses or cannot be reached, and 2 when the command or the key is wrong. With no key set:
SA_OPERATOR_KEY must hold the operator wallet's private key: 0x and 64 hex characters.A wallet the desk does not list is refused:
SA_OPERATOR_KEY=<a key the desk does not list> npm run -s cli -- ops agents{ "error": "not_an_operator", "detail": "That wallet is not an operator of this desk."}So is a request without a signature, before anything is read:
curl -s http://127.0.0.1:8642/v1/ops/agents{"error":"operator_signature_required","detail":"Sign the request from an operator wallet: X-Wallet, X-Wallet-At, X-Wallet-Nonce and X-Wallet-Signature."}With SA_OPERATORS empty, /v1/ops/* answers 404 to everyone, and so does /metrics unless a scraper’s token is set.
Where a command takes a reason, it is 3 to 300 characters: the rest of the command line after the id.
Health, readiness and metrics
Section titled “Health, readiness and metrics”| Route | Who | Answers |
|---|---|---|
GET /health |
anyone | {"ok":true} while the process runs |
GET /ready |
anyone | 200 or 503, with the result of each check |
GET /metrics |
an operator, or a scraper with the metrics token | Prometheus text |
/ready checks the blocked-payee setting, the operator wallets and the trusted proxies first (it never names who is
blocked), then the RPC, the Engagement Registry’s code, a job agent with recorded evidence, the model key, x402 and
the indexer’s lag. Its last check, attention, fails while anything needs a person, and names only the kinds:
“Needs a person: funding.” (Alerts has the details). While the desk shuts down it answers 503 with a single
failing shutdown check. The readiness checks lists each one. The release
compose’s container health check calls /health.
/metrics opens two ways:
-
An operator signature, like every operator route. Each read needs its own: the signature holds for 60 seconds and its nonce is accepted once. The CLI signs for you:
npm run cli -- ops metrics -
A bearer token, for a scraper that cannot sign. Make a random token, keep it with the scraper, and put its sha256 in the release file as
SA_METRICS_TOKEN_SHA256:TOKEN=$(openssl rand -hex 32)printf %s "$TOKEN" | shasum -a 256 | cut -d' ' -f1 # the value of SA_METRICS_TOKEN_SHA256The compose holds the hash and never the token, and the setting is measured, so changing the token is a release. The token opens
/metricsand nothing else. A request with a wrong or missing token falls back to the operator signature, and without one is refused with 401operator_signature_required. In Prometheus:scrape_configs:- job_name: shipped-agentsscheme: httpsmetrics_path: /metricsauthorization:credentials: <token>static_configs:- targets: ["<the desk's domain>"]credentials_filein place ofcredentialsreads the token from a file instead.
Either way the answer is the same text. From ops metrics on a development desk:
# HELP shipped_agents_http_requests_total HTTP requests by route and status.# TYPE shipped_agents_http_requests_total countershipped_agents_http_requests_total{method="GET",route="/v1/config",status="200"} 19shipped_agents_http_requests_total{method="GET",route="/v1/ops/funding",status="200"} 4…shipped_agents_http_requests_total{method="POST",route="/v1/ops/backup",status="200"} 1…shipped_agents_agents{kind="pool",status="idle"} 1shipped_agents_agents{kind="seat",status="idle"} 1…shipped_agents_seats{state="active"} 0shipped_agents_seats{state="grace"} 0shipped_agents_seats{state="releasing"} 0…shipped_agents_seat_releases_stuck 0…| Metric | Type | What it counts |
|---|---|---|
shipped_agents_http_requests_total{method,route,status} |
counter | Requests by route and status |
shipped_agents_http_request_duration_seconds{method,route} |
histogram | Request time, in buckets from 0.01 to 30 seconds |
shipped_agents_rate_limited_total{rule} |
counter | Requests refused by a rate limit: ip, ops (signed operator routes, counted apart) or quote-ip |
shipped_agents_loop_errors_total{loop} |
counter | Failed passes of the desk, seats, pool, till and alerts loops |
shipped_agents_tasks{product,state} |
gauge | Tasks by product and state |
shipped_agents_quotes_open |
gauge | Quotes open now |
shipped_agents_till_payments{state} |
gauge | The till’s payments by state |
shipped_agents_till_usdg_units{state} |
gauge | USDG base units of the till’s payments by state |
shipped_agents_agents{kind,status} |
gauge | Agents by kind and status |
shipped_agents_seats{state} |
gauge | Seats active, in grace and being released |
shipped_agents_seat_releases_stuck |
gauge | Seat releases that failed three times or more: a person has to look |
shipped_agents_draining |
gauge | 1 while the desk shuts down |
shipped_agents_uptime_seconds |
gauge | Seconds since the process started |
Alerts
Section titled “Alerts”The desk decides in one place what needs a person. Its alerts loop runs every 15 seconds and compares what holds now with what held on the pass before:
| Kind | Raised when | Key |
|---|---|---|
loop_failing |
A background loop failed 4 passes in a row | loop:<desk, seats, pool, till or alerts> |
release_stuck |
A seat’s release failed 3 times or more | seat:<agentId> |
movement_stuck |
A release or refund the till decided has not reached the chain 30 minutes later | payment:<id> |
mail_paused |
A seat’s outgoing mail is paused (Seat mail) | mail:<agentId> |
funding |
ops funding lists a need, one alert per need |
funding:<chain>:<token>:<address> |
indexer_lag |
The indexer’s readiness check fails | indexer |
attestation_failing |
An agent’s evidence renewal has failed on every pass for 10 minutes | agent:<agentId> |
Funding needs read every wallet’s balance, so while none is open the desk reads them every 10 minutes; while one is open it reads them on every pass, and a met need clears within about 15 seconds.
Each condition is raised once and cleared once. The desk logs alert: <kind> at warn when it starts, with key,
detail and since, and alert cleared: <kind> at info when it ends. /ready fails attention while any is open.
ops alerts lists them with their details, here on a development desk whose agents were not funded yet:
npm run cli -- ops alerts{ "alerts": [ { "kind": "funding", "key": "funding:Robinhood Chain:ETH:0x04E21bAe66145ed5Fce2Dd18d7071A7a534421FE", "detail": "desk: opens engagements, records evidence, settles x402 payments and moves them out of the till: send 0.0001 ETH on Robinhood Chain to 0x04E21bAe66145ed5Fce2Dd18d7071A7a534421FE.", "since": 1796044673 },… ], "checkedAt": 1796044688}checkedAt is the time of the last pass, null before the first. Once the needs were sent, the same command answered
{"alerts": [], "checkedAt": 1796044778}.
The alert webhook
Section titled “The alert webhook”The desk can also send each raised and cleared alert to a receiver of yours. Set the URL in the release file and the secret as an encrypted variable:
| Setting | What it is |
|---|---|
SA_ALERT_WEBHOOK_URL |
Measured. Where events go; https outside development mode. |
SA_ALERT_WEBHOOK_SECRET |
Secret, at least 32 characters, required with the URL. Every event is signed with it. |
Each event is a POST with a JSON body of this shape:
{"event":"raised","alert":{"kind":"mail_paused","key":"mail:<agentId>","detail":"Sending from seat <agentId> is paused because …","since":<unix>},"desk":"<SA_PUBLIC_URL>","at":<unix>}event is raised or cleared, alert is the alert as ops alerts lists it, desk is the desk’s SA_PUBLIC_URL
and at is when the event happened. The header X-Shipped-Agents-Signature: t=<unix>,v1=<hex> carries an
HMAC-SHA256 of <t>.<raw body> under the secret, where t is the time of that delivery attempt. Check it against the
raw body before parsing it:
import { createHmac, timingSafeEqual } from "node:crypto";
/** True when the shared secret signed this body within the last five minutes. */function signed(body: string, header: string, secret: string, now = Math.floor(Date.now() / 1000)) { const { t, v1 } = Object.fromEntries(header.split(",").map((part) => part.split("=", 2))); if (!t || !v1 || Math.abs(now - Number(t)) > 300) return false; const expected = createHmac("sha256", secret).update(`${t}.${body}`).digest(); const given = Buffer.from(v1, "hex"); return given.length === expected.length && timingSafeEqual(given, expected);}The desk follows no redirect and waits 10 seconds for an answer; anything but a 2xx counts as not delivered. An event
not delivered is sent again on the next pass, oldest first, with a fresh t. Up to 100 events wait; past that the
oldest are dropped and the desk logs how many. ops alerts always has the current state.
Fund the desk and its agents
Section titled “Fund the desk and its agents”The desk never moves money out of the treasury. It works out the least each of its wallets needs for the next piece of work, and whoever holds the treasury sends it:
npm run cli -- ops funding{ "needs": [ { "address": "0x729f24D2e7b2aB27eabA18848E54AD6b234C2060", "amount": "0.0001", "token": "ETH", "chain": "Robinhood Chain", "why": "desk: opens engagements, records evidence, settles x402 payments and moves them out of the till" }, { "address": "0xe94f930C6ac63331c40c545c16bD9e59663b769C", "amount": "0.00005", "token": "ETH", "chain": "Robinhood Chain", "why": "new pool agent: registers itself on ERC-8004" },… ]}What each wallet needs:
| Wallet | Needs |
|---|---|
| The desk | Gas, to open engagements, record evidence and submit the till’s payments |
| A new agent’s wallet | Gas, before it can register itself; until then it waits under waiting in ops agents |
| Every agent | Gas on Robinhood Chain, and on any other chain where it sends its own transactions |
| The job agent | USDG for the bonds on as many of the largest jobs the desk quotes as its daily USDG cap lets it open, at least one; purchases inside a job come out of what is left |
| A seat agent a client holds | USDG for what the seat may still spend this month, at cost, and never more than one day of its caps |
An empty list, {"needs": []}, means every wallet holds enough. The till needs nothing: the desk submits its payments
and pays their gas. A need whose amount is null names a wallet whose balance could not be read just then; the
other needs still show. Ask again, and if it stays null, check the RPC for that chain. Each need is also a funding
alert until it is met.
Agents
Section titled “Agents”List agents
Section titled “List agents”npm run cli -- ops agents{ "agents": [ { "agentId": "26694", "wallet": "0xe94f930C6ac63331c40c545c16bD9e59663b769C", "kind": "pool", "status": "idle", "evidenceAt": 1796029403, "eth": "0.009666776680844476", "usdg": "0", "openQuotes": 0, "tasks": { "total": 0, "live": 0 } } ], "waiting": [ { "wallet": "0xA4917D72C5990Bdaa3b7A54D01448F6D6a3B7976", "kind": "seat" } ]}kind is pool for the agent that takes jobs and runs, and seat for an agent kept for monthly seats. waiting
lists new wallets that have no gas yet. The desk keeps one job agent and SA_IDLE_SEATS free seat agents (one by
default), and starts a new wallet whenever one is missing. A funded wallet registers on the pool’s next pass; when a
step of that fails, the desk logs pool: agent not provisioned and carries on from there on the pass after.
Renew an agent’s evidence
Section titled “Renew an agent’s evidence”The desk renews an agent’s runtime evidence by itself on any pass of the pool’s loop where the evidence is older than
20 days, names other code than the enclave runs now (such as after a release), or has a hash the Engagement Registry
does not hold, because recording it on chain did not go through. Readers refuse evidence older than 30 days. When a
renewal fails, the desk logs pool: agent not attested and tries again on the next pass; the other agents carry on.
Ten minutes of failures raise attestation_failing. The usual causes are the desk’s gas (ops funding) and a rotation
cut short, which ops rotate finishes when run again. To renew it now:
npm run cli -- ops attest 26694{ "agentId": "26694", "evidenceHash": "0x39bdcfd0c0fdcd6642a0b7f064bbd45d7ccce8c8583376acf7d80eae20f3e8bb"}The desk writes a fresh evidence document and records its hash on the Engagement Registry, paying the gas.
Rotate an agent’s wallet
Section titled “Rotate an agent’s wallet”Move an agent to a new wallet key when its key may have leaked:
npm run cli -- ops rotate 26695 Rehearsing a wallet rotation on the development desk.{ "agentId": "26695", "from": "0xA4917D72C5990Bdaa3b7A54D01448F6D6a3B7976", "to": "0x8459a22F6460f3Bf80D1D4cff8F7A92a76E32Df2", "keyName": "agent-mx31ihs4-t15o81-r1796029468", "steps": [ "identity transferred", "moved 9519305806427111 wei of gas", "agent wallet set", "provider named", "evidence recorded", "old key retired" ]}The new key is created inside the desk. The agent’s identity, its USDG and its gas on Robinhood Chain move to it, the
new key becomes the agent’s wallet, the desk is named its provider again, and fresh evidence is recorded. Balances on
any other chain, such as USDC on Base, stay at the old address. The old key stays sealed under keys/retired/, and no
operator command spends from it. That is up to five transactions from the agents’ wallets and one from the desk.
The desk refuses a rotation while the agent has work in flight or a delivered job waiting for its reviewer (409
busy), and for a retired agent (409 retired). If a rotation stops partway it answers 502 rotation_incomplete;
run the same command again and it carries on from the step it reached. Wallet rotation
lists every step.
Retire an agent
Section titled “Retire an agent”A retired agent takes no new work, for good:
npm run cli -- ops retire 26695 Retired on the development desk to show the command.{ "agentId": "26695", "inFlight": [], "ended": [], "waiting": []}Its open quotes expire, a seat it holds ends now with the client’s grace period, and the engagements of finished work
end on chain. Work in flight finishes first: inFlight lists those tasks, and waiting the engagements that end after
them. The desk then starts a new wallet to replace the agent, which waits for gas like any other. A retired agent is
not attested or rotated again:
{ "error": "retired", "detail": "A retired agent is not attested again."}List and inspect tasks
Section titled “List and inspect tasks”npm run cli -- ops tasks --product run --limit 2{ "tasks": [ { "id": "afed686c-0f59-471b-90e5-712478add796", "product": "run", "state": "working", "agentId": "26698", "client": "0x3115336ED879118342D188A82286c38DF3A932e4", "engagementId": "2", "jobId": null, "error": null, "visibility": "public", "status": "http://127.0.0.1:8642/v1/tasks/afed686c-0f59-471b-90e5-712478add796", "report": null, "envelope": null, "payment": { "id": "0xcb8d39861fe671d49820f68e124d34b297c5b86d35a7c157bc505b69fcdc99dd",… "state": "held",… }, "fund": null, "updatedAt": 1796029787 },… ], "next": "1796029776:ef82a9dc-279c-48f3-8d36-3922f43c7ad6"}Filters: --state, --product (job, run or seat), --client, --agent and --limit (1 to 200, default 50).
Newest first. When a page is full, next is a string, the last task’s creation time and id; pass it unchanged as
--before for the next page, which starts right after that task. A page with fewer tasks than the limit ends with
"next": null. Any other --before is refused with 400 bad_request: “before: Pass the next value the page before
ended with.”
ops task <taskId> returns one task with everything the desk holds on it: the task, its signed terms, every state
change with its time, the till’s payments and each movement of them, the agent’s ledger entries for the task, a seat’s
messages and the report:
npm run cli -- ops task ef82a9dc-279c-48f3-8d36-3922f43c7ad6{ "task": {… }, "terms": {… }, "events": [ { "task_id": "ef82a9dc-279c-48f3-8d36-3922f43c7ad6", "at": 1796029776, "from_state": null, "to_state": "paying", "note": null }, { "task_id": "ef82a9dc-279c-48f3-8d36-3922f43c7ad6", "at": 1796029780, "from_state": "paying", "to_state": "opening", "note": null }, { "task_id": "ef82a9dc-279c-48f3-8d36-3922f43c7ad6", "at": 1796029781, "from_state": "opening", "to_state": "working", "note": null } ], "payments": [… ], "ledger": [], "children": [], "report": null}The task lifecycle explains each state.
Fail a task
Section titled “Fail a task”ops fail stops a task and undoes what it holds:
npm run cli -- ops fail ef82a9dc-279c-48f3-8d36-3922f43c7ad6 The docs site was down for the whole run.{ "task": { "id": "ef82a9dc-279c-48f3-8d36-3922f43c7ad6", "product": "run", "state": "failed",… "error": "The docs site was down for the whole run. Your payment of … goes back to 0x3115336ED879118342D188A82286c38DF3A932e4.",… "payment": {… "state": "refunding",… },… }}| The task | What fail does |
|---|---|
| A run | Fails it; the till sends the payment back to the wallet that paid |
| A job opened on Shipped’s job registry | Concedes the job, which pays the client back on chain, then fails the task |
| A seat’s month | Ends the seat as end-seat does, with the client’s grace period |
| A task still opening | Fails the opening; a run’s or seat’s payment goes back, and an engagement already recorded ends |
The desk refuses while the payment is still settling (409 paying) and for a task that has already finished (409
finished). The reason is written into the task, and the client sees it. A run of the task stops at once: every tool
call after that answers stopped, and the run ends before its next model turn. Failing a seat’s month also fails its
messages still running, with the seat’s end message.
Refund a payment
Section titled “Refund a payment”ops refund sends a task’s payment back from the till to the wallet that paid it, while the money is still in the
till. A payment that is still settling can be refunded too, and the refund is made once it settles:
npm run cli -- ops refund afed686c-0f59-471b-90e5-712478add796 The client asked to cancel before work began.{ "payment": { "id": "0xcb8d39861fe671d49820f68e124d34b297c5b86d35a7c157bc505b69fcdc99dd",… "state": "refunding", "released": "0", "refunded": "0", "settledTx": "0x85c55f80b4ed8d3a02f92b7173cddb1b426e85c4fe26ed39c25d1c377c548af0", "movedTx": null }}It moves only the money: the task keeps its state. To stop the work as well, use ops fail, which refunds a run for
you. A payment already released or refunded is refused with 409 not_held, and a job, which is paid through Shipped’s
job registry instead of the till, with 404 no_payment.
Retry a stuck step
Section titled “Retry a stuck step”npm run cli -- ops retry afed686c-0f59-471b-90e5-712478add796{ "task": {… }, "did": "pushing the refund"}retry does the first of these that applies, and says which in did:
- A payment in the till has a decided release or refund that has not reached the chain: the desk starts submitting
it now and answers at once (
pushing the releaseorpushing the refund). If that try does not reach the chain, the till’s loop takes it up on its next pass.ops taskshows the movement once the chain has it. - The task is opening: the desk runs the opening step now, with its attempts reset (
ran the opening step).
Anything else is refused:
{ "error": "nothing_to_retry", "detail": "Nothing to retry: the task is failed (failed while working). A failed task is final: the client asks for a new quote."}A failed task is final, whatever step it failed at.
npm run cli -- ops seats{ "seats": [ { "agentId": "26699", "client": "0x3115336ED879118342D188A82286c38DF3A932e4", "state": "active", "since": 1796029792, "endsAt": 1798625387, "graceUntil": null, "renews": true,… "wipe": { "attempts": 0, "error": null, "next": null }, "reason": null, "retire": false } ]}ops seats lists every seat that is active, in grace or being released. ops seat <agentId> adds each month’s
payment plan (what the till has released and will release), the seat’s top-ups, the state of its wipe, and
"mail": {"paused": null}, or the reason and time when its outgoing mail is paused (Seat mail).
End a seat early
Section titled “End a seat early”npm run cli -- ops end-seat 26699 The client asked to stop the seat.{ "seat": { "agentId": "26699",… "state": "grace", "since": 1796029792, "endsAt": 1796029827, "graceUntil": 1796634627, "renews": false, "endedBy": "operator",… "periods": [… ],… "next": "Renew before 2026-12-07 to keep this seat and its data." }}The seat’s months are cut now and the seat’s engagements end on chain. The till then releases the fee for the time
the seat ran and refunds the rest to the wallet that paid, one movement after the other on its next passes, each about
15 seconds apart; each period’s released and refunded in ops seat show them as they land. The client keeps
reading the seat’s data through the grace period (7 days by default), then the desk wipes it. Add --now to skip the
grace period and start the wipe at once.
Retry a release
Section titled “Retry a release”A release wipes the seat’s notes, memory, skills, secrets, schedules, mail contacts and message contents, checks that
nothing is left, and offers the agent to the next client. When a step fails the desk tries again later; after three
failures shipped_agents_seat_releases_stuck counts it and ops seat shows the error. To try again now:
npm run cli -- ops release 26699{ "seat": { "agentId": "26699", "state": "released",… }, "wipe": { "attempts": 0, "error": null }}release works only on a seat being released; for any other it answers 409 not_releasing.
Seat mail
Section titled “Seat mail”The desk pauses a seat’s outgoing mail when three addresses it wrote to bounce hard within a week, or when a recipient
marks its mail as spam. The seat still receives mail; its agent’s sends are refused with email_paused, and the agent
is told to tell the client. The desk logs mail: sending paused for seat <agentId> because <reason> at warn and raises
mail_paused, and ops seat <agentId> shows the pause in this shape:
"mail": { "paused": { "reason": "a recipient marked its mail as spam", "at": <unix> } }Review the bounces or the complaint with the client, then lift the pause with the reason:
npm run cli -- ops resume-mail 26699 Reviewed the bounced addresses with the client.The desk answers {"resumed": true}, logs ops: seat mail resumed with the agent and the reason, and the alert
clears on the next pass. It answers 404 not_found (“No client holds that seat.”) for a seat nobody holds, 409
not_paused when the seat’s mail is not paused, and 503 unavailable on a desk without seat mail.
The catalog review queue
Section titled “The catalog review queue”Product owners submit skills to the catalog; an operator approves or rejects each one before agents can load it.
npm run cli -- ops catalog{ "submissions": [ { "id": "a26d0b66-01d7-4703-b80e-70ff1cda3a8c", "product": { "id": "price-history", "name": "Example Prices", "description": "Daily closes for tokens on Robinhood Chain.", "site": "https://prices.example.com/", "owner": "0x9c6877f44c42fDB9910F3A5e5C507Eb5F7Fb2938", "payees": [ "0x8ba1f109551bD432803012645Ac136ddd64DBA72" ] }, "state": "pending",… "skill": { "version": "1.0.0", "hash": "0xf423924afa74c46f2594608f9acd26e339eda2136b0e96fd1a3dc80fc455bb29", "manifest": {… }, "warnings": [] }, "files": [… ] },… ]}Each submission carries the product, the skill’s checked manifest and the text of every file, so the review happens on what agents would load. Approve one by its id:
npm run cli -- ops approve a26d0b66-01d7-4703-b80e-70ff1cda3a8c{ "id": "price-history", "name": "Example Prices",… "version": 1, "skill": { "name": "price-history", "version": "1.0.0", "hash": "0xf423924afa74c46f2594608f9acd26e339eda2136b0e96fd1a3dc80fc455bb29", "hosts": [ "prices.example.com" ] }, "listedAt": 1796029457,…}Or reject it with a reason the owner reads:
npm run cli -- ops reject 5fb7fe1e-3aab-4da0-ad1e-b77e3bbb1152 The site is the API host, not a page a client can read.{ "id": "5fb7fe1e-3aab-4da0-ad1e-b77e3bbb1152", "product": {… }, "state": "rejected",… "reason": "The site is the API host, not a page a client can read."}List your product is the owner’s side.
Accounts and usage
Section titled “Accounts and usage”ops accounts shows the revenue wallet’s and the till’s USDG, the till’s payments by state, and recent tasks with what
each agent spent on them by label:
npm run cli -- ops accounts{ "revenue": { "address": "0xc7A63c097Cbf9bdcbCD956C783fE99581f334f04", "usdg": "0" }, "till": { "address": "0xf20b815B8f042B12Cd24497720Ada8C2a45B4195",… "payments": [ { "state": "held", "n": 1,… }, { "state": "refunded", "n": 2,… } ] }, "tasks": [ { "taskId": "6a865e74-61f7-4bcd-a1b7-9db3d06aa859", "product": "seat", "state": "working",… "spend": {}, "model": "0" },… ]}--task <taskId> narrows it to one task, and --limit (1 to 500, default 100) sets how many recent tasks it lists.
ops usage adds up model cost and agent spending for every task created in a window, by product, with each task’s
own figures. It covers the last 30 days unless you pass --from and --to in unix seconds:
npm run cli -- ops usage{ "from": 1793437854, "to": 1796029854, "products": { "job": { "tasks": 0, "model": "0", "spend": {} }, "run": { "tasks": 2,… }, "seat": { "tasks": 1,… } }, "tasks": [… ]}Backups
Section titled “Backups”npm run cli -- ops backup --out desk-backup.sealedWrote a sealed backup of 571195 bytes to desk-backup.sealed.The desk takes the backup at one moment and streams it as it seals it:
- It stages the backup in a folder named
.backup-<random>inside its data directory, on the data volume. The folder holds hard links to the data files, so nothing is copied, and a copy of the store made with sqlite’s backup API from a read snapshot. The snapshot and the links, with each file’s length, are taken in one step, so the store and every ledger are as they were at the same moment. The desk keeps serving while the store is copied. - The archive, format
shipped-agents/backup/v2, is a start frame, each file in chunks of at most 1 MiB, and an end frame. Each frame is a 4-byte length and a blob sealed under the app’s key, labelled with the archive and its place in it, so a frame missing, repeated, moved or taken from another archive does not open, and an archive without its end frame is incomplete. - Left out: the store’s live files (
desk.sqlite-wal,-shmand-journal),*.lockand*.tmpfiles, a backup or restore under way, and in development modedev-seal.key, the key that opens the archive. - The staging folder is removed when the stream ends or the download stops. A folder that a stop left behind is removed at the next start.
The CLI writes the stream to <file>.part with mode 0600 as it arrives, and renames it to <file> only once the last
frame is the end frame. A stream cut short exits 1 with “The backup did not arrive whole, so nothing was kept:
ops: backup taken once it has sent the whole archive:
{"time":"2026-11-30T13:19:47.124Z","level":"info","msg":"ops: backup taken","service":"shipped-agents","bytes":571195,"files":8}When the archive was not sent whole, because a read failed or the download stopped, it logs ops: backup failed at
error with the bytes sent so far and the reason. Run ops backup again.
The archive opens only inside a CVM of the same app whose compose hash the key service allows at the archive’s key epochs, so it can be kept anywhere. Backup and restore covers when to take one, where to keep it and how to restore onto a replacement CVM.
Restore a backup
Section titled “Restore a backup”A backup is restored only by a desk that waits for one: a desk started with SA_RESTORE=1 on a data directory that
holds nothing, the development seal key aside. That desk opens its enclave and, before it creates any key, logs
restore: waiting for a backup at warn with its port, and answers:
| Route | While it waits |
|---|---|
GET /health |
{"ok":true} |
GET /ready |
503, with one failing check, restore: “Waiting for a backup: send one with ops restore.” |
GET /v1/config |
{"publicUrl": …}, which the CLI signs for |
POST /v1/ops/restore |
Takes the backup, from an operator in SA_OPERATORS |
| Anything else | 503 restoring: “This desk is waiting for a backup and serves nothing else yet.” |
It reads the PROXY protocol header as the running desk does, and allows an upload up to an hour. Send the archive:
npm run cli -- ops restore desk-backup.sealed{ "restored": { "at": 1796044787, "files": 8 }}at is when the backup was taken. The CLI hashes the file, signs the request with that sha256 on the Body line, and
sends the file as it reads it, as application/octet-stream with the digest in X-Body-Sha256; the desk checks the
upload against it. Exit 0 means restored, 1 refused or unreachable, 2 a usage error.
The desk opens every frame and writes every file under .restore in the data directory first, so a wrong, tampered or
partial archive is refused and leaves the data directory as it was. An archive sealed under older key epochs opens
with those epochs’ key, which the key service gives while the compose hash is allowed at them, and is re-sealed under
the current epochs. The desk then writes a mark that the restore is whole and moves the files into place. A restart
during the move finishes it at the next start (restore: finished moving the restored backup into place), and a
restore cut off before the mark is dropped. Once the files are in place the desk logs restore: backup restored with
the operator, at and files, and starts from the restored data with the same wallets and agents.
| Status | error |
When |
|---|---|---|
400 |
bad_backup |
The archive is not a whole backup this desk can open. detail says why: not a backup, cut short, a frame missing or out of place, data after its end, an end that does not match its files, a seal this key does not open, a file it may not restore, key epochs the key service will not give, or “The archive is not the one the operator signed.” |
400 |
bad_request |
No X-Body-Sha256, or no body |
401, 403 |
the operator errors | As on every operator route |
409 |
busy |
Another backup is being restored |
409 |
not_empty |
A running desk, before any of the upload is read: “This desk runs from its own data. A backup is restored only by a desk started with SA_RESTORE=1 on an empty data directory.” |
A refused archive is logged restore: backup refused at warn with the reason, and the desk keeps waiting. Here a
backup cut to its first 100,000 bytes:
{ "error": "bad_backup", "detail": "The archive is cut short."}On a data directory that holds a desk, SA_RESTORE=1 does nothing: the desk logs restore: the data directory holds a desk, which starts as it is and starts. With SA_RESTORE=1 and no SA_OPERATORS, the desk refuses to start, since
no operator could send the backup.
In development mode the archive does not hold dev-seal.key. Copy it into the new, otherwise empty data directory
before the desk starts:
mkdir -m 700 data-restoredcp -p data/dev-seal.key data-restored/SA_RESTORE=1 SA_DATA_DIR=./data-restored npm run desk # with the desk's other settingsnpm run cli -- ops restore desk-backup.sealed # from a second terminalThe desk writes one JSON object per line to stdout, starting with time, level and msg, plus service and the
event’s own fields. Every URL is cut to scheme://[redacted] and every hex string of 80 or more characters (a
signature, calldata) to 0x[redacted], because RPC URLs can carry keys:
{"time":"2026-11-30T09:04:51.970Z","level":"info","msg":"desk: agent retired","service":"shipped-agents","agent":"26695","reason":"Retired on the development desk to show the command."}{"time":"2026-11-30T13:19:47.124Z","level":"info","msg":"ops: backup taken","service":"shipped-agents","bytes":571195,"files":8}A logged error carries name and message, and when present code, status, hash, shortMessage, details,
cause (nested, scrubbed the same way) and stack (up to 8 code locations).
Every request except /health and /ready gets a request line with its request id, method, path, status, time in
milliseconds and client address, and every operator request also gets an ops: request line naming the operator
wallet. A client can send its own x-request-id (8 to 64 letters, digits, dots, dashes or underscores); the desk uses
it and returns it on the answer, so one id follows a request through the logs.
These lines need a person, at once or when they repeat. Every one is at warn or error, so a log alert on those two
levels sees them all, and the conditions that last also raise an alert:
| Line | Level | What it means | What to do |
|---|---|---|---|
alert: <kind> |
warn | A condition that needs a person started; detail says which. Also on /ready, in ops alerts and at the webhook. |
Act on the detail; alert cleared: <kind> (info) follows when it ends. |
desk loop failed, seats loop failed, pool loop failed, till loop failed, alerts loop failed |
error | One pass of that loop failed; the next runs 15 seconds later. Four in a row raise loop_failing. |
Read error; if it repeats, the RPC or the disk is the usual cause. |
request failed |
error | A request ended in a 500; the client was told to try again. | Read error and the request id. |
pool: agent not attested |
error | An agent’s evidence could not be renewed or recorded on chain this pass; the next pass retries. Ten minutes of it raise attestation_failing. |
Desk gas: ops funding. A binding that does not match after a rotation cut short: ops rotate again. |
pool: agent not provisioned |
error | A funded new wallet could not finish registering this pass; the next pass carries on. | If it repeats: gas, or the RPC. |
till: movement not done yet |
warn | A decided release or refund did not reach the chain this pass; the till’s loop retries. After 30 minutes it raises movement_stuck. |
If it repeats: ops task <taskId>, and the desk’s gas (ops funding). |
till: movement will be retried |
warn | A movement started outside the till’s loop, such as by ops refund, did not finish; the loop takes it up. |
None unless movement_stuck follows. |
till: release not decided, till: refund not decided |
error | A payment’s movement could not be decided. | ops task, then ops refund or ops retry. |
till: payment not checked against the chain yet |
warn | Whether a pending payment settled could not be read; the payment stays pending and is read again next pass. | Check the RPC. |
till: settlement payer differs from the authorization's signer |
warn | The settlement names another payer than the wallet that signed, and the till records the settlement’s payer. | Read the payment with ops task before you refund it. |
seats: till movement will be retried, usage: top-up movement will be retried |
warn | A seat’s or a top-up’s next movement could not be decided this pass. | None unless it repeats. |
seats: release step failed, seats: expiry step failed |
error | A seat’s release or month end failed; the desk retries. | ops seat <agentId> shows the error. |
seats: release not done; the agent stays held back |
warn | A release left something behind (why); the desk tries again with a growing wait. Three tries raise release_stuck. |
Fix the cause, then ops release <agentId>. |
seats: engagement not ended yet; the release retries |
warn | The seat’s engagement could not be ended on chain this pass. | The desk’s gas, or the RPC. |
seats: a client's delete left data behind |
error | A client’s data deletion found something left. | ops seat <agentId>. |
seats: a renewal's catalog pick was not added |
warn | A catalog skill a renewal picked could not be added. | Check the catalog product. |
mail: sending paused for seat <id> because <reason> |
warn | Three hard bounces in a week, or a spam complaint, paused the seat’s outgoing mail; raises mail_paused. |
Review it, then ops resume-mail <agentId> <reason> (Seat mail). |
mail: waking seat <id> failed: … |
warn | Mail to a seat could not start a run. | If it repeats, ops seat. |
screen: the review timed out, … answered <status>, … failed, screen: the review's answer could not be read |
warn | The brief screen could not judge a brief; clients get 503 screening_unavailable. |
Check the model key and the provider’s status. |
desk: agent cannot take a job |
warn | The job agent lacks the gas or the bond to open a job; clients are told to ask again in a few minutes (503 agent_unavailable). |
ops funding, and send what it lists. |
desk: the bond is refused by the agent's policy |
error | The job agent’s caps do not allow the bond a job needs. | Check SA_CAPS. |
desk: advance failed |
error | An opening step stopped outside its own retries; the desk loop runs it again. | If it repeats, ops task. |
desk: opening step failed, desk: task failed while opening |
warn | An engagement or job could not be opened on this try, or at all. | ops task. A failed task is final; whatever its client paid goes back. |
desk: engagement not ended yet, desk: job outcome not read |
warn | A chain write or read for a finished task did not happen this pass; the next pass tries again. | The RPC, or the desk’s gas. |
desk: settlement not confirmed; the chain decides, desk: the payment's request ended before settlement |
warn | An x402 settlement is unconfirmed, or its request ended early; the till decides from the chain. | None. A payment that arrives late is refunded. |
task <id>: concede failed: … |
error | A failed job’s concession did not reach the chain. | ops task <id>. The job’s terms still refund the client, by a rejection or once the review window closes. |
task <id>: <error>, task <id>: failed: <why>, task <id>: could not resolve payment …, task <id>: transcript: …, task <id>: memory: …, reconcile <scope>: … |
warn | A worker step failed and is retried, or a task failed and was refunded. | If one task keeps showing up, ops task. |
task <id>: dropped a torn final line of <n> bytes from <path> |
warn | A stop cut a transcript’s last line short; the line was removed and the run resumes. | None unless it repeats. |
worker: …, reconcile: … |
error | A worker pass failed. | Read the message; the RPC or the disk is the usual cause. |
record: checkpoint failed, record: first checkpoint failed, record: checkpoint after a delivery failed |
error | An agent’s public record could not be checkpointed; the desk tries again within the hour. | Read error. A ledger that no longer opens needs an engineer. |
indexer sync failed |
warn | The indexer could not read the registry’s events; falling 600 blocks behind fails /ready and raises indexer_lag. |
Check the RPC. |
ops: backup failed |
error | A backup was not sent whole; the CLI kept nothing. | Run ops backup again. |
restore: waiting for a backup |
warn | A desk with SA_RESTORE=1 on an empty data directory waits for a backup. |
ops restore <file> (Restore a backup). |
restore: backup refused |
warn | A sent archive was refused; error says why. |
Send a whole archive of this app. |
restore: request failed |
error | A request ended in a 500 while the desk waited for a backup. | Read error. |
alerts: webhook not delivered |
warn | The alert webhook could not be reached; pending events wait, 100 at most. |
Check the receiver. |
alerts: webhook events dropped while it was down |
warn | More than 100 events waited, and the oldest were dropped. | ops alerts has the current state. |
alerts: funding needs not read |
warn | The funding check failed; the last known needs stand. | Check the RPC. |
ops: rotating an agent's wallet |
warn | An operator started a rotation, with the reason. | None. |
no operator wallet is set (SA_OPERATORS)…, no trusted proxy is set (SA_TRUSTED_PROXIES)… |
warn, at boot | Outside development mode, a release setting is missing: without operators nobody may use /v1/ops; without trusted proxies every client counts as the ingress’s address. |
Set it in the release file, or release from the template, and release again. |
In the release compose, Docker keeps the desk’s logs in up to five files of 10 MB each. The release deploys the CVM
with --no-public-logs, so its container logs are not published
(Releasing the enclave), and the image has no shell to read them from inside the
container.
When the desk does not start
Section titled “When the desk does not start”The desk checks its configuration before it serves anything, and stops with one of these messages when a check fails. The measured configuration, the blocked-payee list and the dstack image are checked outside development mode only.
| Message | Cause | What to do |
|---|---|---|
The runtime configuration is not the measured one: … |
A setting differs from the measured compose (<name> differs from the measured value), is set outside it (<name> is set but not in the measured compose), a secret does not come from an encrypted variable (<name> must come from an encrypted variable), or DSTACK_SIMULATOR_ENDPOINT is set |
Correct the release’s settings, write the compose again and release it; pass secrets only as encrypted variables |
SA_BLOCKED_PAYEES is not set. … |
The blocked-payee list is missing | Set it as an encrypted variable, empty to block none |
<token> on <chain> signs under another domain than … |
The token the chain registry pins answers with another signing domain | Point the chain’s RPC at the right chain, or correct the token’s domain in SA_CHAINS |
Two spending rules cover …, …'s caps have to grow from a payment to a job to a day., A dollar total is set, and no spending rule is for a dollar stablecoin., and the other messages about spending rules |
SA_CAPS, SA_CAPS_TOTAL, SA_DOLLAR_ASSETS and SA_CHAINS do not agree |
Correct the settings the message names |
The card limits have to grow from a card to a job to an agent's day to the desk's day. |
SA_CARD_MAX, SA_CARD_PER_JOB, SA_CARD_PER_DAY and SA_CARD_DESK_PER_DAY are out of order |
Set them in that order, each no larger than the next |
No dstack guest agent with the v1 API answers at <socket>. In a CVM the desk needs a dstack 0.6 OS image; outside one, development runs with SA_DEV=1. … |
The CVM runs an older dstack OS image, or the desk runs outside a CVM without development mode | Deploy on the image Releasing the enclave names; on your own machine, set SA_DEV=1 |
SA_RESTORE is set and SA_OPERATORS is empty, so no operator could send the backup. |
A desk told to wait for a backup lists no operator | Set SA_OPERATORS in the release file |
SA_HOST is an IP address to listen on, such as 127.0.0.1 or 0.0.0.0., SA_METRICS_TOKEN_SHA256 is the sha256 of the scraper's token, 64 hex characters., SA_ALERT_WEBHOOK_URL is an https URL., SA_ALERT_WEBHOOK_URL needs SA_ALERT_WEBHOOK_SECRET, at least 32 characters: every event sent there is signed with it., SA_RESTORE is 1 or 0. |
The setting the message names has a value the desk does not take | Correct that setting |
What needs a person
Section titled “What needs a person”| When | What to do |
|---|---|
ops alerts lists an alert, or /ready fails attention |
Act on its detail. The alert clears by itself once the cause is gone. |
ops funding lists a need |
Send it from the treasury. Nothing else funds the desk or its agents. |
A submission is in ops catalog |
Approve or reject it. |
| A seat’s outgoing mail is paused | Review the bounces or the complaint, then ops resume-mail <agentId> <reason>. |
| A desk waits for a backup | ops restore <file> with the latest backup of this app. |
shipped_agents_seat_releases_stuck is above 0 |
Read ops seat <agentId>, fix the cause, then ops release <agentId>. |
A task stays in opening or failed while opening |
ops task, then ops retry. |
| A client asks to stop a run or a seat | ops fail or ops end-seat, with the reason. |
| An agent’s key may have leaked | ops rotate, and rotate the key epoch (Key epoch rotation). |
| An agent should take no more work | ops retire. |
| Before and after every release | ops backup, kept off the machine. |
The blocked-payee list, SA_BLOCKED_PAYEES, also needs a person: it changes only when a deployment’s encrypted
variables do. Releasing the enclave describes it.
Every operator command
Section titled “Every operator command”| Command | Route |
|---|---|
tasks [--state] [--product] [--client] [--agent] [--limit] [--before] |
GET /v1/ops/tasks |
task <taskId> |
GET /v1/ops/tasks/<taskId> |
retry <taskId> |
POST /v1/ops/tasks/<taskId>/retry |
fail <taskId> <reason> |
POST /v1/ops/tasks/<taskId>/fail |
refund <taskId> <reason> |
POST /v1/ops/tasks/<taskId>/refund |
agents |
GET /v1/ops/agents |
retire <agentId> <reason> |
POST /v1/ops/agents/<agentId>/retire |
attest <agentId> |
POST /v1/ops/agents/<agentId>/attest |
rotate <agentId> <reason> |
POST /v1/ops/agents/<agentId>/rotate |
funding |
GET /v1/ops/funding |
alerts |
GET /v1/ops/alerts |
accounts [--task] [--limit] |
GET /v1/ops/accounts |
usage [--from] [--to] |
GET /v1/ops/usage |
seats |
GET /v1/ops/seats |
seat <agentId> |
GET /v1/ops/seats/<agentId> |
end-seat <agentId> <reason> [--now] |
POST /v1/ops/seats/<agentId>/end |
release <agentId> |
POST /v1/ops/seats/<agentId>/release |
resume-mail <agentId> <reason> |
POST /v1/ops/seats/<agentId>/mail/resume |
backup --out <file> |
POST /v1/ops/backup |
restore <file> |
POST /v1/ops/restore |
catalog |
GET /v1/ops/catalog/queue |
approve <submissionId> |
POST /v1/ops/catalog/submissions/<submissionId>/approve |
reject <submissionId> <reason> |
POST /v1/ops/catalog/submissions/<submissionId>/reject |
metrics |
GET /metrics |
The CLI reference prints the command’s own help, and the HTTP API describes each route.