Operate AgentWorks runtimes and recover work
An AgentWorks Runtime is one process whose runs live in one SQLite file on one volume. Operating it well means
watching its health, stopping new work cleanly before maintenance, keeping that volume safe, and knowing exactly what
recovery does and does not promise. A headless Runtime is operated through its runtime file, health endpoint, API and
CLI. A Runtime connected to DVARA Flightdeck is also operated from its AgentWorks cluster page in
Runtime → Clusters, where an owner sees each Runtime's version, health, last heartbeat, bundle version,
workspaces and active runs, and can drain or revoke it.
What should you monitor on every Runtime?
/actuator/health carries the readiness and liveness probes. Its per-component entries are visible only when you
set Spring Boot's management.endpoint.health.show-details (or show-components) for your operators; the default
shows the overall status alone. Metrics need the prometheus profile, which adds an authenticated scrape endpoint.
| Signal | Where | What to alert on |
|---|---|---|
| Readiness and liveness | /actuator/health/readiness, /actuator/health/liveness | Not UP |
| Runtime file (headless) | agentWorksRuntimeFile health entry | A non-empty refusedChange (a bad edit was refused) or leftOut (a deployment is not served) |
| Flightdeck link (connected) | agentWorksFlightdeckEnrolment health entry | DEGRADED, REVOKED, a certificate near expiry, a failing bundle poll or heartbeat, a growing audit spool |
| Records to Flightdeck (connected) | agentWorksFlightdeckRecords health entry | A growing recordsPending, or any recordsRejected |
| Workers | agentworks.run.worker.polls, agentworks.run.worker.poll.duration | Workers that stop polling while runs are queued |
| Lost claims and recovery | agentworks.run.lease.losses, agentworks.run.recoveries, agentworks.run.recovery.delay | Repeated lease losses, or recoveries that take longer than your objective |
DRAINING, DEGRADED and REVOKED are not in Spring Boot's default status order, so they do not change the
overall status unless management.endpoint.health.status.order lists them. Alert on the entry itself.
A healthy process is not enough. Exercise a representative run and verify its result, events and audit evidence.
How do you stop new work before maintenance?
Connected Runtime. On the cluster page, choose Drain for the Runtime. Its next bundle carries the drain switch, and from then on:
- new runs are refused with
503 RUNTIME_DRAINING, and the A2A front refuses new tasks; - runs already running, and their child runs, finish;
- the Runtime's health entry shows
DRAINING, and Flightdeck no longer picks it for runs started on its pages.
Wait until the cluster page shows no active runs, then stop the process. Stop draining reverses it.
When Flightdeck retires a release's cohort, it asks every Runtime that serves it for that cohort's open work: an
unfinished or quarantined run, a claim, a pending operation, a restorable checkpoint, a retained sandbox, or pending
wake-ups, inbox items, interactions or child work. Each Runtime reports this in its heartbeats, and a silent Runtime
counts as RUNTIME_NOT_REPORTED, never as free of work, so the cohort keeps draining. Revoke a Runtime that will
never report again to release the cohort.
Headless Runtime. There is no drain switch. To stop new runs on a deployment, remove it from the runtime file or
change it: a removed deployment admits no new run, and a changed one gets a new revision. Unfinished runs finish on
the revision they started on. A revision the file no longer routes to stays draining while it holds any open work of
the kinds above, and the agentWorksRuntimeFile health entry lists each draining revision with its blockers.
Stopping either kind of Runtime is a graceful shutdown. Its runs continue when it starts again on the same volume.
When should you revoke a Runtime?
Revoke when a Runtime's identity, host or volume can no longer be trusted. Revocation is not a maintenance step; drain healthy work first when you can.
On the cluster page, Revoke makes Flightdeck refuse the Runtime's certificates and revoke the keys it minted for
it. The Runtime then stops using the bundle's credentials (flightdeck:// references resolve nothing), stops
heartbeats and shows REVOKED. Cancel, pause, resume and answers for its runs are refused with 409 RUNTIME_GONE,
and its active runs become candidates for adoption.
A revoked Runtime keeps trying to enrol, but neither the shared secret nor a cluster token created before the revocation lets it back in. To readmit it, regenerate the cluster's token and restart the Runtime with the new token. If the host or volume itself is suspect, start a new Runtime with a new id on a fresh volume instead. See enrol a Runtime.
What happens during a Flightdeck outage?
A connected Runtime that already holds a verified bundle keeps serving from it:
- Run records wait in an outbox in the SQLite file and audit records in a spool in the enrolment directory, and both are resent when Flightdeck answers. The outbox keeps at most 200,000 records and the audit spool 100,000 events; past that the oldest are dropped, and a run that lost records can no longer pass its next effect barrier.
- A tool with an external effect waits: the effect is not called until Flightdeck has accepted the run's records, and
the run stays active with
EFFECT_BARRIER_UNAVAILABLE. - A governed call that needs a new service token fails with
SERVICE_TOKEN_UNAVAILABLE. - Runs started on Flightdeck's pages, and decisions such as cancels and answers, arrive once the control queue is reachable again.
A Runtime with no saved bundle refuses every run with RUNTIME_BUNDLE_UNAVAILABLE until it receives one; at first
start it waits up to 30 seconds for Flightdeck and then keeps retrying in the background, from 30 seconds doubling to
5 minutes.
A headless Runtime has no Flightdeck dependency. Its equivalent failure is a bad runtime file: the change is refused,
the last good version stays in use, and refusedChange names the problems.
How are interrupted runs recovered?
On the same volume. Restart the Runtime on the volume it ran on. Workers reclaim the runs whose leases lapsed and continue each from its last checkpoint. A committed external effect replays its recorded result instead of running again, and a pending one keeps its stable idempotency key. A headless run belongs to its data folder: it cannot move to another Runtime.
On another connected Runtime. When an active run's Runtime has not sent a heartbeat for 90 seconds
(dvara.flightdeck.products.agents.adoption-lost-after), Flightdeck rebuilds the run only from records it already
accepted and assigns it to a replacement. The replacement must be healthy, current on its bundle, serve the run's
workspace, run the same AgentWorks version and compatibility identity, and provide the run's executor. It verifies the
release, executor, event history, checkpoint and effect records before it imports the run, then continues it under a
new fence, so the former owner cannot write to it again.
| Situation | Result |
|---|---|
| No compatible Runtime | The run stays pending, with the missing requirement shown on the AgentWorks overview. |
| A temporary refusal by the target | Flightdeck tries again, preferring another Runtime, up to 3 attempts (dvara.flightdeck.products.agents.adoption-max-attempts). |
| No safe checkpoint, a gap in the records, a payload too large to ship, or a missing release | The run needs operator attention. Content is never guessed. |
Do not describe every interrupted run as automatically recoverable. Never manufacture a successful result, or repeat an external action whose outcome is uncertain, just to clear a run.
How do you back up and restore a Runtime?
Back up the Runtime's whole data folder as one set. SQLite keeps recent writes in run-plane.db-wal beside the file,
so copy the folder, not the file alone, and stop the Runtime or take a volume snapshot for a consistent copy. For a
connected Runtime, the enrolment directory belongs to the same set. A headless Runtime keeps its run artifacts in the
artifacts folder beside the SQLite file, from AgentWorks 1.16.0; back it up with the file, because an artifact
whose content is missing is quarantined. Encrypt the volume, and keep the runtime file and
the secrets it names in your configuration and secret stores.
Rehearse a restore onto a new volume before production. Restoring a volume discards every run newer than the backup, so prefer restarting on the existing volume. After an upgrade, rolling back the image does not roll back the SQLite file; restore the backup taken before the upgrade if the older version misbehaves. Flightdeck's PostgreSQL database is backed up and restored with Flightdeck.