# Long-horizon agents and durable execution

DevFeed: [Long-horizon agents and durable execution](<https://devfeed.tech/articles/long-horizon-agents-and-durable-execution-128970.md>)

Original publisher: [Read original article](<https://martinfowler.com/articles/durable-execution-agents.html>)

Author: Martin Fowler (martin@martinfowler.com)

Published: 2026-11-10T14:10:00Z

Content type: article

Language: en

Sources: [Martin Fowler](<https://devfeed.tech/sources/martin-fowler.md>)

Topics: [long-running](<https://devfeed.tech/topics/long-running.md>), [Multi-step AI processes](<https://devfeed.tech/topics/multi-step-ai-processes.md>), [agentic workflows](<https://devfeed.tech/topics/agentic-workflows.md>), [Persistence](<https://devfeed.tech/topics/persistence.md>)

Tags: [agents](<https://devfeed.tech/tags/agents.md>), [automate](<https://devfeed.tech/tags/automate.md>), [behavior](<https://devfeed.tech/tags/behavior.md>), [can](<https://devfeed.tech/tags/can.md>), [complete](<https://devfeed.tech/tags/complete.md>), [complex](<https://devfeed.tech/tags/complex.md>), [crashes](<https://devfeed.tech/tags/crashes.md>), [days](<https://devfeed.tech/tags/days.md>), [durable-execution](<https://devfeed.tech/tags/durable-execution.md>), [execution](<https://devfeed.tech/tags/execution.md>), [external](<https://devfeed.tech/tags/external.md>), [failure](<https://devfeed.tech/tags/failure.md>), [failures](<https://devfeed.tech/tags/failures.md>), [helps](<https://devfeed.tech/tags/helps.md>), [horizon](<https://devfeed.tech/tags/horizon.md>), [model](<https://devfeed.tech/tags/model.md>), [more](<https://devfeed.tech/tags/more.md>), [multiple](<https://devfeed.tech/tags/multiple.md>), [network](<https://devfeed.tech/tags/network.md>), [pattern](<https://devfeed.tech/tags/pattern.md>)

## AI overview

Durable execution lets long-running agents recover from crashes by logging each external step's inputs and results, replaying the program to rebuild state, and skipping completed steps. Temporal and Cloudflare Workflows both support durable steps and waits; the article's code uses Temporal, while Cloudflare uses `step.do` and `step.waitForEvent`. Retries are at least once, so writes need stable idempotency keys to avoid duplicates. The harness must also handle uncertain outcomes, stale approvals and changing prices, code changes during suspended workflows, growing memory, and untrusted text. The article contrasts runtime behavior during rule changes: Temporal continued an existing task under its earlier rule, while Cloudflare failed when replayed decisions violated current rules. It recommends versioning rules and treating the log as a published interface. Durable execution supports recovery, but does not ensure decisions are correct or secure.

## Source excerpt

Long-horizon agents can automate complex tasks that take days or weeks to complete and involve multiple exchanges with people and external systems. Many things can go wrong during this time, including process crashes, network failures, and unanticipated real-world behavior. Kiran Prakash explains durable execution: an emerging pattern that helps agents recover from these failures and move towards their goal. In this programming model, the runtime keeps a record of the result of each step that interacts with the outside world so that, when a failure occurs, the program runs again, completed steps are skipped, and the program's state is rebuilt from the record. more...