Treat preemption as a normal failure mode
Spot and preemptible GPU capacity can disappear while an agent is partway through a task. A retry at the HTTP request boundary may start a new model request, but it does not automatically reconstruct the in-memory workflow, open stream, or completed tool work.
Design the run so that worker loss is expected: track a durable task identity, record which work has completed, and make side-effecting tool calls safe to retry or reconcile.
Treat a provider notice as a signal to begin draining, not as proof that a checkpoint is complete. Notices can arrive with little time to spare, and the worker may still be busy flushing output or recording tool results. The orchestrator should own the deadline, decide whether to stop accepting new tasks, and record the last checkpoint that is actually safe to restore.
Separate process recovery from task recovery. Restarting a container or provisioning a replacement GPU restores capacity; it does not establish whether an agent step committed, whether a tool ran, or what the client already received. Those decisions need an explicit task state model rather than assumptions based on process health.
Keep recovery state close to the transport
Recovery needs more than a healthy replacement GPU. The system must know which worker failed, what stream state was acknowledged, and which standby is eligible. Keep health signals, endpoint selection, and recoverable offsets explicit instead of burying them in application-specific retry code.
Choose the recovery unit before choosing the standby policy. A whole agent task, a model request, a tool invocation, and a streamed response have different replay costs and correctness constraints. Keep these identities separate in telemetry so operators can tell a recovered task from a newly started attempt.
- Separate worker health from agent task state.
- Record progress at boundaries that can be replayed safely.
- Use idempotency keys or deduplication for tool calls with side effects.
- Keep secrets and provider credentials in the deployment's normal secret store.
Exercise the failure path before production
Run controlled worker termination in staging and verify the complete task, not just that a replacement process starts. Measure recovery time in your own topology, inspect duplicate tool activity, and confirm that the result matches the last acknowledged state.
FaultPlane's quickstart simulator demonstrates checkpoint restoration after a simulated crash. It explicitly does not measure token-level loss, so validate token continuity separately with a workload and instrumentation appropriate to your model provider.
Record timestamps for the failure signal, checkpoint selection, standby readiness, first resumed event, and task completion. This breakdown helps locate whether a delay comes from scheduling, state reconstruction, model startup, or application work. Report the measurement window and workload alongside any recovery-time figure.
A rollout checklist
Start with a canary workload and a known recovery objective. Confirm that your standby has compatible model access, that secrets remain available without copying them into logs, and that your monitoring distinguishes a recovered run from a restarted one. Increase traffic only after these checks pass.
Include a rollback path that returns new work to the established worker pool without discarding in-flight task state. Document who can pause failover, how an operator inspects a stuck task, and which events are retained for audit. These controls matter as much as the happy-path handoff when GPU capacity is constrained.
Run the local workflow recovery demo
go run ./cmd/daemonThe daemon is a local runtime. The command alone does not simulate a Spot preemption or prove end-to-end session recovery.