Checkpoint schema changes during a long case
Detect: Loader detects an unsupported schema version.
Recover: Migrate explicitly or route the run to a compatible worker.
Persist the minimum authoritative execution state needed to recover an agent run, maintain concurrency safety, and explain completed work.
State persistence records an agent execution beyond the lifetime of a process or conversation connection. Useful state includes the current workflow position, validated observations, artifact references, pending operations, budgets, and version information. A conversation transcript alone rarely contains enough information to restart safely after a tool call or concurrent update.
Separate authoritative workflow state from disposable caches and long-term user memory. Checkpoints describe what the runtime knows, while business systems describe which external effects actually occurred. Recovery must reconcile these views rather than assume that replaying a saved prompt reproduces the same decisions or side effects.
A prototype may keep messages in memory while testing interaction design. Introduce durable checkpoints as soon as losing a run creates material rework or ambiguous external actions.
Production requires atomic updates, encryption, retention policies, and a consistent execution identifier. Checkpoints should be written at meaningful boundaries with known replay behavior.
At scale, partition state by tenant and execution, control hot-record contention, and migrate schemas deliberately. Large raw tool payloads belong in an artifact store with references, not repeatedly copied checkpoint documents.
Persists versioned execution state and supports atomic conditional updates.
Holds large immutable evidence and output objects referenced by checkpoints.
Connects thread, run, task, and external operation identifiers without conflating them.
Loads compatible state and reconciles pending or uncertain effects before resuming.
Applies deletion, archival, and tenant-specific data handling rules to stored state.
flowchart LR
W["Agent worker"] --> C["Versioned checkpoint store"]
W --> A["Immutable artifact store"]
W --> T["Business tool"]
T --> O["Operation ledger"]
C --> R["Recovery coordinator"]
O --> R
A --> R
R --> N["Replacement worker"]
N --> CsequenceDiagram
participant W as Original worker
participant C as Checkpoint store
participant T as Business service
participant R as Recovery worker
W->>C: Persist pending operation identity
W->>T: Execute command with operation identity
T->>T: Commit business effect
Note over W: Worker stops before recording response
R->>C: Load pending operation
R->>T: Query original operation status
T-->>R: Existing committed result
R->>C: Record result and resume next stageAssign a stable run identifier and persist initial inputs, permissions context, and schema version.
Validate a tool result and update the state using an expected-version check.
Save completed work and pending operation identities before advancing dependent stages.
A replacement worker claims the run with a lease or fencing token.
Query external operation status for commands whose outcomes were not durably recorded.
Continue from a compatible checkpoint, then apply completion retention and deletion rules.
Banking operations · Illustrative enterprise scenario, not a reported customer outcome.
A banking operations team gathers business-account documents over several days, with customers and reviewers responding asynchronously.
A chat-only implementation loses which documents were validated and can repeatedly ask customers for already accepted evidence.
The assistant must resume the case accurately after deployment or worker failure without duplicating document requests.
A checkpoint store tracks required and accepted documents, while encrypted artifacts retain originals and an operation ledger records sent requests.
If two workers update the same case, one conditional write fails and reloads the current state instead of overwriting new evidence.
Track recovery success, state conflicts, checkpoint size, and repeated customer requests. Retention must follow the organization's approved case-data policy.
| Decision | Benefit | Cost |
|---|---|---|
| Frequent checkpoints | Less work is lost during process failure. | Storage writes and serialization add latency. |
| Rich saved context | Recovery needs fewer repeated reads. | Sensitive data exposure and schema migration complexity increase. |
| Strong concurrency control | Workers cannot silently overwrite each other. | Hot executions may require retries or serialized ownership. |
Detect: Loader detects an unsupported schema version.
Recover: Migrate explicitly or route the run to a compatible worker.
Detect: Pending operation remains unresolved on recovery.
Recover: Reconcile with the business system before continuing.
Store typed workflow position, operation identities, and accepted evidence.
Choose storage guarantees that match recovery requirements.
Store protected references and retrieve short-lived credentials at execution.