The outcome

Resume long-running agents after failure without silently duplicating side effects or accepting regressions in behavior.

Pydantic AI is a Python agent framework for typed dependencies, validated tools and outputs, model portability, evaluation, observability, and durable execution. Building Python agents with strongly typed inputs, dependencies, tools, and outputs, then evaluating and running them with explicit token, request, tool, concurrency, and durability controls. This guide narrows that broad capability into one repeatable outcome, with checkpoints that keep the source material and your judgment in the loop.

Before you begin

Set the boundary before the tool starts.

Choose one real task, identify who will use the result, and decide what evidence or test will make the result acceptable. Gather only the source material needed for that task. If the work contains confidential, personal, regulated, or client-owned information, confirm that the platform and account are approved before sharing it.

Troiana principle

AI should make the work easier to inspect. If the workflow removes the source, the owner, or the review step, redesign the workflow.

Step by step

A workflow you can repeat.

  1. 01

    Select Temporal, DBOS, Prefect, Restate, or another documented integration by runtime needs, then define durable units, stable IDs, determinism, retention, retries, approvals, and recovery objectives.

  2. 02

    Pin the agent and toolset identities, move nondeterministic I/O into checkpointed activities or tasks, use idempotency keys for effects, and encrypt state and credentials with least privilege.

  3. 03

    Create a versioned eval dataset covering final outputs and tool trajectories, deterministic invariants, safety, permissions, cost, and known failure examples from development and production.

  4. 04

    Test worker crash, provider timeout, retry, replay, changed code, duplicate effect, toolset-ID collision, long pause, cancellation, key rotation, migration, and the integration's documented limitations.

  5. 05

    Gate releases on eval and recovery thresholds, compare traces with production, canary workflow versions, retain compatible workers and rollback, and rehearse state deletion and incident response.

Working standard

What good use looks like.

  • Give durable toolsets stable IDs.
  • Checkpoint nondeterministic operations.
  • Evaluate trajectories, not only answers.

Pydantic validation confirms declared types and constraints, not factual correctness, permission, provenance, or harmless side effects. Model-generated tool calls remain untrusted. Enforce current user and tenant authorization inside tools, cap requests, tokens and calls, set timeouts and concurrency, use idempotency for writes, redact telemetry, test replay semantics, and account for integration-specific durability and retry limitations.

Official references

Check the current product documentation.

Features, plan limits, availability, and data controls change. These official pages are the starting points used for this collection.