freshcrate
Skin:/
Home > Frameworks > pydantic-ai

pydantic-ai

AI Agent Framework, the Pydantic way

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

AI Agent Framework, the Pydantic way

README

GenAI Agent Framework, the Pydantic way

CI Coverage PyPI versions license Join Slack

Documentation: ai.pydantic.dev


Pydantic AI is a Python agent framework designed to help you quickly, confidently, and painlessly build production grade applications and workflows with Generative AI.

FastAPI revolutionized web development by offering an innovative and ergonomic design, built on the foundation of Pydantic Validation and modern Python features like type hints.

Yet despite virtually every Python agent framework and LLM library using Pydantic Validation, when we began to use LLMs in Pydantic Logfire, we couldn't find anything that gave us the same feeling.

We built Pydantic AI with one simple aim: to bring that FastAPI feeling to GenAI app and agent development.

Why use Pydantic AI

  1. Built by the Pydantic Team: Pydantic Validation is the validation layer of the OpenAI SDK, the Google ADK, the Anthropic SDK, LangChain, LlamaIndex, AutoGPT, Transformers, CrewAI, Instructor and many more. Why use the derivative when you can go straight to the source? 😃

  2. Model-agnostic: Supports virtually every model and provider: OpenAI, Anthropic, Gemini, DeepSeek, Grok, Cohere, Mistral, and Perplexity; Azure AI Foundry, Amazon Bedrock, Google Vertex AI, Ollama, LiteLLM, Groq, OpenRouter, Together AI, Fireworks AI, Cerebras, Hugging Face, GitHub, Heroku, Vercel, Nebius, OVHcloud, Alibaba Cloud, SambaNova, and Outlines. If your favorite model or provider is not listed, you can easily implement a custom model.

  3. Seamless Observability: Tightly integrates with Pydantic Logfire, our general-purpose OpenTelemetry observability platform, for real-time debugging, evals-based performance monitoring, and behavior, tracing, and cost tracking. If you already have an observability platform that supports OTel, you can use that too.

  4. Fully Type-safe: Designed to give your IDE or AI coding agent as much context as possible for auto-completion and type checking, moving entire classes of errors from runtime to write-time for a bit of that Rust "if it compiles, it works" feel.

  5. Powerful Evals: Enables you to systematically test and evaluate the performance and accuracy of the agentic systems you build, and monitor the performance over time in Pydantic Logfire.

  6. Extensible by Design: Build agents from composable capabilities that bundle tools, hooks, instructions, and model settings into reusable units. Use built-in capabilities for web search, thinking, and MCP, pick from the Pydantic AI Harness capability library, build your own, or install third-party capability packages. Define agents entirely in YAML/JSON — no code required.

  7. MCP, A2A, and UI: Integrates the Model Context Protocol, Agent2Agent, and various UI event stream standards to give your agent access to external tools and data, let it interoperate with other agents, and build interactive applications with streaming event-based communication.

  8. Human-in-the-Loop Tool Approval: Easily lets you flag that certain tool calls require approval before they can proceed, possibly depending on tool call arguments, conversation history, or user preferences.

  9. Durable Execution: Enables you to build durable agents that can preserve their progress across transient API failures and application errors or restarts, and handle long-running, asynchronous, and human-in-the-loop workflows with production-grade reliability.

  10. Streamed Outputs: Provides the ability to stream structured output continuously, with immediate validation, ensuring real time access to generated data.

  11. Graph Support: Provides a powerful way to define graphs using type hints, for use in complex applications where standard control flow can degrade to spaghetti code.

Realistically though, no list is going to be as convincing as giving it a try and seeing how it makes you feel!

Hello World Example

Here's a minimal example of Pydantic AI:

from pydantic_ai import Agent

# Define a very simple agent including the model to use, you can also set the model when running the agent.
agent = Agent(
    'anthropic:claude-sonnet-4-6',
    # Register static instructions using a keyword argument to the agent.
    # For more complex dynamically-generated instructions, see the example below.
    instructions='Be concise, reply with one sentence.',
)

# Run the agent synchronously, conducting a conversation with the LLM.
result = agent.run_sync('Where does "hello world" come from?')
print(result.output)
"""
The first known use of "hello, world" was in a 1974 textbook about the C programming language.
"""

(This example is complete, it can be run "as is", assuming you've installed the pydantic_ai package)

The exchange will be very short: Pydantic AI will send the instructions and the user prompt to the LLM, and the model will return a text response.

Not very interesting yet, but we can easily add tools, dynamic instructions, structured outputs, or composable capabilities to build more powerful agents.

Here's the same agent with thinking and web search capabilities:

from pydantic_ai import Agent
from pydantic_ai.capabilities import Thinking, WebSearch

agent = Agent(
    'anthropic:claude-sonnet-4-6',
    instructions='Be concise, reply with one sentence.',
    capabilities=[Thinking(), WebSearch()],
)

result = agent.run_sync('What was the mass of the largest meteorite found this year?')
print(result.output)

Tools & Dependency Injection Example

Here is a concise example using Pydantic AI to build a support agent for a bank:

(Better documented example in the docs)

from dataclasses import dataclass

from pydantic import BaseModel, Field
from pydantic_ai import Agent, RunContext

from bank_database import DatabaseConn


# SupportDependencies is used to pass data, connections, and logic into the model that will be needed when running
# instructions and tool functions. Dependency injection provides a type-safe way to customise the behavior of your agents.
@dataclass
class SupportDependencies:
    customer_id: int
    db: DatabaseConn


# This Pydantic model defines the structure of the output returned by the agent.
class SupportOutput(BaseModel):
    support_advice: str = Field(description='Advice returned to the customer')
    block_card: bool = Field(description="Whether to block the customer's card")
    risk: int = Field(description='Risk level of query', ge=0, le=10)


# This agent will act as first-tier support in a bank.
# Agents are generic in the type of dependencies they accept and the type of output they return.
# In this case, the support agent has type `Agent[SupportDependencies, SupportOutput]`.
support_agent = Agent(
    'openai:gpt-5.2',
    deps_type=SupportDependencies,
    # The response from the agent will, be guaranteed to be a SupportOutput,
    # if validation fails the agent is prompted to try again.
    output_type=SupportOutput,
    instructions=(
        'You are a support agent in our bank, give the '
        'customer support and judge the risk level of their query.'
    ),
)


# Dynamic instructions can make use of dependency injection.
# Dependencies are carried via the `RunContext` argument, which is parameterized with the `deps_type` from above.
# If the type annotation here is wrong, static type checkers will catch it.
@support_agent.instructions
async def add_customer_name(ctx: RunContext[SupportDependencies]) -> str:
    customer_name = await ctx.deps.db.customer_name(id=ctx.deps.customer_id)
    return f"The customer's name is {customer_name!r}"


# The `tool` decorator let you register functions which the LLM may call while responding to a user.
# Again, dependencies are carried via `RunContext`, any other arguments become the tool schema passed to the LLM.
# Pydantic is used to validate these arguments, and errors are passed back to the LLM so it can retry.
@support_agent.tool
async def customer_balance(
        ctx: RunContext[SupportDependencies], include_pending: bool
) -> float:
    """Returns the customer's current account balance."""
    # The docstring of a tool is also passed to the LLM as the description of the tool.
    # Parameter descriptions are extracted from the docstring and added to the parameter schema sent to the LLM.
    balance = await ctx.deps.db.customer_balance(
        id=ctx.deps.customer_id,
        include_pending=include_pending,
    )
    return balance


...  # In a real use case, you'd add more tools and a longer system prompt


async def main():
    deps = SupportDependencies(customer_id=123, db=DatabaseConn())
    # Run the agent asynchronously, conducting a conversation with the LLM until a final response is reached.
    # Even in this fairly simple case, the agent will exchange multiple messages with the LLM as tools are called to retrieve an output.
    result = await support_agent.run('What is my balance?', deps=deps)
    # The `result.output` will be validated with Pydantic to guarantee it is a `SupportOutput`. Since the agent is generic,
    # it'll also be typed as a `SupportOutput` to aid with static type checking.
    print(result.output)
    """
    support_advice='Hello John, your current account balance, including pending transactions, is $123.45.' block_card=False risk=1
    """

    result = await support_agent.run('I just lost my card!', deps=deps)
    print(result.output)
    """
    support_advice="I'm sorry to hear that, John. We are temporarily blocking your card to prevent unauthorized transactions." block_card=True risk=8
    """

Next Steps

To try Pydantic AI for yourself, install it and follow the instructions in the examples.

Read the docs to learn more about building applications with Pydantic AI.

Read the API Reference to understand Pydantic AI's interface.

Join Slack or file an issue on GitHub if you have any questions.

Release History

VersionChangesUrgencyDate
v1.106.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Map base `seed` setting to xAI by @colesmcintosh in https://github.com/pydantic/pydantic-ai/pull/5741 * Add `api_host` and `timeout` to `XaiProvider` by @colesmcintosh in https://github.com/pydantic/pydantic-ai/pull/5742 ### 🐛 Bug Fixes * Fix incomplete streamed response when `event_stream_handler` doesn't consume the stream by @adtyavrdhn in https://github.com/pydantic/pydanHigh6/5/2026
v1.104.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add Claude Opus 4.8 support by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/5709 ### 🐛 Bug Fixes * Forward `thinking=False` on hybrid OpenRouter/xAI/Bedrock routes, aligning silent-drop with direct routes by @sarth6 in https://github.com/pydantic/pydantic-ai/pull/5433 * Fix Bedrock single-tool `tool_choice` cache preservation by @dsfaccini in https://github.com/High5/29/2026
v1.102.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### đŸ›Ąī¸ Security * Expand IPv6 transition-form handling in URL validation by @DouweM in https://github.com/pydantic/pydantic-ai/pull/5596 * Security advisory: SSRF cloud-metadata blocklist bypass via additional IPv6 transition forms https://github.com/pydantic/pydantic-ai/security/advisories/GHSA-cg7w-rg45-pc59 * You are affected **only** if your application explicitly opts a `FileUrl` High5/23/2026
v1.98.0<!-- Release notes generated using configuration in .github/release.yml at v1.98.0 --> ## What's Changed ### 🚀 Features * Add OpenAI Responses input token counting (`OpenAIResponsesModel.count_tokens`) by @colesmcintosh in https://github.com/pydantic/pydantic-ai/pull/3951 * Replace `Agent` `tool_retries=`/`output_retries=` with `retries: int | AgentRetries` by @Kludex in https://github.com/pydantic/pydantic-ai/pull/5500 ### 🐛 Bug Fixes * fix(mcp): Don't require `fastmcp.server` at runtHigh5/19/2026
v1.95.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * feat: native Tool Search on Anthropic and OpenAI, with custom search strategies on any provider by @DouweM in https://github.com/pydantic/pydantic-ai/pull/5143 * Add `Instrumentation` capability; deprecate `Agent(instrument=...)` by @DouweM in https://github.com/pydantic/pydantic-ai/pull/4967 * feat(google): support structured output + tool combination for Gemini 3 by @dHigh5/13/2026
v1.91.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * feat(openai): support `gpt-image-2` options by @banteg in https://github.com/pydantic/pydantic-ai/pull/5234 * feat(deepseek): add support for `deepseek-v4-flash` and`deepseek-v4-pro` by @SuperMarioYL in https://github.com/pydantic/pydantic-ai/pull/5195 ### 🐛 Bug Fixes * fix(evals): preserve Unicode in YAML datasets by @Kcstring in https://github.com/pydantic/pydanticHigh5/7/2026
v1.89.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * feat: add `conversation_id` for cross-run correlation by @DouweM in https://github.com/pydantic/pydantic-ai/pull/5251 * feat(capabilities): support dynamic capabilities via callables in capabilities list by @DouweM in https://github.com/pydantic/pydantic-ai/pull/5252 * feat: add `builtin_tools` to `agent.override` by @mplemay in https://github.com/pydantic/pydantic-ai/puHigh5/1/2026
v1.87.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add `HandleDeferredToolCalls` capability and `handle_deferred_tool_calls` hook by @DouweM in https://github.com/pydantic/pydantic-ai/pull/5142 * Add `ProcessEventStream` capability by @DouweM in https://github.com/pydantic/pydantic-ai/pull/5141 * Handle thinking setting for GPT-5.5 by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/5196 **Full Changelog**High4/25/2026
v1.85.1<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🐛 Bug Fixes * fix: exclude validation error `input` from retry messages by @navalprakhar in https://github.com/pydantic/pydantic-ai/pull/4947 * fix(vercel-ai): auto-detect deferred tool approval state in `dump_messages()` by @tijmenhammer in https://github.com/pydantic/pydantic-ai/pull/4831 ## New Contributors * @abhicris made their first contribution in https://github.com/pydantiHigh4/21/2026
v1.85.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Online evaluation via OpenTelemetry events by @dmontagu in https://github.com/pydantic/pydantic-ai/pull/5125 **Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v1.84.1...v1.85.0High4/21/2026
v1.84.1<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🐛 Bug Fixes * Skip tool hooks for internal output tools by @DouweM in https://github.com/pydantic/pydantic-ai/pull/5128 * Always pass `dict`-shaped validated args to hooks for single-`BaseModel` tools by @DouweM in https://github.com/pydantic/pydantic-ai/pull/5137 **Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v1.84.0...v1.84.1High4/18/2026
v1.84.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### :lock: Security * Fix exponential-time regex in Google `FileSearchTool` response parsing by @DouweM in #5106. This was first released in yesterday's v1.83.0. The pattern was reachable in principle from Gemini streaming responses but could not be triggered via real Gemini output in testing, so we're treating it as a hardening fix rather than a vulnerability. ### 🚀 Features * Add ClaudHigh4/17/2026
v1.83.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## 🤖 [Pydantic AI Harness](https://github.com/pydantic/pydantic-ai-harness) is now live with [**Code Mode**](https://github.com/pydantic/pydantic-ai-harness/tree/main/pydantic_ai_harness/code_mode) powered by [Monty](https://github.com/pydantic/monty)! ## What's Changed ### 🚀 Features * feat: Add `XSearchTool` and `FileSearch` support for xAI by @colesmcintosh in https://github.com/pydantic/pydantic-ai/High4/16/2026
v1.82.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## 🤖 [Pydantic AI Harness](https://github.com/pydantic/pydantic-ai-harness) is now live with [**Code Mode**](https://github.com/pydantic/pydantic-ai-harness/tree/main/pydantic_ai_harness/code_mode) powered by [Monty](https://github.com/pydantic/monty)! ## What's Changed ### 🐛 Bug Fixes * Fix OpenAI compaction chain when `openai_previous_response_id='auto'` by @DouweM in https://github.com/pydantic/pydHigh4/15/2026
v1.81.0<!-- Release notes generated using configuration in .github/release.yml at main --> 🤖 [Pydantic AI Harness](https://github.com/pydantic/pydantic-ai-harness) is now live with [**Code Mode**](https://github.com/pydantic/pydantic-ai-harness/tree/main/pydantic_ai_harness/code_mode) powered by [Monty](https://github.com/pydantic/monty)! ## What's Changed ### 🐛 Bug Fixes * Fix Anthropic compaction usage totals by @pandego in https://github.com/pydantic/pydantic-ai/pull/5068 * Exclude `run_iHigh4/14/2026
v1.80.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add `CapabilityOrdering` (`innermost`, `outermost`, `wraps`, wrapped_by`, `requires`) by @DouweM in https://github.com/pydantic/pydantic-ai/pull/5036 * `Hooks` ordering parameter and instance refs in `wraps`/`wrapped_by` by @DouweM in https://github.com/pydantic/pydantic-ai/pull/5048 * Add server-side compaction support via `OpenAICompaction` and `AnthropicCompaction` caHigh4/10/2026
v1.79.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Full support for AG-UI 0.1.13 and 0.1.15: reasoning, multi-modal, `dump_messages` by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/3971 * Replace HTTP client cache with `create_async_http_client` and context manager by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/4421 * Add `apply()` to `AbstractCapability`, `CombinedCapability`, and `WrapperCaMedium4/10/2026
v1.78.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add cached token span attributes per OTel spec by @alexmojaki in https://github.com/pydantic/pydantic-ai/pull/5013 * feat: add `return_schema` and `function_signature` to `ToolDefinition` by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/4964 * feat: add `SetToolMetadata` capability by @DouweM in https://github.com/pydantic/pydantic-ai/pull/4964 ## New CoHigh4/8/2026
v1.77.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * feat: add local `WebFetch` tool and have `WebFetch` capability use it when provider lacks builtin support by @DEENUU1 in https://github.com/pydantic/pydantic-ai/pull/4906 * Add `defer_loading` to tools and toolsets to enable tool search by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/4090 * Add `ThreadExecutor` capability and `Agent.using_thread_executor()`Medium4/3/2026
v1.76.0## What's Changed ### 🚀 Features * Have `ImageGeneration` capability auto-fallback to subagent with imagegen model if main model lacks imagegen by @DouweM in https://github.com/pydantic/pydantic-ai/pull/4910 * Add `agent` to `RunContext` by @DouweM in https://github.com/pydantic/pydantic-ai/pull/4922 ### 🐛 Bug Fixes * Include `gen_ai.operation.name` span attribute in agent runs by @adriangb in https://github.com/pydantic/pydantic-ai/pull/4936 ### đŸ“Ļ Dependencies * Update Mistral integraMedium4/2/2026
v1.75.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Feat(embeddings): types and limits for gemini-embedding-2-preview by @yorickvP in https://github.com/pydantic/pydantic-ai/pull/4874 * Implement support for Flex PayGo with VertexAI by @ewjoachim in https://github.com/pydantic/pydantic-ai/pull/4312 ### 🐛 Bug Fixes * Stop stripping TTL from cache control for Bedrock clients by @fuyi in https://github.com/pydantic/pydantiMedium4/1/2026
v1.74.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * feat: online evaluation infrastructure for pydantic-evals by @dmontagu in https://github.com/pydantic/pydantic-ai/pull/4782 * feat: Add `TextContent` for user prompts with `metadata` not sent to model by @thisisarko in https://github.com/pydantic/pydantic-ai/pull/4432 * Make run ID time-sortable; add agent name and run ID span attrs to all agent run child spans by @adriaMedium3/31/2026
v1.73.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * feat: add `CaseLifecycle` hooks to `Dataset.evaluate` by @dmontagu in https://github.com/pydantic/pydantic-ai/pull/4854 * Allow hooks to raise `ModelRetry` for retry control flow by @DouweM in https://github.com/pydantic/pydantic-ai/pull/4858 * Allow before/wrap model request hooks to swap the model via `ModelRequestContext` by @DouweM in https://github.com/pydantic/pydaMedium3/27/2026
v1.72.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * feat: add `anthropic_eager_input_streaming` to `AnthropicModelSettings` by @moe9195 in https://github.com/pydantic/pydantic-ai/pull/4842 * Support sync tool preparation functions by @DouweM in https://github.com/pydantic/pydantic-ai/pull/4846 * Don't require explicit `url=` on `MCP` capability, in Python or `AgentSpec` by @DouweM in https://github.com/pydantic/pydantic-aMedium3/26/2026
v1.71.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add [Capabilities](https://ai.pydantic.dev/capabilities/): composable, reusable units of agent behavior that bundle tools, lifecycle hooks, instructions, and model settings into a single class you plug into any agent by @DouweM in https://github.com/pydantic/pydantic-ai/pull/4640 * Add [`AgentSpec`](https://ai.pydantic.dev/agent-spec/) and `Agent.from_file` for loading agMedium3/24/2026
v1.70.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add `bedrock_inference_profile` to BedrockModelSettings and BedrockEmbeddingSettings by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/4697 ### 🐛 Bug Fixes * fix: OpenRouter Anthropic model profile matching for dotted model numbers by @majdalsado in https://github.com/pydantic/pydantic-ai/pull/4690 * fix: always pass `embedding_types` to Cohere `embed()` toLow3/18/2026
v1.69.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add `description` parameter to `Agent` and set `gen_ai.agent.description` on span by @Kludex in https://github.com/pydantic/pydantic-ai/pull/4677 * Send multimodal tool results to APIs directly instead of splitting into user parts by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/3826 * Add response-based fallback support for `FallbackModel` by @sarth6 in httLow3/17/2026
v1.68.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### Changes * Remove redundant `running tools` parent span by @Kludex in #4560 ### 🐛 Bug Fixes * fix(openai): thinking detection for `gpt-5.3-chat-latest` by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/4567 * fix: AG-UI follow-up messages failing after built-in tool use by @gcheshkov in https://github.com/pydantic/pydantic-ai/pull/4624 ### đŸ“Ļ Dependencies * fix: remediaLow3/13/2026
v1.67.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add GPT-5.4 support by @theadityarao in https://github.com/pydantic/pydantic-ai/pull/4554 * Support `WebSearchTool` for `OpenRouterModel` through OpenRouter plugins by @mochow13 in https://github.com/pydantic/pydantic-ai/pull/4022 * Rehaul Tavily search tool by @sarth6 in https://github.com/pydantic/pydantic-ai/pull/4158 * Enable native structured output support for OllLow3/6/2026
v1.66.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Enable native structured output for Qwen 3.5 models by @ggozad in https://github.com/pydantic/pydantic-ai/pull/4534 * Add Nano Banana 2 (`gemini-3.1-flash-image-preview`) by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/4525 ### 🐛 Bug Fixes * Fix builtin tool availability checking when using `TemporalAgent` with multiple models by @mattbrandman in https:/Low3/5/2026
v1.65.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Support files uploaded to providers via new `UploadedFile` object by @mattbrandman in https://github.com/pydantic/pydantic-ai/pull/3942 * feat: add `gemini-3.1-flash-lite-preview` model by @rian-dolphin in https://github.com/pydantic/pydantic-ai/pull/4517 ### 🐛 Bug Fixes * fix: add `__reduce__` to exception classes for pickle support by @OiPunk in https://github.com/pyLow3/3/2026
v1.64.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * feat: support `template=False` on `PromptedOutput` and `NativeOutput` to disable schema prompt by @DouweM in https://github.com/pydantic/pydantic-ai/pull/4497 ### 🐛 Bug Fixes * Fix missing `run_id` on `ModelRequest` in UI adapter runs by @madanlalit in https://github.com/pydantic/pydantic-ai/pull/4419 * Wrap Google streaming errors as `ModelHTTPError`/`ModelAPIError` bLow3/2/2026
v1.63.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add Gemini 3.1 Pro Preview support by @majdalsado in https://github.com/pydantic/pydantic-ai/pull/4372 * feat(gemini): Logprob Support by @DRXD1000 in https://github.com/pydantic/pydantic-ai/pull/4269 * Add `args_validator` parameter to tools for pre-execution validation by @jerry-reevo in https://github.com/pydantic/pydantic-ai/pull/4016 ### 🐛 Bug Fixes * Fix TemporLow2/23/2026
v1.62.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add tool approval integration for Vercel AI adapter by @bendrucker in https://github.com/pydantic/pydantic-ai/pull/3772 * Add LinePlot analysis type, ROCAUCEvaluator, and KolmogorovSmirnovEvaluator by @dmontagu in https://github.com/pydantic/pydantic-ai/pull/4356 ### 🐛 Bug Fixes * Fix missing pages in llms.txt and llms-full.txt by @DouweM in https://github.com/pydanticLow2/19/2026
v1.61.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Support Python 3.14 by @Kludex in https://github.com/pydantic/pydantic-ai/pull/4138 ### đŸ“Ļ Dependencies * Upgrade anthropic to 0.80.0, add Claude Sonnet 4.6 by @DouweM in https://github.com/pydantic/pydantic-ai/pull/4345 **Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v1.60.0...v1.61.0Low2/18/2026
v1.60.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add ‍`video_url` support to `OpenRouterModel` by @Adversarian in https://github.com/pydantic/pydantic-ai/pull/3824 * Add instrumentation version 4 to match OTel GenAI semantic conventions for multimodal input by @admackin in https://github.com/pydantic/pydantic-ai/pull/4219 ### 🐛 Bug Fixes * Fix AG-UI `parent_message_id` for back-to-back builtin tool calls by @DouweM iLow2/17/2026
v1.59.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add `Model.model_id` property that returns `provider:model` by @tdevelope in https://github.com/pydantic/pydantic-ai/pull/3917 * Add opt-in flag for aggregated usage attribute names by @thiagohora in https://github.com/pydantic/pydantic-ai/pull/4277 * Enhance `Contains` evaluator to support `pydantic.BaseModel` by @tomsquest in https://github.com/pydantic/pydantic-ai/pulLow2/14/2026
v1.58.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Report-level evaluators & experiment-wide analyses by @dmontagu in https://github.com/pydantic/pydantic-ai/pull/4243 * Add multi-run aggregation support (repeat parameter) to pydantic-evals by @dmontagu in https://github.com/pydantic/pydantic-ai/pull/4253 * Add `extra_headers` support for Google model provider by @saakshigupta2002 in https://github.com/pydantic/pydantic-Low2/11/2026
v1.57.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🐛 Bug Fixes * Fix A2A FilePart base64 decoding for image/file uploads by @Red5d in https://github.com/pydantic/pydantic-ai/pull/4181 ## New Contributors * @Mr-Neutr0n made their first contribution in https://github.com/pydantic/pydantic-ai/pull/4208 * @Tamles made their first contribution in https://github.com/pydantic/pydantic-ai/pull/4257 * @Red5d made their first contribution Low2/10/2026
v1.56.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add Claude Opus 4.6, `anthropic_effort` and `anthropic_thinking.type='adaptive'` by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/4216 * Add `anthropic_betas` to `AnthropicModelSettings` by @bohdanhr in https://github.com/pydantic/pydantic-ai/pull/4180 ### 🐛 Bug Fixes * Fix Bedrock `CachePoint` placement with multiple trailing documents by @psg2 in https:/Low2/6/2026
v1.55.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🐛 Bug Fixes * Fix error when using `OpenAIResponsesModel` with "compatible" provider that returns `reasoning_tokens` as `None` instead by @alibeyram in https://github.com/pydantic/pydantic-ai/pull/4151 * Fix `MultiModalContent` union missing discriminator causing incorrect deserialization by @jerry-reevo in https://github.com/pydantic/pydantic-ai/pull/4191 **Full Changelog**: httLow2/5/2026
v1.54.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add concurrency limiting for Agents and Models by @dmontagu in https://github.com/pydantic/pydantic-ai/pull/4149 **Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v1.53.0...v1.54.0Low2/4/2026
v1.53.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Infer gateway base URL from token region by @Kludex in https://github.com/pydantic/pydantic-ai/pull/4192 **Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v1.52.0...v1.53.0Low2/4/2026
v1.52.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add `openai_store` setting to control data retention by @EliMeed in https://github.com/pydantic/pydantic-ai/pull/4142 * Add number of output validation retries to agent's run context by @coccoinomane in https://github.com/pydantic/pydantic-ai/pull/4084 * Have `OpenAIChatModel` send back reasoning content via field it's received in by @safina57 in https://github.com/pydanLow2/3/2026
v1.51.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * feat(ui): Add `html_source` parameter to customize Chat UI source by @madanlalit in https://github.com/pydantic/pydantic-ai/pull/3974 ### 🐛 Bug Fixes * Fix error when Gemini calls tools in agent run with instructions but no user prompt by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/4148 * Fix Bedrock caching when user message ended on non-text content byLow1/31/2026
v1.50.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Expose `usage_limits` and `model_settings` to users running with `to_cli()` by @tommy-waltmann in https://github.com/pydantic/pydantic-ai/pull/4133 * Add setting to include OpenAI raw text annotations in `TextPart.provider_details` by @corytomlinson in https://github.com/pydantic/pydantic-ai/pull/3787 ### 🐛 Bug Fixes * Fix serialization of `BinaryContent` returned by tLow1/29/2026
v1.49.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Support parallel tool calls in `DBOSAgent` by @qianl15 in https://github.com/pydantic/pydantic-ai/pull/4077 * Add `BedrockEmbeddingModel` for Nova, Cohere and Titan endpoints by @bitnahian in https://github.com/pydantic/pydantic-ai/pull/4008 * Match Vercel AI SDK types with AI SDK v6 by @bendrucker in https://github.com/pydantic/pydantic-ai/pull/4127 **Full ChangeloLow1/29/2026
v1.48.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add `allowed_domains` support for `WebSearchTool` with OpenAI by @eduardojdiniz in https://github.com/pydantic/pydantic-ai/pull/4037 * Add `continuous_usage_stats` model setting for OpenAI by @kousun12 in https://github.com/pydantic/pydantic-ai/pull/4056 * Apply `model_settings` to Mistral streaming JSON mode by @Goldokpa in https://github.com/pydantic/pydantic-ai/pull/4Low1/27/2026
v1.47.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Ensure thought signatures and other provider metadata survive a round trip through a Vercel AI frontend by @Light2Dark in https://github.com/pydantic/pydantic-ai/pull/3754 ## New Contributors * @Light2Dark made their first contribution in https://github.com/pydantic/pydantic-ai/pull/3754 **Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v1.46.0...vLow1/24/2026
v1.46.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add `XaiModel` that uses the xAI SDK and deprecate `GrokProvider` that used the OpenAI-compatible API by @brightsparc in https://github.com/pydantic/pydantic-ai/pull/3400 * Bump `mcp` and other dependencies for Dependabot alerts by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/4047 ## New Contributors * @brightsparc made their first contribution in https:Low1/22/2026
v1.45.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * VoyageAI embeddings support by @ggozad in https://github.com/pydantic/pydantic-ai/pull/3856 ### 🐛 Bug Fixes * Update the default behavior for `OpenRouter` from downloading `DocumentUrl`s and sending them as bytes, to sending them as URLs by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/3997 * fix(google): Set timeout in `HttpOptions` to prevent requests haLow1/22/2026
v1.44.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * feat: Add Exa search tools integration by @10ishq in https://github.com/pydantic/pydantic-ai/pull/3736 * Add support for Bedrock Nova 2.0 built-in `Code Interpreter` tool by @gmetzker in https://github.com/pydantic/pydantic-ai/pull/3892 ### 🐛 Bug Fixes * Make `count_tokens()` work on `WrapperModel` by @DouweM in https://github.com/pydantic/pydantic-ai/pull/3982 ## NLow1/17/2026
v1.43.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Support Google embedding models by @tboser in https://github.com/pydantic/pydantic-ai/pull/3841 ### 🐛 Bug Fixes * Fix OpenAI never populating `dict[str, ...]` tool args by @hinnefe2 in https://github.com/pydantic/pydantic-ai/pull/3712 **Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v1.42.0...v1.43.0Low1/15/2026
v1.42.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add SambaNova provider support by @Pavanmanikanta98 in https://github.com/pydantic/pydantic-ai/pull/3887 * Consistently raise `ContentFilterError` when model response is empty because of content filter by @AlanPonnachan in https://github.com/pydantic/pydantic-ai/pull/3634 * Bump google-genai to 1.56.0 by @petersli in https://github.com/pydantic/pydantic-ai/pull/3782 * ALow1/14/2026
v1.41.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add YAML and TOML media type support in `BinaryContent.from_path` by @majiayu000 in https://github.com/pydantic/pydantic-ai/pull/3907 * Add `metadata` support for `DeferredToolResults` by @Wh1isper in https://github.com/pydantic/pydantic-ai/pull/3811 ### 🐛 Bug Fixes * Don't raise error when Mistral returns `ReferenceChunk` by @ilancoulon in https://github.com/pydantic/Low1/10/2026
v1.40.0<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Set human-readable Temporal activity summaries by @DouweM in https://github.com/pydantic/pydantic-ai/pull/3919 * Let agent call nonexistent tool as often as `Agent` `retries` limit specifies by @geodavic in https://github.com/pydantic/pydantic-ai/pull/3597 ### 🐛 Bug Fixes * Ensure `stream_output()` always calls output function/validator with `partial_output=False` at tLow1/7/2026
v1.39.1<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🐛 Bug Fixes * Fix `partial_output` flag in `TextOutput` during streaming by @Danipulok in https://github.com/pydantic/pydantic-ai/pull/3845 * Fix duplicated tool calls with `partial_output=False` and cache result by @Danipulok in https://github.com/pydantic/pydantic-ai/pull/3848 * Update `thoughtSignature` for Vertex Gemini 3 compatibility by @jerry-heygen in https://github.com/pydanLow1/6/2026
v1.39.0## What's Changed * Support embedding models by @DouweM and @dmontagu in https://github.com/pydantic/pydantic-ai/pull/3252 * Add Agent and agent run metadata and expose it on result objects and span attributes by @sstanovnik in https://github.com/pydantic/pydantic-ai/pull/3370 * Support system prompts functions returning `None` by @mrdkucher in https://github.com/pydantic/pydantic-ai/pull/3834 * Handle ThinkingPart in MCP Sampling by @eekstunt in https://github.com/pydantic/pydantic-ai/pull/Low12/24/2025
v1.38.0## What's Changed * Add local timestamps to request and response models - include provider timestamp in `provider_details` by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/3598 * Respect `VideoUrl.vendor_metadata` for GCS URIs on google-vertex by @barapa in https://github.com/pydantic/pydantic-ai/pull/3806 * Fix media type inference for URLs with query parameters by @fedexman in https://github.com/pydantic/pydantic-ai/pull/3501 * Allow typed `RunContext[Deps]` in `TextOutput` siLow12/23/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

animaworksOrganization-as-Code for autonomous AI agents. Brain-inspired memory that grows, consolidates, and forgets. Multi-model (Claude/Codex/Gemini/Cursor/Ollama).v0.8.0
opentulpaSelf-hosted personal AI agent that lives in your DMs. Describe any workflow: triage Gmail, pull a Giphy feed, build a Slack bot, monitor markets. It writes the code, runs it, schedules it, and saves imain@2026-06-05
agent-frameworkA framework for building, orchestrating and deploying AI agents and multi-agent workflows with support for Python and .NET.dotnet-1.9.0
arthur-engineMake AI work for Everyone - Monitoring and governing for your AI/ML 2.1.601
transformersTransformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.v5.10.1

More from pydantic

logfireAI observability platform for production LLM and agent systems.

More in Frameworks

langchainThe agent engineering platform
deer-flowAn open-source long-horizon SuperAgent harness that researches, codes, and creates. With the help of sandboxes, memories, tools, skill, subagents and message gateway, it handles different levels of ta
tqdmFast, Extensible Progress Meter
simBuild, deploy, and orchestrate AI agents. Sim is the central intelligence layer for your AI workforce.