Agentic applications can fail mid-run: a network call drops, a server process crashes, an LLM request times out. Without durability built in, these failures mean lost progress and repeated (wasted) LLM calls when the process has to start over.

Pydantic AI provides a native integration with Temporal, a durable execution engine. Temporal records each step of a workflow's execution as an event history, so if a process crashes, it can resume from where it left off instead of starting over.

Pydantic AI exposes this through the TemporalAgent class, which wraps an existing agent and converts its tool calls, MCP calls, and model requests into Temporal Activities.

from pydantic_ai import Agent

from pydantic_ai.durable_exec.temporal import TemporalAgent