Skip to content

Commit 365192b

Browse files
authored
Merge branch 'main' into openai-response-model-base-url
2 parents 2c1b6ef + 9c31521 commit 365192b

Some content is hidden

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

85 files changed

+8581
-1464
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: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ jobs:
2626
# Typecheck both Python 3.10 and 3.13. We've had issues due to not checking against both.
2727
python-version: ["3.10", "3.13"]
2828
env:
29-
UV_PYTHON: ${{ matrix.python-version }}
3029
PYRIGHT_PYTHON: ${{ matrix.python-version }}
3130
steps:
3231
- uses: actions/checkout@v4
3332

3433
- uses: astral-sh/setup-uv@v5
3534
with:
35+
python-version: ${{ matrix.python-version }}
3636
enable-cache: true
37+
cache-suffix: lint
3738

3839
- name: Install dependencies
3940
run: uv sync --all-extras --all-packages --group lint
@@ -56,6 +57,7 @@ jobs:
5657
- uses: astral-sh/setup-uv@v5
5758
with:
5859
enable-cache: true
60+
cache-suffix: mypy
5961

6062
- name: Install dependencies
6163
run: uv sync --no-dev --group lint
@@ -70,6 +72,7 @@ jobs:
7072
- uses: astral-sh/setup-uv@v5
7173
with:
7274
enable-cache: true
75+
cache-suffix: docs
7376

7477
- run: uv sync --group docs
7578

@@ -107,6 +110,7 @@ jobs:
107110
- uses: astral-sh/setup-uv@v5
108111
with:
109112
enable-cache: true
113+
cache-suffix: live
110114

111115
- uses: pydantic/ollama-action@v3
112116
with:
@@ -138,7 +142,7 @@ jobs:
138142
test:
139143
name: test on ${{ matrix.python-version }} (${{ matrix.install.name }})
140144
runs-on: ubuntu-latest
141-
timeout-minutes: 15
145+
timeout-minutes: 20
142146
strategy:
143147
fail-fast: false
144148
matrix:
@@ -151,26 +155,27 @@ jobs:
151155
- name: all-extras
152156
command: "--all-extras"
153157
env:
154-
UV_PYTHON: ${{ matrix.python-version }}
155158
CI: true
156159
COVERAGE_PROCESS_START: ./pyproject.toml
157160
steps:
158161
- uses: actions/checkout@v4
159162

160163
- uses: astral-sh/setup-uv@v5
161164
with:
165+
python-version: ${{ matrix.python-version }}
162166
enable-cache: true
163-
prune-cache: false
167+
cache-suffix: ${{ matrix.install.name }}
164168

165169
- uses: denoland/setup-deno@v2
166170
with:
167171
deno-version: v2.x
168172

169173
- run: mkdir .coverage
170174

171-
- run: uv run mcp-run-python example --deps=numpy
172175
- run: uv sync --only-dev
173176

177+
- run: uv run mcp-run-python example --deps=numpy
178+
174179
- name: cache HuggingFace models
175180
uses: actions/cache@v4
176181
with:
@@ -193,22 +198,22 @@ jobs:
193198
test-lowest-versions:
194199
name: test on ${{ matrix.python-version }} (lowest-versions)
195200
runs-on: ubuntu-latest
196-
timeout-minutes: 15
201+
timeout-minutes: 20
197202
strategy:
198203
fail-fast: false
199204
matrix:
200205
python-version: ["3.10", "3.11", "3.12", "3.13"]
201206
env:
202-
UV_PYTHON: ${{ matrix.python-version }}
203207
CI: true
204208
COVERAGE_PROCESS_START: ./pyproject.toml
205209
steps:
206210
- uses: actions/checkout@v4
207211

208212
- uses: astral-sh/setup-uv@v5
209213
with:
214+
python-version: ${{ matrix.python-version }}
210215
enable-cache: true
211-
prune-cache: false
216+
cache-suffix: lowest-versions
212217

213218
- uses: denoland/setup-deno@v2
214219
with:
@@ -218,6 +223,8 @@ jobs:
218223

219224
- run: uv sync --group dev
220225

226+
- run: uv run mcp-run-python example --deps=numpy
227+
221228
- name: cache HuggingFace models
222229
uses: actions/cache@v4
223230
with:
@@ -226,8 +233,6 @@ jobs:
226233
restore-keys: |
227234
hf-${{ runner.os }}-
228235
229-
- run: uv run mcp-run-python example --deps=numpy
230-
231236
- run: unset UV_FROZEN
232237

233238
- run: uv run --all-extras --resolution lowest-direct coverage run -m pytest --durations=100 -n auto --dist=loadgroup
@@ -250,15 +255,15 @@ jobs:
250255
matrix:
251256
python-version: ["3.11", "3.12", "3.13"]
252257
env:
253-
UV_PYTHON: ${{ matrix.python-version }}
254258
CI: true
255259
steps:
256260
- uses: actions/checkout@v4
257261

258262
- uses: astral-sh/setup-uv@v5
259263
with:
264+
python-version: ${{ matrix.python-version }}
260265
enable-cache: true
261-
prune-cache: false
266+
cache-suffix: examples
262267

263268
- name: cache HuggingFace models
264269
uses: actions/cache@v4
@@ -288,6 +293,7 @@ jobs:
288293
- uses: astral-sh/setup-uv@v5
289294
with:
290295
enable-cache: true
296+
cache-suffix: dev
291297

292298
- run: uv sync --group dev
293299
- run: uv run coverage combine
@@ -343,6 +349,7 @@ jobs:
343349
- uses: astral-sh/setup-uv@v5
344350
with:
345351
enable-cache: true
352+
cache-suffix: docs-upload
346353

347354
- uses: actions/download-artifact@v4
348355
with:
@@ -384,6 +391,7 @@ jobs:
384391
- uses: astral-sh/setup-uv@v5
385392
with:
386393
enable-cache: true
394+
cache-suffix: deploy-docs-preview
387395

388396
- uses: actions/download-artifact@v4
389397
with:
@@ -431,6 +439,7 @@ jobs:
431439
- uses: astral-sh/setup-uv@v5
432440
with:
433441
enable-cache: true
442+
cache-suffix: release
434443

435444
- run: uv build --all-packages
436445

.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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

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 {

docs-site/wrangler.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ compatibility_date = "2025-06-17"
44
routes = ["ai.pydantic.dev/*"]
55
main = "src/index.ts"
66
workers_dev = false
7+
preview_urls = true
78
compatibility_flags = [ "nodejs_compat_v2" ]
89

910
[vars]

docs/agents.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ async def main():
103103
FinalResultEvent(tool_name=None, tool_call_id=None),
104104
PartDeltaEvent(index=0, delta=TextPartDelta(content_delta='Mexico is Mexico ')),
105105
PartDeltaEvent(index=0, delta=TextPartDelta(content_delta='City.')),
106+
PartEndEvent(
107+
index=0, part=TextPart(content='The capital of Mexico is Mexico City.')
108+
),
106109
AgentRunResultEvent(
107110
result=AgentRunResult(output='The capital of Mexico is Mexico City.')
108111
),

docs/api/ui/ag_ui.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# `pydantic_ai.ui.ag_ui`
2+
3+
::: pydantic_ai.ui.ag_ui
4+
5+
::: pydantic_ai.ui.ag_ui.app

0 commit comments

Comments
 (0)