Pydantic AI
Pydantic AI — агентный Python-фреймворк от команды Pydantic: типобезопасная разработка production-агентов на LLM с валидацией вывода.
PYPydantic
Фреймворк агентов
Python
★ 19.1k
Что это
Pydantic AI — агентный Python-фреймворк от команды Pydantic: типобезопасная разработка production-агентов на LLM с валидацией вывода.
Установка
Точная команда установки указана в официальном репозитории.
1Быстрый старт
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.
"""
Перед запуском настройте API-ключи и переменные окружения, перечисленные в официальной документации проекта.