Skip to content

Commit 7ca2bd2

Browse files
committed
Drop crewai from workspace install path; users install separately
crewai 1.14.x ships tight conservative pins (click~=8.1.7, tomli~=2.0.2, plus a crewai-cli that pulls textual>=7.5 -> rich>=14.2) that conflict with Airflow's resolved click 8.3+, tomli 2.4+, and FAB's transitive rich<14. uv can satisfy the install via override-dependencies, but the CI image build runs ``pip check`` (see scripts/docker/install_airflow_when_building_images.sh) which treats the metadata mismatch as fatal. The cleanest fix is to keep crewai out of Airflow's resolution entirely: - Remove the ``[project.optional-dependencies] crewai`` extra from the provider pyproject. There's now nothing for uv to resolve against crewai's pins -- the root override-dependencies and crewai-* cooldown bypass are no longer needed. - Drop crewai from the provider's dev dependency group. - Document in docs/hooks/crewai.rst that users ``pip install "crewai>=1.14.5"`` themselves after installing common-ai. - Stub ``crewai`` in ``sys.modules`` for the hook tests (mirrors the langchain-stub pattern from #67237 -- justified for crewai because the pin conflict makes installation in CI infeasible). The hook itself is unchanged; users who want it install crewai into their own venv where they've accepted the pin cascade. The lock no longer carries crewai / chromadb / onnxruntime entries.
1 parent 068f45a commit 7ca2bd2

5 files changed

Lines changed: 1499 additions & 246 deletions

File tree

providers/common/ai/docs/hooks/crewai.rst

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Supported providers
5151

5252
The hook forwards ``conn.password`` as ``api_key`` and ``conn.host`` as
5353
``base_url`` to ``crewai.LLM``. The combinations that work out of the box
54-
with just the ``crewai`` extra installed:
54+
with just ``crewai`` installed:
5555

5656
- ``openai/gpt-4o``, ``openai/gpt-4o-mini``
5757
- ``openai/...`` against an OpenAI-compatible endpoint, with ``host`` pointing
@@ -107,16 +107,26 @@ Parameters
107107
Dependencies
108108
------------
109109

110-
Install the ``crewai`` extra to use this hook::
110+
Install ``crewai`` separately into your venv after installing the
111+
``common-ai`` provider::
111112

112-
pip install apache-airflow-providers-common-ai[crewai]
113+
pip install apache-airflow-providers-common-ai
114+
pip install "crewai>=1.14.5"
113115

114-
That extra installs ``crewai`` itself (which depends on ``openai`` and
115-
``anthropic`` at runtime). For other providers, install CrewAI's own
116-
``litellm`` extra plus the vendor SDK separately, e.g.::
116+
There is intentionally **no** ``[crewai]`` extra on this provider. crewai
117+
1.14.x ships tight conservative pins (``click~=8.1.7``, ``tomli~=2.0.2``,
118+
plus a ``crewai-cli`` co-dependency that pulls ``textual>=7.5`` →
119+
``rich>=14.2``) that conflict with Airflow's own resolved ``click>=8.3``,
120+
``tomli>=2.4``, and FAB's transitive ``rich<14``. uv can resolve the
121+
mismatch via ``override-dependencies``, but the CI image build runs
122+
``pip check`` afterwards and treats the metadata conflict as fatal. The
123+
cleanest answer is to keep crewai out of Airflow's lock entirely; users
124+
who accept the pin cascade install crewai themselves.
117125

118-
pip install "crewai[litellm]" langchain-mistralai
126+
For non-OpenAI / non-Anthropic providers, install CrewAI's own
127+
``litellm`` extra plus the vendor SDK::
119128

120-
The ``crewai`` extra is currently gated on ``python_version < "3.14"`` because
121-
CrewAI 1.14.x publishes only ``<3.14,>=3.10`` wheels. Newer Python envs will
122-
silently skip the extra.
129+
pip install "crewai[litellm]>=1.14.5" langchain-mistralai
130+
131+
CrewAI 1.14.x publishes wheels for Python 3.10-3.13; 3.14 isn't supported
132+
upstream yet.

providers/common/ai/pyproject.toml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,17 @@ dependencies = [
103103
"llama-index-embeddings-openai>=0.6.0",
104104
"llama-index-llms-openai>=0.6.0",
105105
]
106-
# crewai pulls chromadb, which transitively requires onnxruntime.
107-
# onnxruntime >=1.24 dropped cp310 wheels, and crewai itself caps Python
108-
# to <3.14. Gate the extra to 3.11-3.13 so 3.10 / 3.14 envs don't fail
109-
# to resolve.
110-
"crewai" = [
111-
'crewai>=1.14.5; python_version >= "3.11" and python_version < "3.14"',
112-
]
106+
# crewai is intentionally NOT declared as an optional extra here. crewai
107+
# 1.14.x ships tight conservative pins (click~=8.1.7, tomli~=2.0.2, and
108+
# a crewai-cli that pulls textual>=7.5 → rich>=14.2) that conflict with
109+
# Airflow's own resolved click 8.3+, tomli 2.4+, and FAB's transitive
110+
# rich<14. uv can satisfy the install via override-dependencies, but
111+
# Airflow's CI image build runs ``pip check`` afterwards (see
112+
# scripts/docker/install_airflow_when_building_images.sh) which treats
113+
# the metadata mismatch as fatal. Users who want the CrewAI hook should
114+
# ``pip install crewai>=1.14.5`` into their venv after installing
115+
# common-ai; see docs/hooks/crewai.rst. Hook tests stub ``crewai`` in
116+
# ``sys.modules``.
113117
"pdf" = ["pypdf>=4.0.0"]
114118
"docx" = ["python-docx>=1.0.0"]
115119

@@ -129,7 +133,10 @@ dev = [
129133
"llama-index-core>=0.13.0",
130134
"llama-index-embeddings-openai>=0.6.0",
131135
"llama-index-llms-openai>=0.6.0",
132-
'crewai>=1.14.5; python_version >= "3.11" and python_version < "3.14"',
136+
# crewai deliberately NOT listed here, and also NOT declared as an
137+
# optional extra above -- see the comment under
138+
# ``[project.optional-dependencies]`` for the pip-check rationale.
139+
# Tests stub ``crewai`` in ``sys.modules``.
133140
]
134141

135142
# To build docs:

providers/common/ai/tests/unit/common/ai/hooks/test_crewai.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,29 @@
1616
# under the License.
1717
from __future__ import annotations
1818

19+
import sys
1920
from unittest.mock import MagicMock, patch
2021

2122
import pytest
2223

2324
from airflow.providers.common.ai.hooks.crewai import CrewAIHook
2425

2526

27+
@pytest.fixture(autouse=True)
28+
def _stub_crewai_module():
29+
"""Stub ``crewai`` in sys.modules so @patch can resolve targets without
30+
the real package installed.
31+
32+
crewai is intentionally NOT in the provider's dev group (see
33+
``providers/common/ai/pyproject.toml`` for the rationale -- crewai's
34+
pins conflict with Airflow's resolved click/tomli/rich and break the
35+
CI image build's ``pip check``). Tests have to stub it explicitly.
36+
"""
37+
crewai_mod = MagicMock()
38+
with patch.dict(sys.modules, {"crewai": crewai_mod}):
39+
yield
40+
41+
2642
def _conn(password: str = "", host: str = "", extra: dict | None = None) -> MagicMock:
2743
mock_conn = MagicMock()
2844
mock_conn.password = password

pyproject.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,23 @@ no-build-isolation-package = ["sphinx-redoc"]
13951395
# Synchroonize with scripts/ci/prek/upgrade_important_versions.py
13961396
exclude-newer = "4 days"
13971397

1398+
# crewai 1.14.x carries dep pins that conflict with the rest of the Airflow
1399+
# workspace. Override them upstream-style so the resolver picks
1400+
# Airflow-compatible versions and trusts the runtime: click 8.x is
1401+
# API-stable, and rich 14 only added APIs over 13 (no breaking removals
1402+
# crewai-cli/textual hit). Remove these overrides once crewai loosens its
1403+
# pins upstream (https://github.com/crewAIInc/crewAI).
1404+
# - click: crewai pins ``~=8.1.7`` vs breeze's ``>=8.3.0``.
1405+
# - rich: crewai-cli's textual>=7.5 pulls ``rich>=14.2`` vs
1406+
# flask-limiter's ``rich<14`` (FAB transitive).
1407+
# - tomli: crewai pins ``>=2.0.2,<2.1`` vs airflow-ctl's
1408+
# datamodel-code-generator==0.33.0 which needs ``tomli>=2.2.1``.
1409+
override-dependencies = [
1410+
"click>=8.1.7",
1411+
"rich>=13.6.0",
1412+
"tomli>=2.0.2",
1413+
]
1414+
13981415
[tool.uv.exclude-newer-package]
13991416
# Automatically generated exclude-newer-package entries (update_airflow_pyproject_toml.py)
14001417
apache-airflow = false
@@ -1541,6 +1558,17 @@ apache-aurflow-docker-stack = false
15411558
# REMOVE BY 2026-05-01 — once 0.11.8 is older than the global 4-day cooldown
15421559
# this override is redundant and should be deleted along with the line below.
15431560
uv = "12 hours"
1561+
# crewai 1.14.5 and its co-published siblings (crewai-cli, crewai-core,
1562+
# crewai-files, crewai-tools) were released on 2026-05-18. crewai 1.14.0
1563+
# was yanked, so 1.14.5 is the floor we need. Without these overrides the
1564+
# global 4-day cooldown blocks resolution until ~2026-05-22.
1565+
# REMOVE BY 2026-05-23 along with the matching block in
1566+
# [tool.uv.pip.exclude-newer-package] below.
1567+
crewai = "2026-05-19"
1568+
crewai-cli = "2026-05-19"
1569+
crewai-core = "2026-05-19"
1570+
crewai-files = "2026-05-19"
1571+
crewai-tools = "2026-05-19"
15441572

15451573
[tool.uv.pip]
15461574
# Synchroonize with scripts/ci/prek/upgrade_important_versions.py
@@ -1685,6 +1713,12 @@ apache-aurflow-docker-stack = false
16851713
# `[tool.uv.exclude-newer-package]` above for rationale.
16861714
# REMOVE BY 2026-05-01 along with the matching entry above.
16871715
uv = "12 hours"
1716+
# REMOVE BY 2026-05-23 along with the matching block above.
1717+
crewai = "2026-05-19"
1718+
crewai-cli = "2026-05-19"
1719+
crewai-core = "2026-05-19"
1720+
crewai-files = "2026-05-19"
1721+
crewai-tools = "2026-05-19"
16881722

16891723

16901724
[tool.uv.sources]

0 commit comments

Comments
 (0)