85 agentic tools audited for security incidents · Talk to the lab →
MotionticBook a call
Compare

Pydantic AI vs LangGraph: typed agents or an explicit graph

Pydantic AI is a type-safe Python agent framework built around capabilities, with durable execution through engines such as Temporal and DBOS and OpenTelemetry tracing, while LangGraph is an explicit state-graph runtime in Python and TypeScript, so Pydantic AI fits code-first agents with structured outputs and LangGraph fits workflows whose control flow needs to be drawn as a graph.

Checked

Pydantic AI v2 shipped on 23 June 2026 and changed the framework's core: capabilities became the main primitive, and memory, guardrails and code mode moved into a separate Pydantic AI Harness. Comparisons written before v2 describe a different framework.

LangGraph takes the opposite starting point. The agent is a graph whose nodes and edges are declared explicitly, with persistence and human approval built into the runtime. The choice is mostly about where a team wants control flow to live: in ordinary typed Python, or in a graph.

What changed in Pydantic AI v2

  • Capabilities

    Capabilities became the core primitive of an agent.

  • Harness split

    Memory, guardrails and code mode moved to a separate Pydantic AI Harness.

  • Providers

    Non-frontier providers are now opt-in, and openai: models use the Responses API.

  • Release cadence

    The no-breaking-changes window between majors shrank from six months to three, after v1 in September 2025.

Durability and observability

  • Pydantic AI

    Durable execution through Temporal, DBOS, Prefect, Restate, AWS Lambda, Absurd, pgtask and Apache Airflow. Built-in OpenTelemetry instrumentation following the GenAI semantic conventions, sent to Pydantic Logfire or any OpenTelemetry-compatible backend.

  • LangGraph

    Durable execution and persistence in the runtime itself, human-in-the-loop editing of state, and debugging through LangSmith.

Which fits which job

  • Pydantic AI fits

    Python teams that already use Pydantic and FastAPI, agents whose outputs must validate against a schema, and teams that want tracing on an open standard.

  • LangGraph fits

    Multi-step workflows with branches, retries and approval points, and teams that need the same runtime in TypeScript.

How Motiontic approaches it

Motiontic's engineers are framework-neutral. They choose per project after a short spike on the client's real task, keep prompts, tool definitions and evals outside the framework so a later switch is a refactor rather than a rewrite, and hand the eval suite to the client's team so the next framework decision can be measured.

Pydantic AI and LangGraph, figures retrieved 30 October 2026

Pydantic AI and LangGraph, figures retrieved 30 October 2026
Pydantic AILangGraph
Core modelTyped agents built from capabilitiesExplicit graph of nodes over shared state
LicenceMITMIT
LanguagesPythonPython, JavaScript / TypeScript
Latest version2.63.0 (28 Oct 2026); 2.0 on 23 Jun 20261.2.18 (26 Oct 2026); 1.0 on 17 Oct 2025
Durable executionVia Temporal, DBOS, Prefect, Restate and othersBuilt into the runtime
ObservabilityOpenTelemetry; Logfire or any OTel backendLangSmith
A2A supportListed as an adopterListed as an adopter
GitHub stars20,95944,172 (Python repo)
PyPI downloads, last week1.71M (pydantic-ai)13.76M

Common questions

What changed in Pydantic AI v2?

Released on 23 June 2026, v2 made capabilities the core primitive, moved memory, guardrails and code mode into a separate Pydantic AI Harness, made non-frontier providers opt-in and switched openai: models to the Responses API.

Does Pydantic AI support durable execution?

Yes, through external engines. Its docs list Temporal, DBOS, Prefect, Restate, AWS Lambda, Absurd, pgtask and Apache Airflow.

Does Pydantic AI require Logfire?

No. Logfire support is optional. Pydantic AI follows the OpenTelemetry semantic conventions for generative AI and can send traces to any OpenTelemetry-compatible backend.

Is Pydantic AI simpler than LangGraph?

For a single agent with typed outputs, usually yes, because control flow stays in ordinary Python. For a workflow with many branches and approval steps, LangGraph's explicit graph can be easier to reason about.

Running agents that have to hold up?

Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.