Skip to content

Commit c7cec68

Browse files
authored
Cap pydantic-ai-skills below 2 for the Common AI skills extra (#74899)
1 parent 20ccfcd commit c7cec68

8 files changed

Lines changed: 44 additions & 21 deletions

File tree

‎providers/common/ai/README.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Extra Dependencies
9999
``openshell`` ``openshell>=0.1.2,<0.2``, ``grpcio>=1.78.0``, ``protobuf>=6.31.1``
100100
``code-mode`` ``pydantic-ai-harness[codemode]>=0.35.0``
101101
``shields`` ``pydantic-ai-shields>=0.3.4``
102-
``skills`` ``apache-airflow-providers-git>=0.4.0``, ``pydantic-ai-skills>=1.2.0``
102+
``skills`` ``apache-airflow-providers-git>=0.4.0``, ``pydantic-ai-skills>=1.2.0,<2``
103103
``islo`` ``islo>=0.3.19``
104104
``avro`` ``fastavro>=1.10.0; python_version < "3.14"``, ``fastavro>=1.12.1; python_version >= "3.14"``
105105
``parquet`` ``pyarrow>=18.0.0; python_version < '3.14'``, ``pyarrow>=22.0.0; python_version >= '3.14'``

‎providers/common/ai/docs/features.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ checklist.
126126
``apache.iceberg`` extra for Iceberg
127127
* - :doc:`AgentSkillsToolset <toolsets/skills>`
128128
- Loads ``SKILL.md`` instruction bundles when the model asks for one.
129-
- ``skills``; on Airflow 2, install ``pydantic-ai-skills``
129+
- ``skills``; on Airflow 2, install ``pydantic-ai-skills>=1.2.0,<2``
130130
* - :doc:`SandboxToolset <sandbox/index>`
131131
- Gives the agent a shell and a filesystem in an isolated sandbox: a hosted
132132
service, a server you run, or a microVM on your machine for local development.

‎providers/common/ai/docs/index.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ Extra Dependencies
239239
``openshell`` ``openshell>=0.1.2,<0.2``, ``grpcio>=1.78.0``, ``protobuf>=6.31.1``
240240
``code-mode`` ``pydantic-ai-harness[codemode]>=0.35.0``
241241
``shields`` ``pydantic-ai-shields>=0.3.4``
242-
``skills`` ``apache-airflow-providers-git>=0.4.0``, ``pydantic-ai-skills>=1.2.0``
242+
``skills`` ``apache-airflow-providers-git>=0.4.0``, ``pydantic-ai-skills>=1.2.0,<2``
243243
``islo`` ``islo>=0.3.19``
244244
``avro`` ``fastavro>=1.10.0; python_version < "3.14"``, ``fastavro>=1.12.1; python_version >= "3.14"``
245245
``parquet`` ``pyarrow>=18.0.0; python_version < '3.14'``, ``pyarrow>=22.0.0; python_version >= '3.14'``

‎providers/common/ai/pyproject.toml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,11 @@ dependencies = [
136136
# the git provider supplies GitHook + GitPython for cloning GitSkills with
137137
# credentials from a `git` connection. pydantic-ai-harness's Skills capability is not
138138
# a replacement: it loads only SKILL.md instructions, with no skill resources and no
139-
# run_skill_script.
139+
# run_skill_script. pydantic-ai-skills 2.0 removed SkillsToolset, which AgentSkillsToolset
140+
# wraps, so the extra stays below 2 until the toolset moves to the 2.x capability API.
140141
"skills" = [
141142
"apache-airflow-providers-git>=0.4.0",
142-
"pydantic-ai-skills>=1.2.0",
143+
"pydantic-ai-skills>=1.2.0,<2",
143144
]
144145
# Islo-hosted microVM sandboxes for SandboxToolset: like modal, needs no host-level
145146
# installation, only ISLO_API_KEY in the worker environment.
@@ -190,7 +191,7 @@ dev = [
190191
# Additional devel dependencies (do not remove this line and add extra development dependencies)
191192
"sqlglot>=30.0.0",
192193
"pydantic-ai-slim[mcp]>=2.36.0",
193-
"pydantic-ai-skills>=1.2.0",
194+
"pydantic-ai-skills>=1.2.0,<2",
194195
"apache-airflow-providers-common-sql[datafusion]",
195196
"langchain>=1.0.0",
196197
"llama-index-core>=0.14.5",

‎providers/common/ai/src/airflow/providers/common/ai/toolsets/skills.py‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@
3131
from __future__ import annotations
3232

3333
import dataclasses
34+
from importlib import metadata
3435
from typing import TYPE_CHECKING, Any
3536

3637
from airflow.providers.common.ai.skills import SkillSource, _materialize_skills
3738
from airflow.providers.common.ai.utils.toolset_base import validate_max_retries
3839

40+
# pydantic-ai-skills 2.0 removed SkillsToolset, leaving only SkillsCapability, so the
41+
# ``skills`` extra caps it below 2.
42+
_SUPPORTED_PYDANTIC_AI_SKILLS = ">=1.2.0,<2"
43+
3944
try:
4045
from pydantic_ai.toolsets.abstract import AbstractToolset
4146
except ImportError: # pragma: no cover - pydantic-ai is a provider dependency
@@ -114,13 +119,22 @@ async def for_run(self, ctx: RunContext) -> AbstractToolset:
114119

115120
async def __aenter__(self) -> AgentSkillsToolset:
116121
# Resolve + clone at run time, on the worker -- not at DAG-parse time.
122+
# pydantic-ai-skills is an optional extra, so it is imported here rather than at module level.
117123
try:
118-
from pydantic_ai_skills import SkillsToolset
124+
import pydantic_ai_skills
119125
except ImportError as e:
120126
raise ValueError(
121127
"AgentSkillsToolset requires the optional 'skills' extra: "
122128
"pip install 'apache-airflow-providers-common-ai[skills]'."
123129
) from e
130+
if not hasattr(pydantic_ai_skills, "SkillsToolset"):
131+
raise ValueError(
132+
f"AgentSkillsToolset needs pydantic-ai-skills{_SUPPORTED_PYDANTIC_AI_SKILLS}, but "
133+
f"pydantic-ai-skills {metadata.version('pydantic-ai-skills')} is installed and has no "
134+
"SkillsToolset. Install a supported version: "
135+
f"pip install 'pydantic-ai-skills{_SUPPORTED_PYDANTIC_AI_SKILLS}'."
136+
)
137+
SkillsToolset = pydantic_ai_skills.SkillsToolset
124138

125139
directories, cleanup = _materialize_skills(self._sources)
126140
self._cleanup = cleanup

‎providers/common/ai/tests/unit/common/ai/toolsets/test_skills.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import asyncio
2626
import sys
27+
import types
2728
from unittest.mock import MagicMock, patch
2829

2930
import pytest
@@ -229,6 +230,22 @@ def test_helpful_error_when_package_missing(self):
229230
with pytest.raises(ValueError, match=r"\[skills\]"):
230231
asyncio.run(toolset.__aenter__())
231232

233+
def test_unsupported_installed_version_names_version_and_range(self, tmp_path):
234+
"""pydantic-ai-skills 2.x imports but has no SkillsToolset; the error must not blame the extra."""
235+
agent = Agent(
236+
FunctionModel(lambda messages, info: ModelResponse(parts=[TextPart("done")])),
237+
toolsets=[AgentSkillsToolset(sources=[str(tmp_path)])],
238+
)
239+
without_skills_toolset = types.ModuleType("pydantic_ai_skills")
240+
with (
241+
patch.dict(sys.modules, {"pydantic_ai_skills": without_skills_toolset}),
242+
patch("importlib.metadata.version", autospec=True, return_value="2.1.0"),
243+
):
244+
with pytest.raises(
245+
ValueError, match=r"pydantic-ai-skills>=1\.2\.0,<2, but pydantic-ai-skills 2\.1\.0"
246+
):
247+
agent.run_sync("go")
248+
232249

233250
async def _enter_exit(toolset):
234251
await toolset.__aenter__()

‎pyproject.toml‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,12 +1634,6 @@ apache-airflow-task-sdk-integration-tests = false
16341634

16351635
# Manual overrides (kept outside the auto-generated block above so the
16361636
# update_airflow_pyproject_toml.py script doesn't clobber them).
1637-
# Temporary: pydantic-ai-skills 1.2.0 (adds exclude_resources, required by the
1638-
# apache-airflow-providers-common-ai[skills] floor) was published 2026-07-15,
1639-
# inside the "4 days" exclude-newer window. This pins the per-package cutoff just
1640-
# past that release so 1.2.0 resolves while any later release stays quarantined.
1641-
# Remove once the rolling window advances past 2026-07-15.
1642-
pydantic-ai-skills = "2026-07-16T00:00:00Z"
16431637
# Temporary: google-cloud-aiplatform 1.164.0 is the first release whose "evaluation" extra
16441638
# allows the litellm versions that carry the Python 3.14 security fixes, and it was published
16451639
# 2026-08-12, inside the "4 days" exclude-newer window. This pins the per-package cutoff just
@@ -1841,8 +1835,6 @@ apache-airflow-task-sdk-integration-tests = false
18411835

18421836
# Manual overrides — see the matching block under
18431837
# `[tool.uv.exclude-newer-package]` above for rationale.
1844-
# Temporary: see the pydantic-ai-skills note in `[tool.uv.exclude-newer-package]`.
1845-
pydantic-ai-skills = "2026-07-16T00:00:00Z"
18461838
# Temporary: see the google-cloud-aiplatform note in `[tool.uv.exclude-newer-package]`.
18471839
google-cloud-aiplatform = "2026-08-13T00:00:00Z"
18481840
# Temporary: see the typesafe-sdk note in `[tool.uv.exclude-newer-package]`.

‎uv.lock‎

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)