Durable Execution
Use durable execution in production when a run in flight has to survive its process stopping, through a deploy, a crash or a transient API failure, or when a workflow waits hours or days for a person or another system. A durable engine journals the agent’s model requests and the tool calls it wraps, and a restarted run replays the completed ones from the journal and retries the one in flight. Which tool calls (function tools, MCP servers) an engine wraps for you and how it delivers streaming differ per engine; each page below says.
Pydantic AI supports eight durable execution engines, plus a builder for any other engine. Each page below has a complete example:
| Engine | Install | Make an agent durable with |
|---|---|---|
| Temporal | pydantic-ai-slim[temporal] | TemporalDurability from pydantic_ai.durable_exec.temporal |
| DBOS | pydantic-ai-slim[dbos] | DBOSDurability from pydantic_ai.durable_exec.dbos |
| Prefect | pydantic-ai-slim[prefect] | PrefectDurability from pydantic_ai.durable_exec.prefect |
| Restate | restate_sdk[serde] | RestateAgent from restate.ext.pydantic |
| AWS Lambda | pydantic-ai-harness[aws-lambda] | AWSLambdaDurability from pydantic_ai_harness.aws_lambda |
| Absurd | pydantic-ai-harness[absurd] | AbsurdDurability from pydantic_ai_harness.absurd |
| pgtask | pydantic-ai-harness[pgtask] | PGTaskDurability from pydantic_ai_harness.pgtask |
| Apache Airflow | apache-airflow-providers-common-ai | AgentOperator(..., durable=True) from airflow.providers.common.ai.operators.agent |
Temporal, DBOS, Prefect, Restate, and AWS Lambda are co-maintained by the Pydantic and vendor teams. AWS Lambda, Absurd, and pgtask ship in Pydantic AI Harness; Restate and Airflow ship in the engine’s own package.
Capability authors can also move custom hook work into engine activities, steps, or tasks with durable capability operations.
Append-on-change instructions derive their baseline and replacements from persisted history. Instruction callbacks still follow the engine’s replay rules: use a durable operation for external reads so replay uses the same values and produces the same history shape.
Third-party runtime authors can use the stable durable execution backend builder to integrate another engine without importing Pydantic AI internals.
Harness workspace capabilities such as Coder, Shell, and FileSystem also run inside a durable agent; the
workspace guide shows how, and what works on each engine.