Persist state across multi-step workflows
Conserva el estado a lo largo de flujos de varios pasos
Give long-running, multi-step agent tasks stable identifiers and durable state, so progress survives retries, scaling, and reconnection.
Why
Stateful sessions that collide with load balancers lose work mid-task. Anthropic's guidance on long-running agent harnesses is explicit: progress held only in an in-memory session is lost on any retry, scaling event, or reconnection. The MCP Tasks specification formalizes this with a defined lifecycle (submitted → working → input-required → completed/failed) and stable task IDs. The 12-Factor Agents framework calls for stateless reducers with durable external state — the agent's code should be able to restart from any point given the stored task state.
Do
Use durable task IDs and resumable state.
Don't
Hold critical state only in a sticky session.
Artifact
{
"task_id": "task_88a",
"status": "running",
"step": 3,
"of": 5,
"resumable": true,
"resume_token": "rt_...",
"updated_at": "2026-06-04T12:00:00Z"
}
Citations
- [01]Anthropic — Effective Harnesses for Long-Running Agents ↗
Long-running, multi-context-window workflows require durable task identifiers and resumable state; progress held only in an in-memory session is lost on any retry, scaling event, or reconnection
- [02]MCP Specification 2025-11-25 — Tasks ↗
MCP Tasks lifecycle defines submitted, working, input-required, completed, canceled, and failed states with stable task IDs for durable multi-step agent workflows
- [03]12-Factor Agents — Stateless Design ↗
Agents should be designed as stateless reducers — each operation processes inputs and produces outputs independently — with durable external state rather than sticky in-process sessions