← back
From Stateless Nightmares to Durable Agents — Samuel Colvin, Pydantic
Takeaway
Long-running agents need durable execution — wrap LLM and tool calls as Temporal activities so crashes don't restart deep-research-style workflows.
Summary
- Pydantic AI now supports Temporal and DBOS for durable execution; OpenAI uses Temporal for Deep Research.
- Demo: a 20-questions agent (Haiku 3.5) wrapped as a Temporal workflow — IO/tool-calls run as activities, workflows must be deterministic so state can be replayed.
- With 20% injected failure rate the workflow auto-retries; killing the Kubernetes-style worker mid-run resumes from logfire-tracked workflow ID without losing progress.
- Critiques OpenAI's Temporal integration for not running tool calls as activities ('chocolate teapot'); shows Pydantic AI's TemporalAgent wrapper preserves tool calls as activities.
durable-executionpydantic-aitemporal
Original description
Building production AI agents reveals a harsh truth: stateless architectures that work for simple demos become impossibly painful at scale. When long-running workflows fail, you lose all compute, progress, and user trust. This is why companies like OpenAI use Temporal for products like Deep Research—to build durable agents that recover from failures instead of forcing users to start over. In this talk, you'll learn how to: - Build resilient AI agents that survive crashes and resume from checkpoints - Implement durable execution with PydanticAI and Temporal - Gain production-grade observability with Pydantic Logfire and Evals - Compose multi-agent systems that handle failures gracefully - Stop burning money on failed agent runs that restart from scratch We'll walk through real code examples, including a Deep Research implementation that demonstrates how proper architecture turns fragile prototypes into production-ready systems. Links: - Demo code on GitHub: https://github.com/pydantic/pydantic-stack-demo/tree/main/durable-exec - Pydantic AI Documentation: https://ai.pydantic.dev/ - Temporal Integration Guide: https://ai.pydantic.dev/durable_execution/temporal/ - Pydantic Logfire Docs: https://logfire.pydantic.dev/docs/ Samuel Colvin is a Python and Rust expert. His work has redefined data validation and observability for developers. His Pydantic library powers 350M+ downloads every month, serving as a core dependency for OpenAI SDK, Anthropic SDK, LangChain, LlamaIndex, and countless other GenAI projects. --- Socials: - LinkedIn: https://www.linkedin.com/company/pydantic/ - X (Twitter): https://x.com/pydantic - GitHub: https://github.com/pydantic - Website: NA - Company: Pydantic (https://pydantic.dev)