Agent frameworks · ranked 04
Pydantic AI
Python agent framework from the Pydantic team, typed end to end.
Last reviewed
Last updated
Pydantic AI is #4 of 7 in Agent frameworks. Editorial score 7.6: Ease 7, Power 8, Price 9, Vibe-coder fit 7. Initial editorial estimate. Not a measured benchmark.
Who it is for Typed Python agents.Agent frameworks: The harness around a model.
Pydantic AI is an open-source Python library for building agents with typed inputs, outputs, and tools. It comes from the team behind Pydantic. Use it when the service is Python and you want the type checker involved. Use Mastra or the AI SDK when the service is TypeScript.
Best use cases
- Python backends that call tools
- Structured outputs you want validated
- A smaller surface than LangChain
Pros
- + Open source
- + Types are the point, which keeps tool I/O honest
- + From the Pydantic team, so it matches a stack many Python APIs already use
Who should skip it
Skip Pydantic AI when one of these listed limits is the constraint.
- − Python-only, so it is the wrong pick for a Next.js UI
- − You still design the tools and pay for the model
All comparisonsAll best-of lists
Pricing
Pydantic AI is listed as Free. Open source and free. Model fees are separate. Rates: check site.
Alternatives to Pydantic AI
Listed alternatives: Mastra, LangGraph, LangChain. Mastra is listed for “TypeScript agents you keep in your repo”. LangGraph is listed for “Agents that are workflows, not a single loop”. LangChain is listed for “A general LLM app framework with a huge ecosystem”.
Also in Agent frameworks: Vercel AI SDK, CrewAI, LlamaIndex.
Agent frameworks
8.0
Mastra
TypeScript framework for agents, workflows, and evals.
Best for TypeScript agents you keep in your repo
Agent frameworks
7.3
LangGraph
Graph-shaped agents with state, from the LangChain team.
Best for Agents that are workflows, not a single loop
Agent frameworks
6.7
LangChain
The original LLM application framework, plus a hosted LangSmith side.
Best for A general LLM app framework with a huge ecosystem
Release notes
Release historyPydantic AI 2.77.0
Released November 27, 2026. ConversationStore gains SQLite, Postgres, and MongoDB backends. SqliteConversationStore and ConversationConflict in pydantic_ai_harness.step_persistence.conversations, the Pax session-browser store, are renamed SqliteSessionStore and SessionConflict. The old names still import, with a HarnessDeprecationWarning. Skills(...) without missing_directories skips a missing, non-library, or unreadable library path instead of failing the run, with a warning for every case except a missing directory. Pass missing_directories='error' to keep failing. An unreadable skill directory or SKILL.md is skipped with a warning instead of raising PermissionError. SkipReason gains a value, so an exhaustive match on it stops type-checking. pax launched in a subdirectory can pick a different skill when two folders hold one with the same name. SkillCatalog.advice is added. On Anthropic and Claude on Bedrock, a request that sets the unified thinking setting now sends thinking.display set to summarized. Newer Claude models then return summarized thinking instead of empty thinking, which can add a little latency before the first text token. thinking_summary returns readable thinking across providers, with anthropic_thinking_display and bedrock_thinking_display. AgentStreamEvent gains CompactionStartEvent and CompactionEndEvent, emitted only when something calls request_compaction() or a compact_history hook exists, so an exhaustive match over the union stops type-checking. Agent.compact_history() compacts a message history without continuing the conversation. SubAgents no longer loads a sub-agent definition file below operator authority, such as every file in a workspace at authority none, and skips the file with a warning. A working_directory delegate's workspace is lowered to the lowest authority the parent gives that directory, and a directory outside the parent's working directory is at none unless one of the parent's path_authority entries contains it. Pax's Review specialist on another checkout now reads that checkout's AGENTS.md as data. Durable runs using SubAgents with agent_folders record one realpath per agent definition file at run start, so let in-flight runs finish, or use Temporal worker versioning or a new DBOS app version, before upgrading. Default FallbackCompaction chains recover from UnexpectedModelBehavior instead of propagating it immediately, so a failed automatic SummarizingCompaction keeps the parent run alive. The default google_api_key secret pattern also redacts AQ. followed by 40 to 200 key characters. The final stream_response() yield has state incomplete when an Anthropic, Google, or OpenAI Responses stream ends before its terminal event. Code that treats a yield whose state is not incomplete as the last yield, or treats state complete as the stream having ended, sees the difference. A fallback subagent's XSearch and ImageGeneration requests and tokens count against the run's UsageLimits, including the default request_limit of 50, so a run near a limit that used to finish can raise UsageLimitExceeded. New runs record Memory's run-start snapshot and Planning's run-start plan before the user's prompt, inside the prompt's ModelRequest, instead of in a separate ModelRequest after it. Code that looks for the snapshot at all_messages()[1], or for the prompt as the last part of its request, sees a different shape. Models see a compaction receipt as a CompactionReceiptPart instead of a UserPromptPart. Receipts already in a saved history are still recognized, and the next compaction replaces them, which moves the cached prefix once. On an AsyncAnthropicFoundry client with a supported Claude model, mid-conversation system prompts are sent as native role system entries instead of system-tagged user text, and tools revealed mid-run as tool_addition blocks. A conversation already in progress misses the prompt cache once. For Bedrock Mistral Large 3 and Ministral 3, and for Gemini after a leading text model turn, the request no longer contains the filler turn, so a conversation that was prompt-cached before the upgrade misses the cache once. With OpenAIChatModel on the OpenAI or Azure provider, a request that allows image output, such as output_type BinaryImage or a union of str and BinaryImage, raises UserError before it is sent. With OpenAIChatModel and a GPT-5.4 or GPT-5.6 model from OpenAIProvider, a request that sends tools with reasoning on raises ModelRequestRejectedError before it is sent, instead of the provider's 400 as a ModelHTTPError. An except ModelHTTPError, a check on its status_code or body, and a fallback_on that names ModelHTTPError no longer match it. The FooterField literal gains permissions, and Status.FIT_STEPS gains a step that hides it. LogfireSettings.service_name in Pax's Logfire plugin defaults to pydantic-ai-pax. A saved previous default is migrated once, and any other saved name is kept. Pax's keyring entry moves to the pydantic-ai-pax service and is copied from the old service on first read. A gh-aw workflow that imports the engine definition from main and sets its own engine version to a release from 0.59.0 to 0.72.x fails at install time, because the engine installs pydantic-ai-pax, which has no release at those versions. Raise the override to 0.73.0 or newer, or drop it. The gh-aw engine's Pax run sets PYTHON_DOTENV_DISABLED=1, so a .env file committed to the repository no longer supplies its variables. Set them with engine.env. pydantic-ai-slim requires genai-prices 0.2.4 or newer, which prices Gemini 4 Hydrogen and Carbon. The google and google-realtime extras require google-genai 2.34.0 or newer. ModelResponse.cost(), EmbeddingResult.cost(), and ImageGenerationResult.cost() raise ValueError instead of AssertionError when the model name is missing. ConversationSearch's search_conversation_history scores only the newest max_scanned_messages in-scope messages, default 2000, and says so when the cap cuts the corpus. A query over 1,000 characters or 32 unique terms raises ModelRetry. Stdio MCP servers that plain agent.run() calls start now stop once the agent and toolset go out of scope. FastMCP handlers called from a kept-alive stdio connection now see get_current_run_context() return None instead of the run that opened the connection. On FastMCP 3, or with Client mode legacy, a ConcurrencyLimiter shared between the agent and a sampling model hangs a plain run instead of raising UserError. CodeMode sandboxes can import host modules with external_modules. Model-stream events carry a ModelResponseOrigin so retried and replaced attempts can be told apart. fallback_on can take UnsupportedSettingWarning. read_file can return common video formats as files. pydantic_ai_harness.temporal, pydantic_ai_harness.dbos, and pydantic_ai_harness.prefect are the import paths for the durable engines. StructuredDict(validate=True) validates output against its JSON schema. pax -x NAME loads a plugin for one launch without saving it. A Temporal stream_agent_events() subscriber skips event kinds it does not know instead of failing the stream. The release also includes a large fix sweep for providers, compaction, MCP, sandboxes, and Pax.
Source for Pydantic AI 2.77.0 (opens in a new tab)Pydantic AI 2.76.0
Released November 26, 2026. Realtime sessions can reveal tools mid-session on models that accept tool updates, through RealtimeModelProfile.supports_tool_updates and UpdateTools. RealtimeInput, the union RealtimeConnection.send accepts, gains UpdateTools, and DEFAULT_REALTIME_PROFILE sets supports_tool_updates to False. A session sends UpdateTools only to a connection whose model's profile sets supports_tool_updates, so an existing connection never receives it, but an exhaustive match over RealtimeInput that uses assert_never stops type-checking until it handles UpdateTools or raises for it. A request to gemini-2.5-pro or gemini-2.5-flash through GoogleModel or GoogleInteractionsModel emits DeprecatedModelWarning, a UserWarning, so code that turns warnings into errors fails on those requests. Move to the replacement the warning names, or keep the model by filtering the warning or setting the profile deprecation to None. GoogleInteractionsModel adds stateless Google Interactions support. OpenSandboxBackend forwards volumes to Sandbox.create. CodeMode(allow_final_output=True) lets sandboxed code submit the run's output. Spans of nested agent runs record pydantic_ai.root_conversation_id so sub-agent cost rolls up to the outer conversation. Delegated task IDs are derived from the run and the tool call outside durable execution as well. A tool can set ui_visibility so UI adapters keep its results from the client. Anthropic's Schema is too complex 400 raises ModelSchemaTooComplexError, and an inferred Native Output schema is attempted again in Tool Output. When the client sends API version 2026-10-21, the default for anthropic 2 and later, sampling settings are dropped. A token limit that cuts off an Anthropic output tool call raises IncompleteToolCall instead of retrying. Temporal and Prefect no longer retry UsageLimitExceeded. FileSystem read_file offset is 1-indexed: an offset of N starts one line earlier than before, and an offset of 0 raises so the model can retry. Where code passed an offset of N, pass N + 1. When a capability trims history mid-run, result.conversation keeps every message the run adds. An app that carries result.conversation into the next run with SummarizingCompaction or RelevanceCompaction now has the full history summarized on each run instead of carrying the last summary. To carry the compacted history, pass result.all_messages() as message_history, saving result.conversation to a store first if the dropped messages should be kept. In UI adapters in server mode with a trimming capability, ReinjectSystemPrompt stores the run's own request with the system prompt at its head instead of a copied turn. Pax selects a word on double-click and a line on triple-click. Selection.feed, span, highlight, and text take new arguments, and a drag across a row the panel wrapped no longer copies a newline at the wrap. /computer-use adds desktop sandboxes. A Pax plugin status segment may return a StatusLink, shown as a clickable link, as well as a string. A pydantic-ai-pax extra exists for every model provider, plus all, and the Google SDK is installed by default. /update reinstalls pydantic-ai-slim with the anthropic, google, mcp, and openai extras. Pax config and state stay in pydantic-ai-pax folders. The release also includes a large fix sweep for providers, capabilities, and Pax.
Source for Pydantic AI 2.76.0 (opens in a new tab)Pydantic AI 2.75.0
Released November 25, 2026. Workspace files below operator authority no longer go into the instructions for RepoContext, Skills, and Memory. RepoContext names the working directory's file for the model to read with its file tools and sends an ancestor's file as framed data. Skills offers those skills through list_skills and load_skill instead of load_capability. Memory attributes such a snapshot to its MEMORY.md. Files at operator, the default, are unchanged. Durable runs record extra realpath workspace calls at the start, so let in-flight runs finish, or use Temporal worker versioning or a new DBOS app version, before upgrading. Empty and unreadable model responses raise ModelEmptyResponseError and ModelInvalidResponseError, and FallbackModel and ModelFallback fall back on them with the default fallback_on. Both errors subclass ModelAPIError and UnexpectedModelBehavior. An empty Mistral or OpenAI choices list raises one of them instead of AssertionError or IndexError. Pax /permissions approvals go through a token-taking HandleDeferredToolCalls handler. In a durable run on any engine but AWS Lambda, that handler raises UserError instead of asking. Pax itself behaves as before. Requests in a loaded history that have equal instructions share one string object, so compare instructions with ==. Coder with SubAgents sends the line about not spawning sub-agents unless the user or AGENTS.md asks only to models whose profile sets delegates_unprompted, OpenAI's gpt-* models other than gpt-oss, and to no model behind a FallbackModel, where Coder warns once. That line moves into its own rewrite-mode block, so the first request after upgrading misses the prompt cache. A gemini model through OpenAIProvider counts thinking tokens in output_tokens and output_reasoning_tokens, so output counts and cost rise and UsageLimits trip sooner. thinking=False on gemini-2.5-flash through the Gemini API sends thinking_budget=128 instead of 0, ahead of the reroute to gemini-3.5-flash-lite on 2026-12-01. Vertex AI and gemini-2.5-flash-lite keep 0. A capability lowered with its authority, including an MCP capability and its server instructions, sends its instructions as framed data on the user channel instead of in the system prompt. Capabilities at operator are unchanged. RunContext.submit_output() lets a tool submit the run's final output. A Temporal ExternalEventWaiter lets HandleDeferredToolCalls token handlers and AskUser wait durably in a workflow. ClearToolResults can target specific tools, keep whole user turns with keep_turns, and take a callable placeholder. AnnounceWorkingDirectory makes Shell, FileSystem, and custom tools name the working directory once. With Coder(repo_context=False) or a plain Shell or FileSystem agent, a lazily created sandbox now starts before the first request. Pax can show prompts on a grey background under a /theme palette, asks whether to trust a new folder, adds /trust and pax --version, and /sandbox is faster on large repositories. Esc stops editing a queued Pax message instead of interrupting the turn. The release also includes a large fix sweep for providers, tools, sandboxes, and Pax.
Source for Pydantic AI 2.75.0 (opens in a new tab)
Newsletter
Get the weekly AI tool shortlist
One email when rankings change or a tool ships something that matters. No spam, unsubscribe anytime.