DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to make a research agent survive crashes with Temporal with Pydantic AI

Attach TemporalDurability so the same Pydantic AI agent runs inside a durable Temporal workflow.

Short answer: Install with uv add "pydantic-ai[temporal]"; then 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. All steps.

Who it is forA team running long research or reporting agents that cannot afford to restart from scratch.

The problemA long agent run that crashes halfway loses its progress and its token spend.

The outcomeAn agent running under durable execution in Temporal, or saving and resuming steps with StepPersistence.

What you need first

  • 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

Steps

  1. Install with uv add "pydantic-ai[temporal]"
  2. Create an Agent with instructions, capabilities such as WebSearch and WebFetch, and TemporalDurability()
  3. Wrap it in a workflow class based on PydanticAIWorkflow with a run method, as in the README
  4. DBOS and Prefect attach the same way if you use those instead of Temporal
  5. Without an engine, use StepPersistence from Pydantic AI Harness to save, resume and fork runs

Prompt for your agent

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.

Caveat. You need a running Temporal setup, which the README does not cover; see the Durable Execution docs.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for pydantic/pydantic-ai and "Make a research agent survive crashes with Temporal"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer