Skip to content

Commit 88f2945

Browse files
authored
Merge branch 'main' into fix-makefile
2 parents 227cdcd + 9c31521 commit 88f2945

File tree

285 files changed

+39383
-3398
lines changed

Some content is hidden

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

285 files changed

+39383
-3398
lines changed

.github/workflows/after-ci.yml

Lines changed: 11 additions & 7 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
@@ -46,6 +45,10 @@ jobs:
4645
name: deploy-docs-preview
4746

4847
steps:
48+
- run: echo "$GITHUB_EVENT_JSON"
49+
env:
50+
GITHUB_EVENT_JSON: ${{ toJSON(github.event) }}
51+
4952
- uses: actions/checkout@v4
5053

5154
- uses: actions/setup-node@v4
@@ -54,20 +57,24 @@ jobs:
5457

5558
- uses: astral-sh/setup-uv@v5
5659
with:
57-
enable-cache: true
5860
python-version: "3.12"
61+
enable-cache: true
62+
cache-suffix: deploy-docs-preview
5963

60-
- uses: dawidd6/action-download-artifact@v6
64+
- id: download-artifact
65+
uses: dawidd6/action-download-artifact@v6
6166
with:
6267
workflow: ci.yml
6368
name: site
6469
path: site
6570
commit: ${{ github.event.workflow_run.head_sha }}
6671
allow_forks: true
6772
workflow_conclusion: completed
73+
if_no_artifact_found: warn
6874

6975
- uses: cloudflare/wrangler-action@v3
7076
id: deploy
77+
if: steps.download-artifact.outputs.found_artifact == 'true'
7178
with:
7279
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
7380
environment: previews
@@ -77,12 +84,9 @@ jobs:
7784
--var GIT_COMMIT_SHA:${{ github.event.workflow_run.head_sha }}
7885
--var GIT_BRANCH:${{ github.event.workflow_run.head_branch }}
7986
80-
- run: echo "$GITHUB_EVENT_JSON"
81-
env:
82-
GITHUB_EVENT_JSON: ${{ toJSON(github.event) }}
83-
8487
- name: Set preview URL
8588
run: uv run --no-project --with httpx .github/set_docs_pr_preview_url.py
89+
if: steps.deploy.outcome == 'success'
8690
env:
8791
DEPLOY_OUTPUT: ${{ steps.deploy.outputs.command-output }}
8892
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,9 @@ lint: ## Lint the code
5050

5151
.PHONY: typecheck-pyright
5252
typecheck-pyright:
53-
ifeq ($(DETECTED_OS),Windows)
54-
@set PYRIGHT_PYTHON_IGNORE_WARNINGS=1 & uv run pyright
55-
else
53+
@# To typecheck for a specific version of python, run 'make install-all-python' then set environment variable PYRIGHT_PYTHON=3.10 or similar
5654
@# PYRIGHT_PYTHON_IGNORE_WARNINGS avoids the overhead of making a request to github on every invocation
57-
PYRIGHT_PYTHON_IGNORE_WARNINGS=1 uv run pyright
58-
endif
55+
PYRIGHT_PYTHON_IGNORE_WARNINGS=1 uv run pyright $(if $(PYRIGHT_PYTHON),--pythonversion $(PYRIGHT_PYTHON))
5956

6057
.PHONY: typecheck-mypy
6158
typecheck-mypy:
@@ -69,7 +66,8 @@ typecheck-both: typecheck-pyright typecheck-mypy
6966

7067
.PHONY: test
7168
test: ## Run tests and collect coverage data
72-
uv run coverage run -m pytest -n auto --dist=loadgroup --durations=20
69+
@# To test using a specific version of python, run 'make install-all-python' then set environment variable PYTEST_PYTHON=3.10 or similar
70+
$(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
7371
@uv run coverage combine
7472
@uv run coverage report
7573

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. 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)