# Agent Resumption

> Persist agent execution state so long-running tasks survive restarts, deploys, and user disconnects without losing progress.

- **Category**: Agentic AI
- **Subcategory**: Governance & Observability
- **Canonical URL**: https://designpattern.fyi/patterns/agent_resumption/

---

## Description
**Intent**: Persist agent execution state so a multi-hour run survives restarts, deploys, or user disconnects.
**Context**: Production agents that take minutes or hours to finish — scraping large datasets, running multi-step migrations — will inevitably hit worker restarts, host failures, or session drops. Throwing away in-flight work is unacceptable to both operators and users.
**Solution**: Two battle-tested approaches. **(a) Deterministic replay** (Temporal/Inngest pattern): state = inputs + log of side-effects; on resume, re-execute the workflow code and skip effects that already have logged results. **(b) Checkpoint snapshots** (LangGraph Cloud pattern): periodically serialize plan, working memory, partial outputs, and pending tool calls; restore on restart. Both require **idempotency keys** passed to side-effect targets so a replayed-but-unlogged call deduplicates downstream — without this, crash-between-effect-and-log produces duplicates.



## Use Cases
- Agent runs are long enough that restarts, deploys, or disconnects would lose meaningful work.
- Side effects can be logged or snapshotted without breaking semantics on replay.
- Users or operators need confidence that in-flight runs survive infrastructure events.






## Trade-offs


### Advantages

- Dramatically improves reliability for long-running agents.

- Deploys no longer kill user work mid-flight.




### Considerations & Drawbacks

- Checkpoint storage adds cost.

- Resumed runs may encounter drifted external state.

- Deterministic replay requires workflow code to be deterministic — any non-determinism corrupts resume.

- Tools without idempotency key support cannot be safely replayed.







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/agent-resumption/)

