[build-system]
requires = ["hatchling", "uv-dynamic-versioning>=0.7.0"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "uv-dynamic-versioning"

[tool.uv-dynamic-versioning]
vcs = "git"
style = "pep440"
bump = true

[project]
name = "pydantic-ai-slim"
dynamic = ["version", "dependencies", "optional-dependencies"]
description = "AI Agent Framework, the Pydantic way, slim package"
authors = [
    { name = "Douwe Maan", email = "douwe@pydantic.dev" },
    { name = "David Sanchez", email = "david.sanchez@pydantic.dev" },
    { name = "Aditya Vardhan", email = "aditya@pydantic.dev" },
    { name = "David Montague", email = "david@pydantic.dev" },
    { name = "Marcelo Trylesinski", email = "marcelotryle@gmail.com" },
    { name = "Alex Hall", email = "alex@pydantic.dev" },
    { name = "Samuel Colvin", email = "samuel@pydantic.dev" },
]
license = "MIT"
readme = "README.md"
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Programming Language :: Python",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3 :: Only",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: 3.14",
    "Intended Audience :: Developers",
    "Intended Audience :: Information Technology",
    "Intended Audience :: System Administrators",
    "License :: OSI Approved :: MIT License",
    "Operating System :: Unix",
    "Operating System :: POSIX :: Linux",
    "Environment :: Console",
    "Environment :: MacOS X",
    "Topic :: Software Development :: Libraries :: Python Modules",
    "Topic :: Internet",
]
requires-python = ">=3.10"

[project.urls]
Homepage = "https://github.com/pydantic/pydantic-ai/tree/main/pydantic_ai_slim"
Source = "https://github.com/pydantic/pydantic-ai/tree/main/pydantic_ai_slim"
Documentation = "https://ai.pydantic.dev/install/#slim-install"
Changelog = "https://github.com/pydantic/pydantic-ai/releases"

[tool.hatch.metadata.hooks.uv-dynamic-versioning]
dependencies = [
    # `anyio>=4.7.0` is required for cancellation delivery our streaming teardown relies on:
    # on 4.6.0 and below, `test_streaming_handoff_survives_absorbed_cancellation` deadlocks (#6422).
    "anyio>=4.7.0",
    "griffelib>=2.0",
    "httpx>=0.27",
    "pydantic>=2.12",
    "pydantic-graph=={{ version }}",
    "exceptiongroup>=1.2.2; python_version < '3.11'",
    "opentelemetry-api>=1.28.0",
    "typing-inspection>=0.4.0",
    "genai-prices>=0.1.0",
]

[tool.hatch.metadata.hooks.uv-dynamic-versioning.optional-dependencies]
# WARNING if you add optional groups, please update docs/install.md
logfire = ["logfire[httpx]>=4.16.0"]
# Models
openai = ["openai>=2.45.0", "tiktoken>=0.12.0"]
cohere = ["cohere>=5.20.6; platform_system != 'Emscripten'"]
google = ["google-genai>=1.70.0"]
anthropic = ["anthropic>=0.108.0"]
xai = ["xai-sdk>=1.14.0"]
groq = ["groq>=0.25.0"]
openrouter = ["openai>=2.45.0"]
# `mistralai>=2.4.2` is required for the `prompt_cache_key` parameter on `chat.complete_async`
# and `chat.stream_async` (also covers the `reasoning_effort` parameter, which needed >=2.0.5).
# `mistralai==2.4.6` was quarantined on PyPI due to a supply-chain attack (see #5382).
mistral = ["mistralai>=2.4.2,!=2.4.6"]
bedrock = ["boto3>=1.42.63"]
# Amazon Bedrock Mantle serves OpenAI models through an OpenAI-compatible API via `AsyncBedrockOpenAI`,
# which needs `openai` and (for AWS SigV4 auth) `botocore`; the bearer-token path needs `openai` alone.
bedrock-mantle = ["openai>=2.45.0", "botocore>=1.42.63"]
zai = ["openai>=2.45.0"]
snowflake = ["openai>=2.45.0"]
crusoe = ["openai>=2.45.0"]
cerebras = ["openai>=2.45.0"]
huggingface = [
    "huggingface-hub>=1.3.4,<2.0.0",
    # huggingface_hub 1.3.x still calls the deprecated hf_xet.download_files() API.
    "hf-xet<1.5.0; platform_machine == 'x86_64' or platform_machine == 'amd64' or platform_machine == 'AMD64' or platform_machine == 'arm64' or platform_machine == 'aarch64'",
]
sentence-transformers = ["sentence-transformers>=5.2.0; python_version < '3.14'"]
# 3.14 pin removable once voyageai 0.3.8 drops: https://pypi.org/project/voyageai/#history
voyageai = ["voyageai>=0.3.7; python_version < '3.14'"]
# Tools
duckduckgo = ["ddgs>=9.0.0"]
tavily = ["tavily-python>=0.5.0"]
exa = ["exa-py>=2.0.0"]
web-fetch = ["markdownify>=1.2"]
# CLI
cli = [
    "rich>=13",
    "prompt-toolkit>=3",
    "argcomplete>=3.5.0",
    "pyperclip>=1.9.0",
    "pyyaml>=6.0.2",
]
# Realtime (bidirectional speech-to-speech streaming sessions)
realtime = ["websockets>=14.0"]
# Per-provider realtime bundles: the provider SDK group plus the realtime transport deps.
# `websockets` is intentionally a direct dependency here (via `realtime`) even where a provider
# SDK happens to bring it transitively, so the realtime stack never leans on another package's
# dependency tree. xAI includes `openai` because its realtime API reuses the OpenAI codec, whose
# event types come from the OpenAI SDK.
openai-realtime = ["pydantic-ai-slim[openai,realtime]"]
google-realtime = ["pydantic-ai-slim[google,realtime]"]
xai-realtime = ["pydantic-ai-slim[xai,openai,realtime]"]
# MCP — `fastmcp-slim[client]` is the lightweight client-only distribution (no Starlette /
# Uvicorn server stack). Pulls the `mcp` SDK transitively. For an in-process FastMCP server,
# install the full `fastmcp` package directly alongside `[mcp]`. FastMCP 4 (MCP SDK v2) is
# supported concurrently with FastMCP 3; resolvers only select FastMCP 4 with a pre-release opt-in
# until 4.0.0 ships (#6661).
mcp = ["fastmcp-slim[client]>=3.3.0,<5"]
# Explicit task execution (`use_task=True`) on FastMCP 4, where tasks live in the separate
# `fastmcp-tasks` extension. Kept out of `[mcp]` mirroring fastmcp's own opt-in `tasks` extra:
# it pulls the full FastMCP server stack, and ordinary calls drive task-only tools to
# completion without it. `<5` matches the `[mcp]` cap. The direct `fastmcp-slim` floor spells
# out that this extra implies FastMCP 4 and opts resolvers into the pre-release, which
# `fastmcp-tasks`'s transitive pin alone does not.
mcp-tasks = ["fastmcp-tasks>=4.0.0b1,<5", "fastmcp-slim[client]>=4.0.0b1,<5"]
# Evals
evals = ["pydantic-evals=={{ version }}"]
# UI
ui = ["starlette>=0.46.2"]
# AG-UI
ag-ui = ["ag-ui-protocol>=0.1.10", "starlette>=0.46.2"]
# Web — Starlette is floored higher here than in the `ui` and `ag-ui` extras because this extra
# runs an HTTP server we ship (`Agent.to_web()` / `clai web`), so its Starlette version is ours to
# pick. The adapters in `ui`/`ag-ui` are mounted into the user's own application, which owns its
# own Starlette version; raising their floor would force a FastAPI upgrade on them for surfaces
# they, not we, expose.
web = ["starlette>=1.3.1", "httpx>=0.27.0", "uvicorn>=0.38.0"]
# Retries
retries = ["tenacity>=8.2.3"]
# Temporal
temporal = ["temporalio>=1.24.0"]
# DBOS
dbos = ["dbos>=2.10.0"]
# Prefect
prefect = ["prefect>=3.7.5"]
# Spec (YAML agent specs)
spec = ["pyyaml>=6.0.2", "pydantic-handlebars>=0.1.0"]

[tool.hatch.metadata]
allow-direct-references = true

[project.scripts]
pai = "pydantic_ai._cli:cli_exit" # TODO remove this when clai has been out for a while

[tool.hatch.build.targets.wheel]
packages = ["pydantic_ai"]

[tool.uv.sources]
pydantic-graph = { workspace = true }
