Durable agents: resume without repeating the damage
Design checkpoints, operation records, and approval boundaries around external side effects.
Saving conversation history does not by itself make an agent resumable. A restart must recover what happened, what remains pending, and which actions are safe to repeat.
LangGraph persistence stores graph state in checkpoints. In-memory implementations lose that state across process restarts; choose persistent storage when restart recovery matters.
The ambiguous write
Consider a tool that creates a ticket:
- The runtime sends the create request.
- The service creates the ticket.
- The network connection closes before the runtime receives its identifier.
- A resumed run retries and creates a duplicate.
A checkpoint alone cannot resolve this ambiguity. If the service supports idempotency keys, persist a stable operation key before dispatch and reuse it on retry. Otherwise query the service using an application-specific correlation identifier or pause for reconciliation. Do not promise exactly-once effects without the external system supporting the required guarantees.
Approval belongs to a concrete proposal
Persist the target, action, relevant arguments, artifact version, requester, and approval decision. If the proposal changes, re-evaluate whether the existing approval still applies. A bare boolean such as approved: true cannot explain which deployment or deletion was approved.
LangGraph’s interrupt documentation notes that a resumed node restarts from its beginning. Code before the interrupt can execute again. Structure nodes so replay cannot silently repeat external writes, and make necessary pre-interrupt effects idempotent.
Failure cases to test
These are proposed tests for a deployment agent:
- Crash before sending the request: resume the pending operation once.
- Crash after remote success: reconcile the outcome before retrying.
- Resume with a different artifact: require a decision about the changed proposal.
- Expired approval: stop before the side effect.
- Duplicate resume signal: retain a single operation record and reconcile duplicate dispatch.
- User cancellation: prevent new work and report any already-started external operation.
Record what can and cannot be cancelled at each boundary. A stopped local process does not prove a remote deployment was stopped.
Inspect the boundary: approval trace. This local simulation ends before deployment and never executes an external action.