# Durable Tasks, Queues & Background Agents **Track:** Models, Tools & Agents — AI-Native Full-Stack Development — complete (30) **Framework / surface:** web dev (durable execution / queues) **Level:** Advanced **Prerequisites:** Human Approval & Degrees of Autonomy, Context, State & Memory **In one line:** Long-running agent work must survive request timeouts, retries, restarts, and moments when no browser is connected. ## Theory, aesthetics & inspiration An HTTP request is a poor home for work that takes minutes, waits for a human, retries after failure, or continues after the browser closes. Durable execution separates accepting work from completing it: record a task, return an identifier, and let a worker proceed while persistent state tracks progress — queues supply buffering and retry semantics, and checkpointed workflows resume after interruption instead of restarting. The pattern is now protocol-level: the Model Context Protocol's 2026-07-28 revision moved long-running work into a Tasks extension with durable task handles and polling semantics, and Cloudflare's Agents runtime documents queues, schedules, state, and recovery as first-class primitives — evidence from opposite ends of the stack, as of 2026, that the industry has converged on the same shape. The conceptual payoff: an agent becomes a durable process with a lifecycle, not a long response. Model the statuses explicitly — queued, running, waiting-for-approval, failed, cancelled, completed — and the UI becomes a view onto persistent task state, which is exactly what it should be. **Builder question:** If the server process vanished halfway through this job, what persisted state would let another process continue safely?