[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-pydantic--pydantic-ai":3,"tool-pydantic--pydantic-ai":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",148568,2,"2026-04-09T23:34:24",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108111,"2026-04-08T11:23:26",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":77,"owner_twitter":72,"owner_website":78,"owner_url":79,"languages":80,"stars":95,"forks":96,"last_commit_at":97,"license":98,"difficulty_score":32,"env_os":99,"env_gpu":99,"env_ram":99,"env_deps":100,"category_tags":106,"github_topics":107,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":112,"updated_at":113,"faqs":114,"releases":143},6080,"pydantic\u002Fpydantic-ai","pydantic-ai","AI Agent Framework, the Pydantic way","pydantic-ai 是一个专为生成式 AI 打造的 Python 智能体框架，旨在帮助开发者快速、自信地构建生产级应用与工作流。它由 Pydantic 核心团队开发，将 FastAPI 那种优雅、高效的开发体验引入到了 AI 领域，解决了现有框架在类型安全、调试便利性及生产可靠性上的不足。\n\n该工具特别适合希望构建高质量 AI 应用的 Python 开发者。其核心亮点在于“原生类型安全”，利用 Pydantic 强大的数据验证能力，将大量潜在的运行时错误提前至编码阶段发现，让 IDE 能提供更精准的自动补全与检查，带来类似 Rust“编译即正确”的安心感。同时，pydantic-ai 具有极强的模型兼容性，支持 OpenAI、Anthropic、Gemini 等主流大模型及各类云服务商，并允许轻松自定义模型接入。此外，它还深度集成了可观测性平台 Pydantic Logfire，提供实时的链路追踪、行为监控与成本分析，让复杂的 AI 交互过程透明可控。如果你正在寻找一个既严谨又灵活的方案来落地 AI 智能体，pydantic-ai 值得尝试。","\u003Cdiv align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fai.pydantic.dev\u002F\">\n    \u003Cpicture>\n      \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fai.pydantic.dev\u002Fimg\u002Fpydantic-ai-dark.svg\">\n      \u003Cimg src=\"https:\u002F\u002Fai.pydantic.dev\u002Fimg\u002Fpydantic-ai-light.svg\" alt=\"Pydantic AI\">\n    \u003C\u002Fpicture>\n  \u003C\u002Fa>\n\u003C\u002Fdiv>\n\u003Cdiv align=\"center\">\n  \u003Ch3>GenAI Agent Framework, the Pydantic way\u003C\u002Fh3>\n\u003C\u002Fdiv>\n\u003Cdiv align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Factions\u002Fworkflows\u002Fci.yml?query=branch%3Amain\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg?event=push\" alt=\"CI\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fcoverage-badge.samuelcolvin.workers.dev\u002Fredirect\u002Fpydantic\u002Fpydantic-ai\">\u003Cimg src=\"https:\u002F\u002Fcoverage-badge.samuelcolvin.workers.dev\u002Fpydantic\u002Fpydantic-ai.svg\" alt=\"Coverage\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Fpydantic-ai\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fpydantic-ai.svg\" alt=\"PyPI\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fpydantic-ai.svg\" alt=\"versions\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fblob\u002Fmain\u002FLICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fpydantic\u002Fpydantic-ai.svg?v\" alt=\"license\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Flogfire.pydantic.dev\u002Fdocs\u002Fjoin-slack\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSlack-Join%20Slack-4A154B?logo=slack\" alt=\"Join Slack\" \u002F>\u003C\u002Fa>\n\u003C\u002Fdiv>\n\n---\n\n**Documentation**: [ai.pydantic.dev](https:\u002F\u002Fai.pydantic.dev\u002F)\n\n---\n\n### \u003Cem>Pydantic AI is a Python agent framework designed to help you quickly, confidently, and painlessly build production grade applications and workflows with Generative AI.\u003C\u002Fem>\n\n\nFastAPI revolutionized web development by offering an innovative and ergonomic design, built on the foundation of [Pydantic Validation](https:\u002F\u002Fdocs.pydantic.dev) and modern Python features like type hints.\n\nYet despite virtually every Python agent framework and LLM library using Pydantic Validation, when we began to use LLMs in [Pydantic Logfire](https:\u002F\u002Fpydantic.dev\u002Flogfire), we couldn't find anything that gave us the same feeling.\n\nWe built Pydantic AI with one simple aim: to bring that FastAPI feeling to GenAI app and agent development.\n\n## Why use Pydantic AI\n\n1. **Built by the Pydantic Team**:\n[Pydantic Validation](https:\u002F\u002Fdocs.pydantic.dev\u002Flatest\u002F) 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?_ :smiley:\n\n2. **Model-agnostic**:\nSupports virtually every [model](https:\u002F\u002Fai.pydantic.dev\u002Fmodels\u002Foverview) 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](https:\u002F\u002Fai.pydantic.dev\u002Fmodels\u002Foverview#custom-models).\n\n3. **Seamless Observability**:\nTightly [integrates](https:\u002F\u002Fai.pydantic.dev\u002Flogfire) with [Pydantic Logfire](https:\u002F\u002Fpydantic.dev\u002Flogfire), 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](https:\u002F\u002Fai.pydantic.dev\u002Flogfire#alternative-observability-backends).\n\n4. **Fully Type-safe**:\nDesigned to give your IDE or AI coding agent as much context as possible for auto-completion and [type checking](https:\u002F\u002Fai.pydantic.dev\u002Fagents#static-type-checking), moving entire classes of errors from runtime to write-time for a bit of that Rust \"if it compiles, it works\" feel.\n\n5. **Powerful Evals**:\nEnables you to systematically test and [evaluate](https:\u002F\u002Fai.pydantic.dev\u002Fevals) the performance and accuracy of the agentic systems you build, and monitor the performance over time in Pydantic Logfire.\n\n6. **Extensible by Design**:\nBuild agents from composable [capabilities](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities) that bundle tools, hooks, instructions, and model settings into reusable units. Use built-in capabilities for [web search](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities#provider-adaptive-tools), [thinking](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities#thinking), and [MCP](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities#provider-adaptive-tools), build your own, or install [third-party capability packages](https:\u002F\u002Fai.pydantic.dev\u002Fextensibility). Define agents entirely in [YAML\u002FJSON](https:\u002F\u002Fai.pydantic.dev\u002Fagent-spec) — no code required.\n\n7. **MCP, A2A, and UI**:\nIntegrates the [Model Context Protocol](https:\u002F\u002Fai.pydantic.dev\u002Fmcp\u002Foverview), [Agent2Agent](https:\u002F\u002Fai.pydantic.dev\u002Fa2a), and various [UI event stream](https:\u002F\u002Fai.pydantic.dev\u002Fui\u002Foverview) 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.\n\n8. **Human-in-the-Loop Tool Approval**:\nEasily lets you flag that certain tool calls [require approval](https:\u002F\u002Fai.pydantic.dev\u002Fdeferred-tools#human-in-the-loop-tool-approval) before they can proceed, possibly depending on tool call arguments, conversation history, or user preferences.\n\n9. **Durable Execution**:\nEnables you to build [durable agents](https:\u002F\u002Fai.pydantic.dev\u002Fdurable_execution\u002Foverview\u002F) 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.\n\n10. **Streamed Outputs**:\nProvides the ability to [stream](https:\u002F\u002Fai.pydantic.dev\u002Foutput#streamed-results) structured output continuously, with immediate validation, ensuring real time access to generated data.\n\n11. **Graph Support**:\nProvides a powerful way to define [graphs](https:\u002F\u002Fai.pydantic.dev\u002Fgraph) using type hints, for use in complex applications where standard control flow can degrade to spaghetti code.\n\nRealistically though, no list is going to be as convincing as [giving it a try](#next-steps) and seeing how it makes you feel!\n\n## Hello World Example\n\nHere's a minimal example of Pydantic AI:\n\n```python\nfrom pydantic_ai import Agent\n\n# Define a very simple agent including the model to use, you can also set the model when running the agent.\nagent = Agent(\n    'anthropic:claude-sonnet-4-6',\n    # Register static instructions using a keyword argument to the agent.\n    # For more complex dynamically-generated instructions, see the example below.\n    instructions='Be concise, reply with one sentence.',\n)\n\n# Run the agent synchronously, conducting a conversation with the LLM.\nresult = agent.run_sync('Where does \"hello world\" come from?')\nprint(result.output)\n\"\"\"\nThe first known use of \"hello, world\" was in a 1974 textbook about the C programming language.\n\"\"\"\n```\n\n_(This example is complete, it can be run \"as is\", assuming you've [installed the `pydantic_ai` package](https:\u002F\u002Fai.pydantic.dev\u002Finstall))_\n\nThe 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.\n\nNot very interesting yet, but we can easily add [tools](https:\u002F\u002Fai.pydantic.dev\u002Ftools), [dynamic instructions](https:\u002F\u002Fai.pydantic.dev\u002Fagents#instructions), [structured outputs](https:\u002F\u002Fai.pydantic.dev\u002Foutput), or composable [capabilities](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities) to build more powerful agents.\n\nHere's the same agent with [thinking](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities#thinking) and [web search](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities#provider-adaptive-tools) capabilities:\n\n```python\nfrom pydantic_ai import Agent\nfrom pydantic_ai.capabilities import Thinking, WebSearch\n\nagent = Agent(\n    'anthropic:claude-sonnet-4-6',\n    instructions='Be concise, reply with one sentence.',\n    capabilities=[Thinking(), WebSearch()],\n)\n\nresult = agent.run_sync('What was the mass of the largest meteorite found this year?')\nprint(result.output)\n```\n\n## Tools & Dependency Injection Example\n\nHere is a concise example using Pydantic AI to build a support agent for a bank:\n\n**(Better documented example [in the docs](https:\u002F\u002Fai.pydantic.dev\u002F#tools-dependency-injection-example))**\n\n```python\nfrom dataclasses import dataclass\n\nfrom pydantic import BaseModel, Field\nfrom pydantic_ai import Agent, RunContext\n\nfrom bank_database import DatabaseConn\n\n\n# SupportDependencies is used to pass data, connections, and logic into the model that will be needed when running\n# instructions and tool functions. Dependency injection provides a type-safe way to customise the behavior of your agents.\n@dataclass\nclass SupportDependencies:\n    customer_id: int\n    db: DatabaseConn\n\n\n# This Pydantic model defines the structure of the output returned by the agent.\nclass SupportOutput(BaseModel):\n    support_advice: str = Field(description='Advice returned to the customer')\n    block_card: bool = Field(description=\"Whether to block the customer's card\")\n    risk: int = Field(description='Risk level of query', ge=0, le=10)\n\n\n# This agent will act as first-tier support in a bank.\n# Agents are generic in the type of dependencies they accept and the type of output they return.\n# In this case, the support agent has type `Agent[SupportDependencies, SupportOutput]`.\nsupport_agent = Agent(\n    'openai:gpt-5.2',\n    deps_type=SupportDependencies,\n    # The response from the agent will, be guaranteed to be a SupportOutput,\n    # if validation fails the agent is prompted to try again.\n    output_type=SupportOutput,\n    instructions=(\n        'You are a support agent in our bank, give the '\n        'customer support and judge the risk level of their query.'\n    ),\n)\n\n\n# Dynamic instructions can make use of dependency injection.\n# Dependencies are carried via the `RunContext` argument, which is parameterized with the `deps_type` from above.\n# If the type annotation here is wrong, static type checkers will catch it.\n@support_agent.instructions\nasync def add_customer_name(ctx: RunContext[SupportDependencies]) -> str:\n    customer_name = await ctx.deps.db.customer_name(id=ctx.deps.customer_id)\n    return f\"The customer's name is {customer_name!r}\"\n\n\n# The `tool` decorator let you register functions which the LLM may call while responding to a user.\n# Again, dependencies are carried via `RunContext`, any other arguments become the tool schema passed to the LLM.\n# Pydantic is used to validate these arguments, and errors are passed back to the LLM so it can retry.\n@support_agent.tool\nasync def customer_balance(\n        ctx: RunContext[SupportDependencies], include_pending: bool\n) -> float:\n    \"\"\"Returns the customer's current account balance.\"\"\"\n    # The docstring of a tool is also passed to the LLM as the description of the tool.\n    # Parameter descriptions are extracted from the docstring and added to the parameter schema sent to the LLM.\n    balance = await ctx.deps.db.customer_balance(\n        id=ctx.deps.customer_id,\n        include_pending=include_pending,\n    )\n    return balance\n\n\n...  # In a real use case, you'd add more tools and a longer system prompt\n\n\nasync def main():\n    deps = SupportDependencies(customer_id=123, db=DatabaseConn())\n    # Run the agent asynchronously, conducting a conversation with the LLM until a final response is reached.\n    # Even in this fairly simple case, the agent will exchange multiple messages with the LLM as tools are called to retrieve an output.\n    result = await support_agent.run('What is my balance?', deps=deps)\n    # The `result.output` will be validated with Pydantic to guarantee it is a `SupportOutput`. Since the agent is generic,\n    # it'll also be typed as a `SupportOutput` to aid with static type checking.\n    print(result.output)\n    \"\"\"\n    support_advice='Hello John, your current account balance, including pending transactions, is $123.45.' block_card=False risk=1\n    \"\"\"\n\n    result = await support_agent.run('I just lost my card!', deps=deps)\n    print(result.output)\n    \"\"\"\n    support_advice=\"I'm sorry to hear that, John. We are temporarily blocking your card to prevent unauthorized transactions.\" block_card=True risk=8\n    \"\"\"\n```\n\n## Next Steps\n\nTo try Pydantic AI for yourself, [install it](https:\u002F\u002Fai.pydantic.dev\u002Finstall) and follow the instructions [in the examples](https:\u002F\u002Fai.pydantic.dev\u002Fexamples\u002Fsetup).\n\nRead the [docs](https:\u002F\u002Fai.pydantic.dev\u002Fagents\u002F) to learn more about building applications with Pydantic AI.\n\nRead the [API Reference](https:\u002F\u002Fai.pydantic.dev\u002Fapi\u002Fagent\u002F) to understand Pydantic AI's interface.\n\nJoin [Slack](https:\u002F\u002Flogfire.pydantic.dev\u002Fdocs\u002Fjoin-slack\u002F) or file an issue on [GitHub](https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fissues) if you have any questions.\n","\u003Cdiv align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fai.pydantic.dev\u002F\">\n    \u003Cpicture>\n      \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fai.pydantic.dev\u002Fimg\u002Fpydantic-ai-dark.svg\">\n      \u003Cimg src=\"https:\u002F\u002Fai.pydantic.dev\u002Fimg\u002Fpydantic-ai-light.svg\" alt=\"Pydantic AI\">\n    \u003C\u002Fpicture>\n  \u003C\u002Fa>\n\u003C\u002Fdiv>\n\u003Cdiv align=\"center\">\n  \u003Ch3>GenAI 代理框架，以 Pydantic 的方式构建\u003C\u002Fh3>\n\u003C\u002Fdiv>\n\u003Cdiv align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Factions\u002Fworkflows\u002Fci.yml?query=branch%3Amain\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg?event=push\" alt=\"CI\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fcoverage-badge.samuelcolvin.workers.dev\u002Fredirect\u002Fpydantic\u002Fpydantic-ai\">\u003Cimg src=\"https:\u002F\u002Fcoverage-badge.samuelcolvin.workers.dev\u002Fpydantic\u002Fpydantic-ai.svg\" alt=\"覆盖率\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Fpydantic-ai\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fpydantic-ai.svg\" alt=\"PyPI\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fpydantic-ai.svg\" alt=\"版本\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fblob\u002Fmain\u002FLICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fpydantic\u002Fpydantic-ai.svg?v\" alt=\"许可证\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Flogfire.pydantic.dev\u002Fdocs\u002Fjoin-slack\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSlack-Join%20Slack-4A154B?logo=slack\" alt=\"加入 Slack\" \u002F>\u003C\u002Fa>\n\u003C\u002Fdiv>\n\n---\n\n**文档**: [ai.pydantic.dev](https:\u002F\u002Fai.pydantic.dev\u002F)\n\n---\n\n### \u003Cem>Pydantic AI 是一个 Python 代理框架，旨在帮助您快速、自信且轻松地使用生成式 AI 构建生产级应用和工作流。\u003C\u002Fem>\n\n\nFastAPI 通过创新且人体工学的设计，彻底改变了 Web 开发，其基础是 [Pydantic 验证](https:\u002F\u002Fdocs.pydantic.dev)以及现代 Python 特性，如类型提示。\n\n然而，尽管几乎每个 Python 代理框架和 LLM 库都使用了 Pydantic 验证，但当我们开始在 [Pydantic Logfire](https:\u002F\u002Fpydantic.dev\u002Flogfire) 中使用 LLM 时，却找不到任何能给我们带来同样感觉的东西。\n\n我们构建 Pydantic AI 的目标很简单：将 FastAPI 的那种开发体验带到 GenAI 应用和代理开发中。\n\n## 为什么选择 Pydantic AI\n\n1. **由 Pydantic 团队打造**:\n[Pydantic 验证](https:\u002F\u002Fdocs.pydantic.dev\u002Flatest\u002F) 是 OpenAI SDK、Google ADK、Anthropic SDK、LangChain、LlamaIndex、AutoGPT、Transformers、CrewAI、Instructor 等众多工具的验证层。_既然可以直接使用源头技术，为何还要使用衍生品呢？_ :smiley:\n\n2. **模型无关**:\n支持几乎所有 [模型](https:\u002F\u002Fai.pydantic.dev\u002Fmodels\u002Foverview) 和提供商：OpenAI、Anthropic、Gemini、DeepSeek、Grok、Cohere、Mistral 和 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 和 Outlines。如果您喜欢的模型或提供商未列出，也可以轻松实现 [自定义模型](https:\u002F\u002Fai.pydantic.dev\u002Fmodels\u002Foverview#custom-models)。\n\n3. **无缝可观测性**:\n与我们的通用 OpenTelemetry 可观测平台 [Pydantic Logfire](https:\u002F\u002Fpydantic.dev\u002Flogfire) 紧密 [集成](https:\u002F\u002Fai.pydantic.dev\u002Flogfire)，可实现实时调试、基于评估的性能监控，以及行为、追踪和成本跟踪。如果您已有支持 OTel 的可观测性平台，也可以 [使用该平台](https:\u002F\u002Fai.pydantic.dev\u002Flogfire#alternative-observability-backends)。\n\n4. **完全类型安全**:\n设计旨在为您的 IDE 或 AI 编码助手提供尽可能多的上下文信息，以实现自动补全和 [类型检查](https:\u002F\u002Fai.pydantic.dev\u002Fagents#static-type-checking)，从而将大量错误从运行时转移到编写时，带来类似 Rust 的“如果能编译，就一定有效”的开发体验。\n\n5. **强大的评估功能**:\n使您能够系统地测试和 [评估](https:\u002F\u002Fai.pydantic.dev\u002Fevals) 所构建代理系统的性能和准确性，并在 Pydantic Logfire 中持续监控其表现。\n\n6. **设计上高度可扩展**:\n您可以从可组合的 [能力](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities) 中构建代理，这些能力将工具、钩子、指令和模型设置打包成可重用单元。使用内置的能力进行 [网页搜索](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities#provider-adaptive-tools)、[思考](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities#thinking) 和 [MCP](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities#provider-adaptive-tools)，也可以自行构建，或安装 [第三方能力包](https:\u002F\u002Fai.pydantic.dev\u002Fextensibility)。整个代理的定义都可以用 [YAML\u002FJSON](https:\u002F\u002Fai.pydantic.dev\u002Fagent-spec) 来完成——无需编写代码。\n\n7. **MCP、A2A 和 UI**:\n集成了 [模型上下文协议](https:\u002F\u002Fai.pydantic.dev\u002Fmcp\u002Foverview)、[Agent2Agent](https:\u002F\u002Fai.pydantic.dev\u002Fa2a) 以及多种 [UI 事件流](https:\u002F\u002Fai.pydantic.dev\u002Fui\u002Foverview) 标准，使您的代理能够访问外部工具和数据，与其他代理互操作，并构建基于流式事件通信的交互式应用。\n\n8. **人工介入工具审批**:\n可以轻松标记某些工具调用需要 [审批](https:\u002F\u002Fai.pydantic.dev\u002Fdeferred-tools#human-in-the-loop-tool-approval) 后才能继续执行，具体取决于工具调用参数、对话历史或用户偏好。\n\n9. **持久化执行**:\n使您能够构建 [持久化代理](https:\u002F\u002Fai.pydantic.dev\u002Fdurable_execution\u002Foverview)，即使在临时性的 API 故障、应用程序错误或重启情况下也能保留进度，并以生产级可靠性处理长时间运行、异步以及涉及人工干预的工作流。\n\n10. **流式输出**:\n提供持续 [流式](https:\u002F\u002Fai.pydantic.dev\u002Foutput#streamed-results) 输出结构化结果的能力，同时进行即时验证，确保实时访问生成的数据。\n\n11. **图支持**:\n提供了一种强大的方式，利用类型提示来定义 [图](https:\u002F\u002Fai.pydantic.dev\u002Fgraph)，适用于标准控制流程容易演变成“意大利面代码”的复杂应用中。\n\n不过说真的，再长的列表也不如亲自 [试一试](#next-steps) 来得有说服力！看看它带给您的感受吧！\n\n## Hello World 示例\n\n以下是 Pydantic AI 的一个极简示例：\n\n```python\nfrom pydantic_ai import Agent\n\n# 定义一个非常简单的代理，包括要使用的模型；您也可以在运行代理时指定模型。\nagent = Agent(\n    'anthropic:claude-sonnet-4-6',\n    # 使用代理的关键字参数注册静态指令。\n    # 对于更复杂的动态生成指令，请参阅下面的示例。\n    instructions='言简意赅，只回复一句话。',\n)\n\n# 同步运行代理，与大语言模型进行对话。\nresult = agent.run_sync('“hello world”是从哪里来的？')\nprint(result.output)\n\"\"\"\n“hello, world”最早见于1974年一本关于C语言的教科书。\n\"\"\"\n```\n\n_(此示例已完整，可在安装了 `pydantic_ai` 包的情况下直接运行。)_\n\n交互过程将非常简短：Pydantic AI 会将指令和用户提示发送给大语言模型，模型则会返回一段文本响应。\n\n目前这还显得不够有趣，但我们可以通过添加[工具](https:\u002F\u002Fai.pydantic.dev\u002Ftools)、[动态指令](https:\u002F\u002Fai.pydantic.dev\u002Fagents#instructions)、[结构化输出](https:\u002F\u002Fai.pydantic.dev\u002Foutput)，或可组合的[能力](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities)，来构建更强大的智能体。\n\n以下是同一个智能体，但增加了[思考](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities#thinking)和[网络搜索](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities#provider-adaptive-tools)能力：\n\n```python\nfrom pydantic_ai import Agent\nfrom pydantic_ai.capabilities import Thinking, WebSearch\n\nagent = Agent(\n    'anthropic:claude-sonnet-4-6',\n    instructions='请简洁回答，只用一句话。',\n    capabilities=[Thinking(), WebSearch()],\n)\n\nresult = agent.run_sync('今年发现的最大陨石质量是多少？')\nprint(result.output)\n```\n\n## 工具与依赖注入示例\n\n以下是一个使用 Pydantic AI 构建银行客服代理的简洁示例：\n\n**(更详细的文档示例请参见 [文档](https:\u002F\u002Fai.pydantic.dev\u002F#tools-dependency-injection-example))**\n\n```python\nfrom dataclasses import dataclass\n\nfrom pydantic import BaseModel, Field\nfrom pydantic_ai import Agent, RunContext\n\nfrom bank_database import DatabaseConn\n\n\n# SupportDependencies 用于将运行时所需的数据、连接和逻辑传递给模型，以便在执行指令和工具函数时使用。\n# 依赖注入提供了一种类型安全的方式来自定义智能体的行为。\n@dataclass\nclass SupportDependencies:\n    customer_id: int\n    db: DatabaseConn\n\n\n# 此 Pydantic 模型定义了智能体返回的输出结构。\nclass SupportOutput(BaseModel):\n    support_advice: str = Field(description='返回给客户的建议')\n    block_card: bool = Field(description=\"是否需要冻结客户的银行卡\")\n    risk: int = Field(description='查询的风险等级', ge=0, le=10)\n\n\n# 此智能体将作为银行的一线客服代理。\n# 智能体对接受的依赖类型和返回的输出类型都是通用的。\n# 在本例中，客服智能体的类型为 `Agent[SupportDependencies, SupportOutput]`。\nsupport_agent = Agent(\n    'openai:gpt-5.2',\n    deps_type=SupportDependencies,\n    # 智能体的响应将被保证为 SupportOutput 类型，\n    # 如果验证失败，智能体会被提示重新尝试。\n    output_type=SupportOutput，\n    instructions=(\n        '您是我们银行的客服代表，请为客户提供支持，并评估其咨询的风险等级。'\n    ),\n)\n\n\n# 动态指令可以利用依赖注入功能。\n# 依赖项通过 `RunContext` 参数传递，该参数以上述 `deps_type` 为泛型。\n# 如果这里的类型注解有误，静态类型检查器会捕获它。\n@support_agent.instructions\nasync def add_customer_name(ctx: RunContext[SupportDependencies]) -> str:\n    customer_name = await ctx.deps.db.customer_name(id=ctx.deps.customer_id)\n    return f\"客户的姓名是 {customer_name!r}\"\n\n\n# 使用 `tool` 装饰器可以注册一些函数，这些函数可以在大语言模型响应用户请求时被调用。\n# 再次强调，依赖项通过 `RunContext` 传递，其他参数则会成为传递给大语言模型的工具接口。\n# Pydantic 用于验证这些参数，如果出现错误，会反馈给大语言模型以便其重试。\n@support_agent.tool\nasync def customer_balance(\n        ctx: RunContext[SupportDependencies], include_pending: bool\n) -> float:\n    \"\"\"返回客户的当前账户余额。\"\"\"\n    # 工具的文档字符串也会作为工具描述传递给大语言模型。\n    # 参数描述会从文档字符串中提取，并添加到发送给大语言模型的参数模式中。\n    balance = await ctx.deps.db.customer_balance(\n        id=ctx.deps.customer_id,\n        include_pending=include_pending,\n    )\n    return balance\n\n\n...  # 在实际应用中，您还可以添加更多工具和更长的系统提示\n\n\nasync def main():\n    deps = SupportDependencies(customer_id=123, db=DatabaseConn())\n    # 异步运行智能体，与大语言模型进行对话，直到获得最终响应。\n    # 即使在这个相对简单的场景中，智能体也会在调用工具获取结果的过程中与大语言模型多次交互。\n    result = await support_agent.run('我的余额是多少？', deps=deps)\n    # `result.output` 将使用 Pydantic 进行验证，以确保其符合 `SupportOutput` 类型。由于智能体是通用的，\n    # 它的类型也将被标注为 `SupportOutput`，从而有助于静态类型检查。\n    print(result.output)\n    \"\"\"\n    support_advice='您好，约翰，您当前账户的余额（包括未结算交易）为123.45美元。' block_card=False risk=1\n    \"\"\"\n\n    result = await support_agent.run('我刚刚丢了卡！', deps=deps)\n    print(result.output)\n    \"\"\"\n    support_advice=\"很抱歉听到这个消息，约翰。我们已暂时冻结您的卡片，以防止未经授权的交易。\" block_card=True risk=8\n    \"\"\"\n```\n\n## 下一步\n\n要亲自体验 Pydantic AI，请先[安装](https:\u002F\u002Fai.pydantic.dev\u002Finstall)，然后按照[示例中的说明](https:\u002F\u002Fai.pydantic.dev\u002Fexamples\u002Fsetup)操作。\n\n阅读[文档](https:\u002F\u002Fai.pydantic.dev\u002Fagents\u002F)以了解更多关于使用 Pydantic AI 构建应用程序的信息。\n\n查阅[API 参考](https:\u002F\u002Fai.pydantic.dev\u002Fapi\u002Fagent\u002F)以理解 Pydantic AI 的接口。\n\n如果您有任何问题，欢迎加入 [Slack](https:\u002F\u002Flogfire.pydantic.dev\u002Fdocs\u002Fjoin-slack\u002F) 或在 [GitHub](https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fissues) 上提交问题。","# Pydantic AI 快速上手指南\n\nPydantic AI 是一个由 Pydantic 团队打造的 Python Agent 框架，旨在帮助开发者快速、自信地构建生产级的生成式 AI 应用和工作流。它继承了 FastAPI 的优雅设计，提供模型无关、类型安全、可观测性强等特性。\n\n## 环境准备\n\n- **操作系统**：Linux, macOS, Windows\n- **Python 版本**：3.9 及以上\n- **前置依赖**：\n  - 已安装 Python 包管理工具（pip 或 uv）\n  - 拥有至少一个 LLM 提供商的 API Key（如 OpenAI, Anthropic, Google Gemini 等）\n\n## 安装步骤\n\n使用 pip 安装核心包：\n\n```bash\npip install pydantic-ai\n```\n\n若需使用特定模型提供商（例如 OpenAI 或 Anthropic），请安装对应的额外依赖：\n\n```bash\n# 示例：安装 OpenAI 和 Anthropic 支持\npip install \"pydantic-ai[openai,anthropic]\"\n```\n\n> **提示**：国内开发者若遇到下载速度慢的问题，可使用清华或阿里云镜像源加速安装：\n> ```bash\n> pip install pydantic-ai -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n> ```\n\n## 基本使用\n\n### 1. Hello World 示例\n\n以下是最简单的同步运行示例，展示如何定义 Agent 并获取回答：\n\n```python\nfrom pydantic_ai import Agent\n\n# 定义一个简单的 Agent，指定模型和系统指令\nagent = Agent(\n    'anthropic:claude-sonnet-4-6',\n    instructions='Be concise, reply with one sentence.',\n)\n\n# 同步运行 Agent\nresult = agent.run_sync('Where does \"hello world\" come from?')\nprint(result.output)\n```\n\n**输出示例：**\n```text\nThe first known use of \"hello, world\" was in a 1974 textbook about the C programming language.\n```\n\n### 2. 添加能力（Capabilities）\n\n你可以轻松为 Agent 添加“思考”或“联网搜索”等内置能力：\n\n```python\nfrom pydantic_ai import Agent\nfrom pydantic_ai.capabilities import Thinking, WebSearch\n\nagent = Agent(\n    'anthropic:claude-sonnet-4-6',\n    instructions='Be concise, reply with one sentence.',\n    capabilities=[Thinking(), WebSearch()],\n)\n\nresult = agent.run_sync('What was the mass of the largest meteorite found this year?')\nprint(result.output)\n```\n\n### 3. 使用工具与依赖注入（进阶）\n\nPydantic AI 支持通过依赖注入传递数据库连接等上下文，并定义结构化输出：\n\n```python\nfrom dataclasses import dataclass\nfrom pydantic import BaseModel, Field\nfrom pydantic_ai import Agent, RunContext\n\n# 模拟数据库连接\nclass DatabaseConn:\n    async def customer_name(self, id: int) -> str:\n        return \"John Doe\"\n    async def customer_balance(self, id: int, include_pending: bool) -> float:\n        return 1234.56\n\n@dataclass\nclass SupportDependencies:\n    customer_id: int\n    db: DatabaseConn\n\nclass SupportOutput(BaseModel):\n    support_advice: str = Field(description='Advice returned to the customer')\n    block_card: bool = Field(description=\"Whether to block the customer's card\")\n    risk: int = Field(description='Risk level of query', ge=0, le=10)\n\nsupport_agent = Agent(\n    'openai:gpt-5.2',\n    deps_type=SupportDependencies,\n    output_type=SupportOutput,\n    instructions='You are a support agent in our bank.',\n)\n\n@support_agent.instructions\nasync def add_customer_name(ctx: RunContext[SupportDependencies]) -> str:\n    customer_name = await ctx.deps.db.customer_name(id=ctx.deps.customer_id)\n    return f\"The customer's name is {customer_name!r}\"\n\n@support_agent.tool\nasync def customer_balance(ctx: RunContext[SupportDependencies], include_pending: bool) -> float:\n    \"\"\"Returns the customer's current account balance.\"\"\"\n    return await ctx.deps.db.customer_balance(id=ctx.deps.customer_id, include_pending=include_pending)\n\nasync def main():\n    deps = SupportDependencies(customer_id=123, db=DatabaseConn())\n    result = await support_agent.run('What is my balance?', deps=deps)\n    print(result.output)\n\n# 运行异步入口\n# import asyncio\n# asyncio.run(main())\n```\n\n通过以上步骤，你即可开始使用 Pydantic AI 构建类型安全、功能强大的 AI Agent 应用。更多高级功能（如图形工作流、持久化执行、MCP 协议集成等）请参考官方文档。","某电商公司的后端团队正在开发一个智能客服 Agent，需要自动解析用户复杂的退货请求并提取结构化数据（如订单号、退货原因、商品状态），以便直接写入数据库。\n\n### 没有 pydantic-ai 时\n- **类型安全缺失**：开发者需手动编写大量正则或解析逻辑来清洗 LLM 返回的 JSON，运行时经常因字段缺失或格式错误导致程序崩溃。\n- **调试黑盒化**：当 Agent 做出错误决策时，缺乏内置的追踪机制，难以复现是提示词问题还是模型幻觉，排查耗时极长。\n- **供应商锁定风险**：代码深度耦合特定厂商（如 OpenAI）的 SDK，若想切换至国产模型或本地部署的 Ollama，几乎需要重写整个交互层。\n- **测试评估困难**：缺乏系统化的评估工具，无法在上线前批量验证 Agent 对不同退货场景的处理准确率，只能靠人工抽检。\n\n### 使用 pydantic-ai 后\n- **编译期纠错**：利用 Pydantic 模型定义期望输出，IDE 即可提供自动补全和静态类型检查，将大部分数据结构错误拦截在编码阶段。\n- **无缝可观测性**：原生集成 Pydantic Logfire，自动记录每次调用的完整轨迹、Token 消耗及延迟，支持实时调试与性能监控。\n- **模型无关架构**：通过统一接口轻松切换底层模型，从 Gemini 切换到 DeepSeek 仅需修改一行配置，业务逻辑无需任何变动。\n- **系统化评估**：内置强大的 Evals 框架，可自动化运行数百个测试用例，量化评估 Agent 在各类边缘案例下的表现，确保上线质量。\n\npydantic-ai 将生成式 AI 开发从“手工拼凑”提升为“工程化构建”，让团队能像开发传统 Web 服务一样自信地交付生产级 AI 应用。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fpydantic_pydantic-ai_61b58d5e.png","pydantic","Pydantic","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fpydantic_0846671e.png","Pydantic, Pydantic Logfire and Pydantic AI",null,"hello@pydantic.dev","https:\u002F\u002Fpydantic.dev","https:\u002F\u002Fgithub.com\u002Fpydantic",[81,85,89,92],{"name":82,"color":83,"percentage":84},"Python","#3572A5",99.8,{"name":86,"color":87,"percentage":88},"Shell","#89e051",0.1,{"name":90,"color":91,"percentage":88},"TypeScript","#3178c6",{"name":93,"color":94,"percentage":88},"Makefile","#427819",16203,1892,"2026-04-09T21:33:34","MIT","未说明",{"notes":101,"python":102,"dependencies":103},"该工具是一个代理框架，本身不包含模型权重，主要依赖外部 API（如 OpenAI、Anthropic 等）或本地服务（如 Ollama）。因此对本地 GPU 和内存无特殊硬性要求，具体取决于所选用的模型后端。需配置相应模型的 API Key 或本地服务地址。","3.8+",[72,104,105],"httpx","eval-type-backport",[35,14,13],[108,72,109,110,111],"agent-framework","python","genai","llm","2026-03-27T02:49:30.150509","2026-04-10T10:28:41.476148",[115,120,125,130,135,139],{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},27550,"在异步上下文（如 Streamlit）中运行 Gemini 模型时出现 'Event loop is closed' 错误怎么办？","这通常是因为测试环境配置冲突导致的。如果您在使用 `pytest-asyncio` 的严格模式（strict mode）运行测试，它可能会与 `agent.run()` 的代码产生不良交互。尝试卸载 `pytest-asyncio` 或调整其配置通常能解决此问题。如果是在生产代码中遇到，请确保没有混合使用不同的事件循环管理方式。","https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fissues\u002F748",{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},27551,"Pydantic AI 是否支持 Anthropic 模型的提示词缓存（Prompt Caching）功能？","是的，社区正在积极支持该功能。虽然 OpenAI 和 Gemini 通常具有隐式缓存，但 Anthropic 需要显式的 `cache-control` 设置。维护者指出相关 PR 正在进行中，旨在支持 Anthropic 模型的显式提示词缓存，以降低包含大量工具调用或长系统提示时的成本。您可以关注相关 PR 以获取最新进展。","https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fissues\u002F1041",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},27552,"如何在 Pydantic AI 中使用 Google Gemini 的上下文缓存（Context Caching）功能？","Pydantic AI 支持通过 `GoogleModelSettings` 配置来使用 Gemini 的上下文缓存。您只需要在设置中指定 `google_cached_content` 参数，将其值设为您在 Google AI 控制台或通过 API 创建的缓存内容 ID 即可。例如：`GoogleModelSettings(google_cached_content=\"your_cache_id\")`，这将直接映射到 API 的 `cached_content` 字段，从而节省 Token 成本。","https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fissues\u002F664",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},27553,"遇到 Gemini 返回 'MALFORMED_FUNCTION_CALL' 错误导致验证失败如何处理？","这是一个已知问题，可以通过以下三种方法显著减少发生频率：\n1. **修改系统提示词**：在 system prompt 中添加指令，例如 \"Ensure all string values in function call arguments are properly JSON-escaped\"（确保函数调用参数中的所有字符串值都正确进行了 JSON 转义）。\n2. **调整温度参数**：当捕获到该错误进行重试时，将 `temperature` 设置为 0，使模型输出更确定，减少生成损坏 JSON 的概率。\n3. **实施重试机制**：捕获包含 'MALFORMED_FUNCTION_CALL' 的异常或空内容字段，并在重试预算允许的情况下自动重试。此外，简化工具（Tools）的结构也能有效降低此错误率。","https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fissues\u002F631",{"id":136,"question_zh":137,"answer_zh":138,"source_url":134},27554,"如何构建一个健壮的 Agent 以应对 Gemini 模型的超时、速率限制和内容过滤错误？","推荐使用 `FallbackModel` 包装器来增强鲁棒性。您可以配置它在遇到特定异常时自动切换模型或重试。例如：`model=FallbackModel(*[model_list], fallback_on=(ModelHTTPError, ValidationError, httpx.ReadTimeout))`。这种配置可以保护应用程序免受 Gemini 常见的三大问题影响：速率限制（Rate limits）、内容过滤（Content filters）以及因工具结构复杂导致的坏请求（Bad tool calls\u002FMalformed functions）。长期来看，简化工具定义或升级到更强的模型也是有效的解决方案。",{"id":140,"question_zh":141,"answer_zh":142,"source_url":134},27555,"为什么我的 Gemini 工具调用经常失败并伴随 httpx 超时错误？","这通常与工具（Tools）定义的复杂性有关。当工具结构过于复杂时，Gemini 可能难以生成符合架构的响应，导致其在服务器端反复尝试失败，最终在 95-120 秒后超时并返回 `MALFORMED_FUNCTION_CALL`。解决方法包括：1) 简化工具的宽度和复杂度；2) 使用更强大的模型版本；3) 使用 `FallbackModel` 捕获 `httpx.ReadTimeout` 并进行降级处理或重试。",[144,149,154,159,164,169,174,179,184,189,194,199,204,209,214,219,224,229,234,239],{"id":145,"version":146,"summary_zh":147,"released_at":148},180667,"v1.78.0","\u003C!-- 使用 .github\u002Frelease.yml 中的配置生成的发布说明 -->\n\n## 变更内容\n### 🚀 功能\n* 按照 OTel 规范添加缓存的令牌跨度属性，由 @alexmojaki 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F5013 中实现。\n* 功能：在 `ToolDefinition` 中添加 `return_schema` 和 `function_signature`，由 @adtyavrdhn 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4964 中实现。\n* 功能：添加 `SetToolMetadata` 能力，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4964 中实现。\n\n## 新贡献者\n* @Ricardo-M-L 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4968 中完成了首次贡献。\n* @chernistry 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F5005 中完成了首次贡献。\n* @vladdoster 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4620 中完成了首次贡献。\n* @edmcman 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4584 中完成了首次贡献。\n* @drPod 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4809 中完成了首次贡献。\n* @1Ninad 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4945 中完成了首次贡献。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.77.0...v1.78.0","2026-04-08T05:10:46",{"id":150,"version":151,"summary_zh":152,"released_at":153},180668,"v1.77.0","\u003C!-- 发布说明由 .github\u002Frelease.yml 中的配置在 main 分支上生成 -->\n\n## 变更内容\n### 🚀 功能\n* feat: 添加本地 `WebFetch` 工具，并在提供商未内置支持时让 `WebFetch` 能力使用该工具，由 DEENUU1 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4906 中实现\n* 为工具和工具集添加 `defer_loading`，以启用工具搜索功能，由 dsfaccini 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4090 中实现\n* 添加 `ThreadExecutor` 能力及 `Agent.using_thread_executor()` 方法，由 DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4942 中实现\n* feat: 智能指令缓存 — 自动在静态\u002F动态分割处插入 Anthropic\u002FBedrock 缓存边界，由 Alex-Resch 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4865 中实现\n* 在 `VercelAIEventStream` 中支持 `server_message_id`，由 dsfaccini 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4579 中实现\n### 🐛 修复\n* fix: 对图像输出运行输出验证器，由 dsfaccini 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4938 中修复\n* 将流式 SDK 错误封装在 `ModelHTTPError`\u002F`ModelAPIError` 中，由 dsfaccini 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4889 中修复\n\n## 新贡献者\n* @Alex-Resch 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4865 中完成了首次贡献\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.76.0...v1.77.0","2026-04-03T02:07:16",{"id":155,"version":156,"summary_zh":157,"released_at":158},180669,"v1.76.0","## 变更内容\n### 🚀 功能\n* 当主模型不支持图像生成时，自动回退到配备图像生成模型的子代理，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4910 中实现。\n* 向 `RunContext` 中添加 `agent` 字段，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4922 中实现。\n### 🐛 问题修复\n* 在代理运行中包含 `gen_ai.operation.name` Span 属性，由 @adriangb 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4936 中实现。\n### 📦 依赖更新\n* 将 Mistral 集成更新至 mistralai SDK v2，由 @doramirdor 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4736 中完成。\n\n## 新贡献者\n* @doramirdor 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4736 中完成了首次贡献。\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.75.0...v1.76.0","2026-04-02T00:16:24",{"id":160,"version":161,"summary_zh":162,"released_at":163},180670,"v1.75.0","\u003C!-- 发布说明由 .github\u002Frelease.yml 中的配置在 main 分支上生成 -->\n\n## 变更内容\n### 🚀 新特性\n* 新增（嵌入）：gemini-embedding-2-preview 的类型和限制，由 @yorickvP 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4874 中实现。\n* 实现对 VertexAI 的 Flex PayGo 支持，由 @ewjoachim 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4312 中实现。\n\n### 🐛 修复缺陷\n* 停止为 Bedrock 客户端剥离缓存控制中的 TTL，由 @fuyi 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4915 中修复。\n* 修复：在 Vercel AI 适配器的用户消息处理中正确处理 `DataUIPart` (#4704)，由 @sudo-nick 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4712 中修复。\n* 修复：在插入指令时仅统计前置系统消息的数量，由 @sztoplover-bit 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4833 中修复。\n* 修复：确保 `run_sync` 和 `run_stream` 在处理无效输出工具调用时具有一致的错误处理机制，由 @Spectual 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4860 中修复。\n* 修复（OpenRouter）：处理响应嵌套在 provider 字段中时顶层字段为 null 的情况，由 @adityasingh2400 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4528 中修复。\n\n## 新贡献者\n* @fuyi 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4915 中完成了首次贡献。\n* @sudo-nick 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4712 中完成了首次贡献。\n* @yorickvP 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4874 中完成了首次贡献。\n* @ewjoachim 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4312 中完成了首次贡献。\n* @sztoplover-bit 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4833 中完成了首次贡献。\n* @Spectual 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4860 中完成了首次贡献。\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.74.0...v1.75.0","2026-04-01T00:28:57",{"id":165,"version":166,"summary_zh":167,"released_at":168},180671,"v1.74.0","\u003C!-- 使用 .github\u002Frelease.yml 中的配置生成的发布说明，分支为 main -->\n\n## 变更内容\n### 🚀 功能\n* feat: 由 @dmontagu 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4782 中引入的 pydantic-evals 在线评估基础设施\n* feat: 添加 `TextContent`，用于包含元数据但不发送给模型的用户提示，由 @thisisarko 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4432 中实现\n* 使运行 ID 可按时间排序；在所有代理运行的子跨度中添加代理名称和运行 ID 属性，由 @adriangb 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4876 中完成\n* 添加 `AbstractToolset.get_instructions` 方法以及 MCP 服务器中的 `include_instructions` 参数，由 @DougTrajano 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4123 中实现\n* 弃用：不带 `name` 参数的 `Dataset`，由 @Kludex 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4862 中提出\n\n### 🐛 修复\n* Fix(tracing): 防止 `CallDeferred`\u002F`ApprovalRequired` 将工具跨度标记为错误，由 @jaiwinshah3 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4661 中修复\n* fix: 修复 OpenAI 兼容提供商的 `service_tier` 验证失败问题，由 @majdalsado 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4911 中完成\n* 修复使用 `gemini-embedding-2-preview` 进行批量嵌入生成的问题，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4913 中完成\n* fix(output): 尊重 `ToolOutput.max_retries` 参数，由 @JasonCZMeng 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4687 中修复\n\n## 新贡献者\n* @jaiwinshah3 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4661 中完成了首次贡献\n* @thisisarko 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4432 中完成了首次贡献\n* @adriangb 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4876 中完成了首次贡献\n* @JasonCZMeng 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4687 中完成了首次贡献\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.73.0...v1.74.0","2026-03-31T03:05:41",{"id":170,"version":171,"summary_zh":172,"released_at":173},180672,"v1.73.0","\u003C!-- 发布说明由 .github\u002Frelease.yml 中的配置在 main 分支上生成 -->\n\n## 变更内容\n### 🚀 功能\n* feat: 由 @dmontagu 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4854 中为 `Dataset.evaluate` 添加了 `CaseLifecycle` 钩子\n* 允许钩子抛出 `ModelRetry` 以实现重试控制流，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4858 中完成\n* 允许 before\u002Fwrap 模型请求钩子通过 `ModelRequestContext` 替换模型，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4855 中实现\n### 🐛 修复\n* fix: xAI provider_fallback 已更改为与 `genai-prices` 匹配的 `x-ai`，由 @adtyavrdhn 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4789 中完成\n* 修复能力模式生成，使其包含完整的参数类型，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4867 中完成\n### 📦 依赖\n* 将 temporal 版本升级至 `>=1.24.0`，由 @adtyavrdhn 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4863 中完成\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.72.0...v1.73.0","2026-03-27T03:40:10",{"id":175,"version":176,"summary_zh":177,"released_at":178},180673,"v1.72.0","\u003C!-- 使用 .github\u002Frelease.yml 中的配置在 main 分支生成的发布说明 -->\n\n## 变更内容\n### 🚀 功能\n* feat: 在 `AnthropicModelSettings` 中添加 `anthropic_eager_input_streaming`，由 @moe9195 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4842 中实现。\n* 支持同步工具准备函数，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4846 中实现。\n* 不再要求在 Python 或 `AgentSpec` 中显式指定 `MCP` 能力的 `url=` 参数，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4846 中实现。\n\n### 🐛 修复\n* 修复 `Thinking` 能力的类型推断问题，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4846 中修复。\n* fix: 补齐缺失的 `OpenRouterReasoning` 效力值，由 @majdalsado 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4709 中修复。\n* fix: 在通过 Temporal 序列化时保留 `ToolReturn` 的元数据，由 @alvinttang 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4684 中修复。\n* fix: 当 Bedrock 只包含指令时插入空的用户消息，由 @adtyavrdhn 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4498 中修复。\n\n## 新贡献者\n* @ddanielcruzz 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4837 中完成了首次贡献。\n* @alvinttang 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4684 中完成了首次贡献。\n* @moe9195 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4842 中完成了首次贡献。\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.71.0...v1.72.0","2026-03-26T01:33:19",{"id":180,"version":181,"summary_zh":182,"released_at":183},180674,"v1.71.0","\u003C!-- 使用 .github\u002Frelease.yml 中的配置在 main 分支生成的发布说明 -->\n\n## 变更内容\n### 🚀 功能\n* 添加 [Capabilities](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities\u002F)：可组合、可重用的智能体行为单元，将工具、生命周期钩子、指令和模型设置打包成一个类，可通过 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4640 中将其插入任何智能体。\n* 添加 [`AgentSpec`](https:\u002F\u002Fai.pydantic.dev\u002Fagent-spec\u002F) 和 `Agent.from_file`，用于从 YAML\u002FJSON 加载智能体，并支持引用依赖项的模板化指令（通过 `TemplateStr`），由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4640 中实现。\n* 添加 [`Hooks`](https:\u002F\u002Fai.pydantic.dev\u002Fhooks\u002F) 能力，支持使用装饰器定义钩子，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4640 中实现。\n* 添加 [`Thinking`](https:\u002F\u002Fai.pydantic.dev\u002Fthinking\u002F) 能力以及跨提供商的 `thinking` 模型设置，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4640 中实现。\n* 添加 [provider-adaptive tools](https:\u002F\u002Fai.pydantic.dev\u002Fcapabilities\u002F#provider-adaptive-tools) 能力 `WebSearch`、`WebFetch`、`MCP`、`ImageGeneration`，这些工具会自动从内置（提供商）工具回退到本地工具，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4640 中实现。\n* 添加 [`AbstractToolset.for_run`](https:\u002F\u002Fai.pydantic.dev\u002Ftoolsets\u002F#per-run-and-per-step-lifecycle) 和 `for_run_step`，用于状态隔离，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4640 中实现。\n* 添加 `openai:gpt-5.4-mini` 和 `openai:gpt-5.4-nano`，由 @adtyavrdhn 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4787 中实现。\n\n\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.70.0...v1.71.0","2026-03-24T21:50:06",{"id":185,"version":186,"summary_zh":187,"released_at":188},180675,"v1.70.0","\u003C!-- 使用 .github\u002Frelease.yml 中的配置在 main 分支生成的发布说明 -->\n\n## 变更内容\n### 🚀 功能\n* 由 @dsfaccini 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4697 中向 BedrockModelSettings 和 BedrockEmbeddingSettings 添加了 `bedrock_inference_profile`\n### 🐛 修复\n* 修复：OpenRouter 的 Anthropic 模型配置文件匹配带点号的模型编号，由 @majdalsado 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4690 中完成\n* 修复：始终将 `embedding_types` 传递给 Cohere 的 `embed()` 方法，以防止 SDK 抛出 `TypeError`，由 @adityasingh2400 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4524 中完成\n* 修复（Google）：添加 '512' 作为支持的图像生成尺寸，由 @nat-bishop 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4649 中完成\n* 修复（Bedrock）：在将工具名称发送至 API 之前进行转义处理，由 @DouweM 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4713 中完成\n* 修复：在 Anthropic 的重试路径中处理格式错误的工具调用参数，由 @Saad-Azi 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4431 中完成\n* 修复：对于仅思考的响应，恢复之前的文本内容而非重新尝试，由 @majiayu000 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4558 中完成\n\n## 新贡献者\n* @adityasingh2400 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4524 中完成了首次贡献\n* @nat-bishop 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4649 中完成了首次贡献\n* @Saad-Azi 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4431 中完成了首次贡献\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.69.0...v1.70.0","2026-03-18T04:15:30",{"id":190,"version":191,"summary_zh":192,"released_at":193},180676,"v1.69.0","\u003C!-- 使用 .github\u002Frelease.yml 中的配置在 main 分支生成的发布说明 -->\n\n## 变更内容\n### 🚀 功能\n* 为 `Agent` 添加 `description` 参数，并由 @Kludex 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4677 中设置 span 上的 `gen_ai.agent.description`\n* 直接将多模态工具结果发送到 API，而不是拆分为用户部分，由 @dsfaccini 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F3826 中实现\n* 为 `FallbackModel` 添加基于响应的回退支持，由 @sarth6 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F3786 中实现\n### 🐛 修复\n* 修复：通过 `tool`\u002F`tool_plain` 拆分，在 `FunctionToolset.tool` 上强制执行依赖项类型，由 @adtyavrdhn 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4626 中实现\n* 修复：在 `Usage.__add__` 中复制 `details` 字典，以防止对…的修改，由 @sksvineeth 在 https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4606 中实现\n\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.68.0...v1.69.0","2026-03-17T02:44:07",{"id":195,"version":196,"summary_zh":197,"released_at":198},180677,"v1.68.0","\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at main -->\r\n\r\n## What's Changed\r\n### Changes\r\n* Remove redundant `running tools` parent span by @Kludex in #4560\r\n### 🐛 Bug Fixes\r\n* fix(openai): thinking detection for `gpt-5.3-chat-latest` by @dsfaccini in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4567\r\n* fix: AG-UI follow-up messages failing after built-in tool use by @gcheshkov in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4624\r\n### 📦 Dependencies\r\n* fix: remediate open Dependabot security alerts by @dsfaccini in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4520\r\n\r\n## New Contributors\r\n* @gcheshkov made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4624\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.67.0...v1.68.0\r\n\r\n\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at v1.68.0 -->\r\n\r\n## What's Changed\r\n### 🚀 Features\r\n* Remove redundant `running tools` parent span by @Kludex in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4560\r\n### 🐛 Bug Fixes\r\n* fix(openai): thinking detection for `gpt-5.3-chat-latest` by @dsfaccini in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4567\r\n* fix: AG-UI follow-up messages failing after built-in tool use by @gcheshkov in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4624\r\n### 📦 Dependencies\r\n* fix: remediate open Dependabot security alerts by @dsfaccini in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4520\r\n\r\n## New Contributors\r\n* @gcheshkov made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4624\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.67.0...v1.68.0","2026-03-13T03:30:35",{"id":200,"version":201,"summary_zh":202,"released_at":203},180678,"v1.67.0","\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at main -->\r\n\r\n## What's Changed\r\n### 🚀 Features\r\n* Add GPT-5.4 support by @theadityarao in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4554\r\n* Support `WebSearchTool` for `OpenRouterModel` through OpenRouter plugins by @mochow13 in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4022\r\n* Rehaul Tavily search tool by @sarth6 in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4158\r\n* Enable native structured output support for Ollama provider by @OiPunk in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4536\r\n### 🐛 Bug Fixes\r\n* Add missing Vercel AI SDK v6 tool approval part types by @bendrucker in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4388\r\n\r\n## New Contributors\r\n* @theadityarao made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4554\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.66.0...v1.67.0","2026-03-06T22:31:21",{"id":205,"version":206,"summary_zh":207,"released_at":208},180679,"v1.66.0","\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at main -->\r\n\r\n## What's Changed\r\n### 🚀 Features\r\n* Enable native structured output for Qwen 3.5 models by @ggozad in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4534\r\n* Add Nano Banana 2 (`gemini-3.1-flash-image-preview`) by @adtyavrdhn in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4525\r\n### 🐛 Bug Fixes\r\n* Fix builtin tool availability checking when using `TemporalAgent` with multiple models by @mattbrandman in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4100\r\n* Fix `HasMatchingSpan` YAML export\u002Fimport round-trip for `SpanQuery` arguments by @debu-sinha in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4454\r\n\r\n## New Contributors\r\n* @debu-sinha made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4454\r\n* @advaitathreya made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4499\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.65.0...v1.66.0","2026-03-05T00:45:49",{"id":210,"version":211,"summary_zh":212,"released_at":213},180680,"v1.65.0","\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at main -->\r\n\r\n## What's Changed\r\n### 🚀 Features\r\n* Support files uploaded to providers via new `UploadedFile` object by @mattbrandman in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F3942\r\n* feat: add `gemini-3.1-flash-lite-preview` model by @rian-dolphin in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4517\r\n### 🐛 Bug Fixes\r\n* fix: add `__reduce__` to exception classes for pickle support by @OiPunk in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4504\r\n\r\n## New Contributors\r\n* @OiPunk made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4504\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.64.0...v1.65.0","2026-03-03T23:37:18",{"id":215,"version":216,"summary_zh":217,"released_at":218},180681,"v1.64.0","\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at main -->\r\n\r\n## What's Changed\r\n### 🚀 Features\r\n* feat: support `template=False` on `PromptedOutput` and `NativeOutput` to disable schema prompt by @DouweM in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4497\r\n### 🐛 Bug Fixes\r\n* Fix missing `run_id` on `ModelRequest` in UI adapter runs by @madanlalit in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4419\r\n* Wrap Google streaming errors as `ModelHTTPError`\u002F`ModelAPIError` by @saakshigupta2002 in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4437\r\n* fix(mcp): move `__aexit__` guard inside lock to prevent TOCTOU race by @jameslcowan in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4435\r\n* fix: `BaseToolCallPart.has_content()` incorrectly returns False for falsy arg values by @bsherifi in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4442\r\n* fix(anthropic): auto-fallback to streaming for high `max_tokens` by @DouweM in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4496\r\n* fix(vercel): Align `dump_messages` output with Vercel spec by @dsfaccini in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4196\r\n* fix: cancel sibling tasks on any exception in parallel tool execution by @LakshmiSravyaVedantham in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4502\r\n\r\n## New Contributors\r\n* @jameslcowan made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4435\r\n* @bsherifi made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4442\r\n* @LakshmiSravyaVedantham made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4502\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.63.0...v1.64.0","2026-03-02T23:45:27",{"id":220,"version":221,"summary_zh":222,"released_at":223},180682,"v1.63.0","\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at main -->\r\n\r\n## What's Changed\r\n### 🚀 Features\r\n* Add Gemini 3.1 Pro Preview support by @majdalsado in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4372\r\n* feat(gemini):  Logprob Support by @DRXD1000 in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4269\r\n* Add `args_validator` parameter to tools for pre-execution validation by @jerry-reevo in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4016\r\n### 🐛 Bug Fixes\r\n* Fix Temporal and DBOS MCP to use cached tools instead of fetching each time by @DouweM in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4331\r\n* Updated Cohere content item typing to fix the incompatibility by @DarthJuri in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4384\r\n* Fix Anthropic model on Bedrock incorrectly being treated as supporting json schema output by @vimota in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4369\r\n* fix(pydantic-evals): gracefully handle custom `TracerProviders` without `add_span_processor` by @AtharvaJaiswal005 in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4328\r\n* fix: use non-greedy regex in `strip_markdown_fences` to stop at closing fence by @sksvineeth in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4398\r\n* fix: add defaults for optional fields in OpenRouter streaming models by @majdalsado in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4371\r\n* Set `BuiltinToolCallPart.id` for OpenAI Responses WebSearch\u002FFileSearch by @yipstar in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4391\r\n* fix: Identify new messages by `run_id` instead of index by @madanlalit in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4086\r\n\r\n## New Contributors\r\n* @majdalsado made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4372\r\n* @DarthJuri made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4384\r\n* @AtharvaJaiswal005 made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4328\r\n* @sksvineeth made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4398\r\n* @DRXD1000 made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4269\r\n* @yipstar made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4391\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.62.0...v1.63.0","2026-02-23T17:47:53",{"id":225,"version":226,"summary_zh":227,"released_at":228},180683,"v1.62.0","\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at main -->\r\n\r\n## What's Changed\r\n### 🚀 Features\r\n* Add tool approval integration for Vercel AI adapter by @bendrucker in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F3772\r\n* Add LinePlot analysis type, ROCAUCEvaluator, and KolmogorovSmirnovEvaluator by @dmontagu in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4356\r\n### 🐛 Bug Fixes\r\n* Fix missing pages in llms.txt and llms-full.txt by @DouweM in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4355\r\n* Handle Groq `tool_use_failed` errors without tool name\u002Fargs by retrying by @DouweM in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4354\r\n* fix: handle content filter refusals for Google `prompt_feedback` and OpenAI refusals by @DouweM in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4315\r\n### 📦 Dependencies\r\n* bump `huggingface` to 1.3.4 by @dsfaccini in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4119\r\n* Use `griffelib` instead of `griffe` by @dsfaccini in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4313\r\n\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.61.0...v1.62.0","2026-02-19T04:47:51",{"id":230,"version":231,"summary_zh":232,"released_at":233},180684,"v1.61.0","\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at main -->\r\n\r\n## What's Changed\r\n### 🚀 Features\r\n* Support Python 3.14 by @Kludex in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4138\r\n### 📦 Dependencies\r\n* Upgrade anthropic to 0.80.0, add Claude Sonnet 4.6 by @DouweM in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4345\r\n\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.60.0...v1.61.0","2026-02-18T01:32:10",{"id":235,"version":236,"summary_zh":237,"released_at":238},180685,"v1.60.0","\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at main -->\r\n\r\n## What's Changed\r\n### 🚀 Features\r\n* Add ‍`video_url` support to `OpenRouterModel` by @Adversarian in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F3824\r\n* Add instrumentation version 4 to match OTel GenAI semantic conventions for multimodal input by @admackin in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4219\r\n### 🐛 Bug Fixes\r\n* Fix AG-UI `parent_message_id` for back-to-back builtin tool calls by @DouweM in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4332\r\n* Only suggest 'call a tool' in retry when tools are available by @Baniskos in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4234\r\n* Wrap `_stream_text_deltas` with `aclosing` to prevent `StopAsyncIteration` on client disconnect by @sheginabo in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4205\r\n\r\n## New Contributors\r\n* @SamKomesarook made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4327\r\n* @Baniskos made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4234\r\n* @Adversarian made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F3824\r\n* @sheginabo made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4205\r\n* @admackin made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4219\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.59.0...v1.60.0","2026-02-17T00:21:38",{"id":240,"version":241,"summary_zh":242,"released_at":243},180686,"v1.59.0","\u003C!-- Release notes generated using configuration in .github\u002Frelease.yml at main -->\r\n\r\n## What's Changed\r\n### 🚀 Features\r\n* Add `Model.model_id` property that returns `provider:model` by @tdevelope in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F3917\r\n* Add opt-in flag for aggregated usage attribute names by @thiagohora in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4277\r\n* Enhance `Contains` evaluator to support `pydantic.BaseModel` by @tomsquest in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4003\r\n* Vercel AI adapter: let `BaseChunk`s be injected through `ToolReturnPart.metadata` by @0xyjk in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4230\r\n### 🐛 Bug Fixes\r\n* XAI: lazily create AsyncClient per event loop to avoid gRPC loop mismatch by @DouweM in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4316\r\n\r\n## New Contributors\r\n* @tdevelope made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F3917\r\n* @thiagohora made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4277\r\n* @0xyjk made their first contribution in https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fpull\u002F4230\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-ai\u002Fcompare\u002Fv1.58.0...v1.59.0","2026-02-14T00:09:25"]