Tác nhân & Đa tác nhân

Pydantic AI

pydantic/pydantic-ai

A Python agent framework designed to help developers build production-grade applications and workflows with Generative AI, emphasizing type-safety, structured validation, and ergonomic design.

★ 19,1KSố sao
⑂ 2,5KFork
673Vấn đề đang mở
PythonNgôn ngữ
MITGiấy phép
Q@project.QualityScoreĐiểm biên tập

Ảnh chụp màn hình dự án

Ảnh chụp màn hình của Pydantic AI Ảnh chụp màn hình của Pydantic AI

Tổng quan

Pydantic AI brings the developer experience popularized by FastAPI to GenAI agent development. Built by the Pydantic team, it leverages Pydantic Validation at its core to provide fully type-safe agents, structured output validation, and dependency injection. The framework is model-agnostic, supporting a wide array of LLM providers and allowing custom model implementations. It also features seamless observability integration with Pydantic Logfire, powerful evaluation tools, and extensible composable capabilities.

Tính năng chính

  • Built by the Pydantic Team leveraging Pydantic Validation
  • Model-agnostic support for numerous LLM providers and custom models
  • Fully type-safe design moving errors from runtime to write-time
  • Seamless observability integration with Pydantic Logfire and OpenTelemetry
  • Powerful evals for systematic testing and performance monitoring
  • Extensible by design using composable capabilities (e.g., web search, thinking, MCP)
  • Model Context Protocol (MCP) integration for external tools and data
  • UI event stream standards for interactive streaming applications
  • Human-in-the-loop tool approval
  • Durable execution for long-running and asynchronous workflows
  • Streamed structured outputs with immediate validation
  • Graph support for complex control flows
  • Dependency injection for type-safe behavior customization

Yêu cầu, cài đặt và bắt đầu nhanh

Follow the installation or quick-start section in the repository README and run its dependency setup commands. Repository: https://github.com/pydantic/pydantic-ai

Cách sử dụng

Define an agent with `Agent(model, deps_type=..., output_type=..., instructions=...)`. Register tools using the `@agent.tool` decorator and dynamic instructions with `@agent.instructions`. Run the agent synchronously with `agent.run_sync(prompt)` or asynchronously with `await agent.run(prompt, deps=...)`. Access validated structured output via `result.output`.

Khả năng tương thích của mô hình và trường hợp sử dụng

Model-agnostic. Supports OpenAI, Anthropic, Gemini, DeepSeek, Grok, Cohere, Mistral, Perplexity, Azure AI Foundry, Amazon Bedrock, Google Cloud, Ollama, LiteLLM, Groq, OpenRouter, Together AI, Fireworks AI, Cerebras, Hugging Face, GitHub, Heroku, Vercel, Nebius, OVHcloud, Alibaba Cloud, SambaNova, Snowflake Cortex, and Z.AI. Custom models can be implemented.

Ghi chú về giấy phép và rủi ro

MIT License.

Editorial verification 2026-08-09: repository URL, owner, description, license and repository statistics were reviewed. License metadata: MIT. README was fetched for the channel draft; re-check repository dependencies, releases and model terms before production use.

Phát hành và bảo trì

Not stated in the repository metadata.

Firecrawl

firecrawl/firecrawl

★ 161,1KTypeScript

LangChain

langchain-ai/langchain

★ 143,6KPython

RAGFlow

infiniflow/ragflow

★ 86,7KGo