{
 "schema_version": 1,
 "generated": "2026-10-31",
 "id": "pydantic-pydantic-ai--make-an-agent-survive-crashes-with-temporal",
 "repo": "pydantic/pydantic-ai",
 "repo_url": "https://github.com/pydantic/pydantic-ai",
 "repo_slug": "pydantic-pydantic-ai",
 "title": "Make a research agent survive crashes with Temporal",
 "page_title": "How to make a research agent survive crashes with Temporal with Pydantic AI",
 "summary": "Attach TemporalDurability so the same Pydantic AI agent runs inside a durable Temporal workflow.",
 "who": "A team running long research or reporting agents that cannot afford to restart from scratch.",
 "problem": "A long agent run that crashes halfway loses its progress and its token spend.",
 "outcome": "An agent running under durable execution in Temporal, or saving and resuming steps with StepPersistence.",
 "steps": [
  "Install with `uv add \"pydantic-ai[temporal]\"`",
  "Create an Agent with instructions, capabilities such as WebSearch and WebFetch, and TemporalDurability()",
  "Wrap it in a workflow class based on PydanticAIWorkflow with a run method, as in the README",
  "DBOS and Prefect attach the same way if you use those instead of Temporal",
  "Without an engine, use StepPersistence from Pydantic AI Harness to save, resume and fork runs"
 ],
 "agent_prompt": "Using pydantic/pydantic-ai with TemporalDurability, turn my <agent> into a Temporal workflow that writes a brief on a topic. Show me that killing the worker mid-run and restarting it resumes the workflow.",
 "agents": [
  "claude-code",
  "codex",
  "cursor"
 ],
 "difficulty": "Advanced",
 "time": "1 hour",
 "basis": "readme",
 "caveat": "You need a running Temporal setup, which the README does not cover; see the Durable Execution docs.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Python and uv",
  "An API key for the model provider you choose",
  "Optional extras: pydantic-ai-harness[coder], pydantic-ai[temporal] and a Temporal setup, pydantic-ai[openai-realtime]",
  "Optional: a Logfire account for tracing"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.8,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/pydantic-pydantic-ai/make-an-agent-survive-crashes-with-temporal/",
 "md": "https://dedupedai.com/use-cases/pydantic-pydantic-ai/make-an-agent-survive-crashes-with-temporal/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/pydantic-pydantic-ai--make-an-agent-survive-crashes-with-temporal.json",
 "api_version": "v1"
}
