Skip to content

Commit 0998a63

Browse files
committed
Merge main to stay updated with latest changes
2 parents 551d035 + 660c59a commit 0998a63

File tree

262 files changed

+37472
-2702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+37472
-2702
lines changed

.github/workflows/after-ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
steps:
1717
- uses: astral-sh/setup-uv@v5
1818
with:
19-
enable-cache: true
2019
python-version: "3.12"
2120

2221
- uses: dawidd6/action-download-artifact@v6
@@ -54,8 +53,9 @@ jobs:
5453

5554
- uses: astral-sh/setup-uv@v5
5655
with:
57-
enable-cache: true
5856
python-version: "3.12"
57+
enable-cache: true
58+
cache-suffix: deploy-docs-preview
5959

6060
- uses: dawidd6/action-download-artifact@v6
6161
with:
@@ -65,6 +65,7 @@ jobs:
6565
commit: ${{ github.event.workflow_run.head_sha }}
6666
allow_forks: true
6767
workflow_conclusion: completed
68+
if_no_artifact_found: warn
6869

6970
- uses: cloudflare/wrangler-action@v3
7071
id: deploy

.github/workflows/ci.yml

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,23 @@ permissions:
1818

1919
jobs:
2020
lint:
21+
name: lint on ${{ matrix.python-version }}
2122
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
# Typecheck both Python 3.10 and 3.13. We've had issues due to not checking against both.
27+
python-version: ["3.10", "3.13"]
28+
env:
29+
PYRIGHT_PYTHON: ${{ matrix.python-version }}
2230
steps:
2331
- uses: actions/checkout@v4
2432

2533
- uses: astral-sh/setup-uv@v5
2634
with:
35+
python-version: ${{ matrix.python-version }}
2736
enable-cache: true
37+
cache-suffix: lint
2838

2939
- name: Install dependencies
3040
run: uv sync --all-extras --all-packages --group lint
@@ -47,6 +57,7 @@ jobs:
4757
- uses: astral-sh/setup-uv@v5
4858
with:
4959
enable-cache: true
60+
cache-suffix: mypy
5061

5162
- name: Install dependencies
5263
run: uv sync --no-dev --group lint
@@ -61,6 +72,7 @@ jobs:
6172
- uses: astral-sh/setup-uv@v5
6273
with:
6374
enable-cache: true
75+
cache-suffix: docs
6476

6577
- run: uv sync --group docs
6678

@@ -98,6 +110,7 @@ jobs:
98110
- uses: astral-sh/setup-uv@v5
99111
with:
100112
enable-cache: true
113+
cache-suffix: live
101114

102115
- uses: pydantic/ollama-action@v3
103116
with:
@@ -129,7 +142,7 @@ jobs:
129142
test:
130143
name: test on ${{ matrix.python-version }} (${{ matrix.install.name }})
131144
runs-on: ubuntu-latest
132-
timeout-minutes: 10
145+
timeout-minutes: 20
133146
strategy:
134147
fail-fast: false
135148
matrix:
@@ -142,24 +155,35 @@ jobs:
142155
- name: all-extras
143156
command: "--all-extras"
144157
env:
145-
UV_PYTHON: ${{ matrix.python-version }}
146158
CI: true
147159
COVERAGE_PROCESS_START: ./pyproject.toml
148160
steps:
149161
- uses: actions/checkout@v4
150162

151163
- uses: astral-sh/setup-uv@v5
152164
with:
165+
python-version: ${{ matrix.python-version }}
153166
enable-cache: true
167+
cache-suffix: ${{ matrix.install.name }}
154168

155169
- uses: denoland/setup-deno@v2
156170
with:
157171
deno-version: v2.x
158172

159173
- run: mkdir .coverage
160174

161-
- run: uv run mcp-run-python example --deps=numpy
162175
- run: uv sync --only-dev
176+
177+
- run: uv run mcp-run-python example --deps=numpy
178+
179+
- name: cache HuggingFace models
180+
uses: actions/cache@v4
181+
with:
182+
path: ~/.cache/huggingface
183+
key: hf-${{ runner.os }}-${{ hashFiles('**/uv.lock') }}
184+
restore-keys: |
185+
hf-${{ runner.os }}-
186+
163187
- run: uv run ${{ matrix.install.command }} coverage run -m pytest --durations=100 -n auto --dist=loadgroup
164188
env:
165189
COVERAGE_FILE: .coverage/.coverage.${{ matrix.python-version }}-${{ matrix.install.name }}
@@ -174,21 +198,22 @@ jobs:
174198
test-lowest-versions:
175199
name: test on ${{ matrix.python-version }} (lowest-versions)
176200
runs-on: ubuntu-latest
177-
timeout-minutes: 10
201+
timeout-minutes: 20
178202
strategy:
179203
fail-fast: false
180204
matrix:
181205
python-version: ["3.10", "3.11", "3.12", "3.13"]
182206
env:
183-
UV_PYTHON: ${{ matrix.python-version }}
184207
CI: true
185208
COVERAGE_PROCESS_START: ./pyproject.toml
186209
steps:
187210
- uses: actions/checkout@v4
188211

189212
- uses: astral-sh/setup-uv@v5
190213
with:
214+
python-version: ${{ matrix.python-version }}
191215
enable-cache: true
216+
cache-suffix: lowest-versions
192217

193218
- uses: denoland/setup-deno@v2
194219
with:
@@ -197,8 +222,17 @@ jobs:
197222
- run: mkdir .coverage
198223

199224
- run: uv sync --group dev
225+
200226
- run: uv run mcp-run-python example --deps=numpy
201227

228+
- name: cache HuggingFace models
229+
uses: actions/cache@v4
230+
with:
231+
path: ~/.cache/huggingface
232+
key: hf-${{ runner.os }}-${{ hashFiles('**/uv.lock') }}
233+
restore-keys: |
234+
hf-${{ runner.os }}-
235+
202236
- run: unset UV_FROZEN
203237

204238
- run: uv run --all-extras --resolution lowest-direct coverage run -m pytest --durations=100 -n auto --dist=loadgroup
@@ -221,14 +255,23 @@ jobs:
221255
matrix:
222256
python-version: ["3.11", "3.12", "3.13"]
223257
env:
224-
UV_PYTHON: ${{ matrix.python-version }}
225258
CI: true
226259
steps:
227260
- uses: actions/checkout@v4
228261

229262
- uses: astral-sh/setup-uv@v5
230263
with:
264+
python-version: ${{ matrix.python-version }}
231265
enable-cache: true
266+
cache-suffix: examples
267+
268+
- name: cache HuggingFace models
269+
uses: actions/cache@v4
270+
with:
271+
path: ~/.cache/huggingface
272+
key: hf-${{ runner.os }}-${{ hashFiles('**/uv.lock') }}
273+
restore-keys: |
274+
hf-${{ runner.os }}-
232275
233276
- run: uv run --all-extras python tests/import_examples.py
234277

@@ -250,6 +293,7 @@ jobs:
250293
- uses: astral-sh/setup-uv@v5
251294
with:
252295
enable-cache: true
296+
cache-suffix: dev
253297

254298
- run: uv sync --group dev
255299
- run: uv run coverage combine
@@ -305,6 +349,7 @@ jobs:
305349
- uses: astral-sh/setup-uv@v5
306350
with:
307351
enable-cache: true
352+
cache-suffix: docs-upload
308353

309354
- uses: actions/download-artifact@v4
310355
with:
@@ -346,6 +391,7 @@ jobs:
346391
- uses: astral-sh/setup-uv@v5
347392
with:
348393
enable-cache: true
394+
cache-suffix: deploy-docs-preview
349395

350396
- uses: actions/download-artifact@v4
351397
with:
@@ -393,6 +439,7 @@ jobs:
393439
- uses: astral-sh/setup-uv@v5
394440
with:
395441
enable-cache: true
442+
cache-suffix: release
396443

397444
- run: uv build --all-packages
398445

.github/workflows/claude.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
- uses: astral-sh/setup-uv@v5
3838
with:
3939
enable-cache: true
40+
cache-suffix: claude-code
4041

4142
- uses: denoland/setup-deno@v2
4243
with:

.github/workflows/manually-deploy-docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- uses: astral-sh/setup-uv@v5
1414
with:
1515
enable-cache: true
16+
cache-suffix: docs
1617

1718
- run: uv sync --group docs
1819

@@ -54,6 +55,7 @@ jobs:
5455
- uses: astral-sh/setup-uv@v5
5556
with:
5657
enable-cache: true
58+
cache-suffix: docs-upload
5759

5860
- uses: actions/download-artifact@v4
5961
with:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env*/
1010
/TODO.md
1111
/postgres-data/
1212
.DS_Store
13-
examples/pydantic_ai_examples/.chat_app_messages.sqlite
13+
.chat_app_messages.sqlite
1414
.cache/
1515
.vscode/
1616
/question_graph_history.json

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
2828

2929
**Model Integration (`pydantic_ai_slim/pydantic_ai/models/`)**
3030
- Unified interface across providers: OpenAI, Anthropic, Google, Groq, Cohere, Mistral, Bedrock, HuggingFace
31-
- Model strings: `"openai:gpt-4o"`, `"anthropic:claude-3-5-sonnet"`, `"google:gemini-1.5-pro"`
31+
- Model strings: `"openai:gpt-5"`, `"anthropic:claude-sonnet-4-5"`, `"google:gemini-2.5-pro"`
3232
- `ModelRequestParameters` for configuration, `StreamedResponse` for streaming
3333

3434
**Graph-based Execution (`pydantic_graph/` + `_agent_graph.py`)**
@@ -55,7 +55,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
5555
class MyDeps:
5656
database: DatabaseConn
5757

58-
agent = Agent('openai:gpt-4o', deps_type=MyDeps)
58+
agent = Agent('openai:gpt-5', deps_type=MyDeps)
5959

6060
@agent.tool
6161
async def get_data(ctx: RunContext[MyDeps]) -> str:
@@ -69,7 +69,7 @@ class OutputModel(BaseModel):
6969
confidence: float
7070

7171
agent: Agent[MyDeps, OutputModel] = Agent(
72-
'openai:gpt-4o',
72+
'openai:gpt-5',
7373
deps_type=MyDeps,
7474
output_type=OutputModel
7575
)

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ lint: ## Lint the code
3636

3737
.PHONY: typecheck-pyright
3838
typecheck-pyright:
39+
@# To typecheck for a specific version of python, run 'make install-all-python' then set environment variable PYRIGHT_PYTHON=3.10 or similar
3940
@# PYRIGHT_PYTHON_IGNORE_WARNINGS avoids the overhead of making a request to github on every invocation
40-
PYRIGHT_PYTHON_IGNORE_WARNINGS=1 uv run pyright
41+
PYRIGHT_PYTHON_IGNORE_WARNINGS=1 uv run pyright $(if $(PYRIGHT_PYTHON),--pythonversion $(PYRIGHT_PYTHON))
4142

4243
.PHONY: typecheck-mypy
4344
typecheck-mypy:
@@ -51,7 +52,8 @@ typecheck-both: typecheck-pyright typecheck-mypy
5152

5253
.PHONY: test
5354
test: ## Run tests and collect coverage data
54-
uv run coverage run -m pytest -n auto --dist=loadgroup --durations=20
55+
@# To test using a specific version of python, run 'make install-all-python' then set environment variable PYTEST_PYTHON=3.10 or similar
56+
$(if $(PYTEST_PYTHON),UV_PROJECT_ENVIRONMENT=.venv$(subst .,,$(PYTEST_PYTHON))) uv run $(if $(PYTEST_PYTHON),--python $(PYTEST_PYTHON)) coverage run -m pytest -n auto --dist=loadgroup --durations=20
5557
@uv run coverage combine
5658
@uv run coverage report
5759

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ We built Pydantic AI with one simple aim: to bring that FastAPI feeling to GenAI
3939
[Pydantic Validation](https://docs.pydantic.dev/latest/) 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:
4040

4141
2. **Model-agnostic**:
42-
Supports virtually every [model](https://ai.pydantic.dev/models/overview) 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. If your favorite model or provider is not listed, you can easily implement a [custom model](https://ai.pydantic.dev/models/overview#custom-models).
42+
Supports virtually every [model](https://ai.pydantic.dev/models/overview) 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, and Outlines. If your favorite model or provider is not listed, you can easily implement a [custom model](https://ai.pydantic.dev/models/overview#custom-models).
4343

4444
3. **Seamless Observability**:
4545
Tightly [integrates](https://ai.pydantic.dev/logfire) with [Pydantic Logfire](https://pydantic.dev/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](https://ai.pydantic.dev/logfire#alternative-observability-backends).
@@ -50,8 +50,8 @@ Designed to give your IDE or AI coding agent as much context as possible for aut
5050
5. **Powerful Evals**:
5151
Enables you to systematically test and [evaluate](https://ai.pydantic.dev/evals) the performance and accuracy of the agentic systems you build, and monitor the performance over time in Pydantic Logfire.
5252

53-
6. **MCP, A2A, and AG-UI**:
54-
Integrates the [Model Context Protocol](https://ai.pydantic.dev/mcp/client), [Agent2Agent](https://ai.pydantic.dev/a2a), and [AG-UI](https://ai.pydantic.dev/ag-ui) 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.
53+
6. **MCP, A2A, and UI**:
54+
Integrates the [Model Context Protocol](https://ai.pydantic.dev/mcp/overview), [Agent2Agent](https://ai.pydantic.dev/a2a), and various [UI event stream](https://ai.pydantic.dev/ui/overview) 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.
5555

5656
7. **Human-in-the-Loop Tool Approval**:
5757
Easily lets you flag that certain tool calls [require approval](https://ai.pydantic.dev/deferred-tools#human-in-the-loop-tool-approval) before they can proceed, possibly depending on tool call arguments, conversation history, or user preferences.

clai/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ positional arguments:
7070
options:
7171
-h, --help show this help message and exit
7272
-m [MODEL], --model [MODEL]
73-
Model to use, in format "<provider>:<model>" e.g. "openai:gpt-4.1" or "anthropic:claude-sonnet-4-0". Defaults to "openai:gpt-4.1".
73+
Model to use, in format "<provider>:<model>" e.g. "openai:gpt-5" or "anthropic:claude-sonnet-4-5". Defaults to "openai:gpt-5".
7474
-a AGENT, --agent AGENT
7575
Custom Agent to use, in format "module:variable", e.g. "mymodule.submodule:my_agent"
7676
-l, --list-models List all available models and exit

docs-site/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const redirect_lookup: Record<string, string> = {
5555
'/examples': 'examples/setup/',
5656
'/mcp': '/mcp/overview/',
5757
'/models': '/models/overview/',
58+
'/ag-ui': '/ui/ag-ui/'
5859
}
5960

6061
function redirect(pathname: string): string | null {

0 commit comments

Comments
 (0)