Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

Preparing new version (#1845)

João Moura7272fd15acbc
diff --git a/pyproject.toml b/pyproject.toml
index 8a9f83732..fd1798d36 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "crewai"
-version = "0.86.0"
+version = "0.95.0"
description = "Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks."
readme = "README.md"
requires-python = ">=3.10,<3.13"
diff --git a/src/crewai/__init__.py b/src/crewai/__init__.py
index 0833afd58..f0ba35a38 100644
--- a/src/crewai/__init__.py
+++ b/src/crewai/__init__.py
@@ -14,7 +14,7 @@ warnings.filterwarnings(
category=UserWarning,
module="pydantic.main",
)
-__version__ = "0.86.0"
+__version__ = "0.95.0"
__all__ = [
"Agent",
"Crew",
diff --git a/src/crewai/cli/templates/crew/pyproject.toml b/src/crewai/cli/templates/crew/pyproject.toml
index 5ea8194c8..bd2d871c5 100644
--- a/src/crewai/cli/templates/crew/pyproject.toml
+++ b/src/crewai/cli/templates/crew/pyproject.toml
@@ -5,7 +5,7 @@ description = "{{name}} using crewAI"
authors = [{ name = "Your Name", email = "[email protected]" }]
requires-python = ">=3.10,<3.13"
dependencies = [
- "crewai[tools]>=0.86.0,<1.0.0"
+ "crewai[tools]>=0.95.0,<1.0.0"
]
[project.scripts]
diff --git a/src/crewai/cli/templates/flow/pyproject.toml b/src/crewai/cli/templates/flow/pyproject.toml
index 8a523d2ed..6ca589497 100644
--- a/src/crewai/cli/templates/flow/pyproject.toml
+++ b/src/crewai/cli/templates/flow/pyproject.toml
@@ -5,7 +5,7 @@ description = "{{name}} using crewAI"
authors = [{ name = "Your Name", email = "[email protected]" }]
requires-python = ">=3.10,<3.13"
dependencies = [
- "crewai[tools]>=0.86.0,<1.0.0",
+ "crewai[tools]>=0.95.0,<1.0.0",
]
[project.scripts]
diff --git a/src/crewai/cli/templates/tool/pyproject.toml b/src/crewai/cli/templates/tool/pyproject.toml
index 69b8d355f..0c4b88e9c 100644
--- a/src/crewai/cli/templates/tool/pyproject.toml
+++ b/src/crewai/cli/templates/tool/pyproject.toml
@@ -5,7 +5,7 @@ description = "Power up your crews with {{folder_name}}"
readme = "README.md"
requires-python = ">=3.10,<3.13"
dependencies = [
- "crewai[tools]>=0.86.0"
+ "crewai[tools]>=0.95.0"
]
[tool.crewai]
diff --git a/src/crewai/llm.py b/src/crewai/llm.py
index bdac7080a..bb1167bd8 100644
--- a/src/crewai/llm.py
+++ b/src/crewai/llm.py
@@ -4,6 +4,7 @@ import sys
import threading
import warnings
from contextlib import contextmanager
+from importlib import resources
from typing import Any, Dict, List, Optional, Union
with warnings.catch_warnings():
@@ -78,6 +79,7 @@ CONTEXT_WINDOW_USAGE_RATIO = 0.75
def suppress_warnings():
with warnings.catch_warnings():
warnings.filterwarnings("ignore")
+ warnings.filterwarnings("ignore", message="open_text is deprecated*", category=DeprecationWarning)
# Redirect stdout and stderr
old_stdout = sys.stdout
@@ -216,16 +218,17 @@ class LLM:
return self.context_window_size
def set_callbacks(self, callbacks: List[Any]):
- callback_types = [type(callback) for callback in callbacks]
- for callback in litellm.success_callback[:]:
- if type(callback) in callback_types:
- litellm.success_callback.remove(callback)
+ with suppress_warnings():
+ callback_types = [type(callback) for callback in callbacks]
+ for callback in litellm.success_callback[:]:
+ if type(callback) in callback_types:
+ litellm.success_callback.remove(callback)
- for callback in litellm._async_success_callback[:]:
- if type(callback) in callback_types:
- litellm._async_success_callback.remove(callback)
+ for callback in litellm._async_success_callback[:]:
+ if type(callback) in callback_types:
+ litellm._async_success_callback.remove(callback)
- litellm.callbacks = callbacks
+ litellm.callbacks = callbacks
def set_env_callbacks(self):
"""
@@ -246,19 +249,20 @@ class LLM:
This will set `litellm.success_callback` to ["langfuse", "langsmith"] and
`litellm.failure_callback` to ["langfuse"].
"""
- success_callbacks_str = os.environ.get("LITELLM_SUCCESS_CALLBACKS", "")
- success_callbacks = []
- if success_callbacks_str:
- success_callbacks = [
- callback.strip() for callback in success_callbacks_str.split(",")
- ]
-
- failure_callbacks_str = os.environ.get("LITELLM_FAILURE_CALLBACKS", "")
- failure_callbacks = []
- if failure_callbacks_str:
- failure_callbacks = [
- callback.strip() for callback in failure_callbacks_str.split(",")
- ]
-
- litellm.success_callback = success_callbacks
- litellm.failure_callback = failure_callbacks
+ with suppress_warnings():
+ success_callbacks_str = os.environ.get("LITELLM_SUCCESS_CALLBACKS", "")
+ success_callbacks = []
+ if success_callbacks_str:
+ success_callbacks = [
+ callback.strip() for callback in success_callbacks_str.split(",")
+ ]
+
+ failure_callbacks_str = os.environ.get("LITELLM_FAILURE_CALLBACKS", "")
+ failure_callbacks = []
+ if failure_callbacks_str:
+ failure_callbacks = [
+ callback.strip() for callback in failure_callbacks_str.split(",")
+ ]
+
+ litellm.success_callback = success_callbacks
+ litellm.failure_callback = failure_callbacks
diff --git a/src/crewai/tools/base_tool.py b/src/crewai/tools/base_tool.py
index c3840d23c..b3c0f997c 100644
--- a/src/crewai/tools/base_tool.py
+++ b/src/crewai/tools/base_tool.py
@@ -1,12 +1,23 @@
+import warnings
from abc import ABC, abstractmethod
from inspect import signature
from typing import Any, Callable, Type, get_args, get_origin
-from pydantic import BaseModel, ConfigDict, Field, create_model, validator
+from pydantic import (
+ BaseModel,
+ ConfigDict,
+ Field,
+ PydanticDeprecatedSince20,
+ create_model,
+ validator,
+)
from pydantic import BaseModel as PydanticBaseModel
from crewai.tools.structured_tool import CrewStructuredTool
+# Ignore all "PydanticDeprecatedSince20" warnings globally
+warnings.filterwarnings("ignore", category=PydanticDeprecatedSince20)
+
class BaseTool(BaseModel, ABC):
class _ArgsSchemaPlaceholder(PydanticBaseModel):
diff --git a/src/crewai/utilities/internal_instructor.py b/src/crewai/utilities/internal_instructor.py
index a3206ba15..65a05a61f 100644
--- a/src/crewai/utilities/internal_instructor.py
+++ b/src/crewai/utilities/internal_instructor.py
@@ -31,10 +31,10 @@ class InternalInstructor:
import instructor
from litellm import completion
- self._client = instructor.from_litellm(
- completion,
- mode=instructor.Mode.TOOLS,
- )
+ self._client = instructor.from_litellm(
+ completion,
+ mode=instructor.Mode.TOOLS,
+ )
def to_json(self):
model = self.to_pydantic()
diff --git a/tests/agents/agent_builder/base_agent_test.py b/tests/agents/agent_builder/base_agent_test.py
index 7c0c2f472..99f66dcc4 100644
--- a/tests/agents/agent_builder/base_agent_test.py
+++ b/tests/agents/agent_builder/base_agent_test.py
@@ -7,7 +7,7 @@ from crewai.agents.agent_builder.base_agent import BaseAgent
from crewai.tools.base_tool import BaseTool
-class TestAgent(BaseAgent):
+class MockAgent(BaseAgent):
def execute_task(
self,
task: Any,
@@ -29,7 +29,7 @@ class TestAgent(BaseAgent):
def test_key():
- agent = TestAgent(
+ agent = MockAgent(
role="test role",
goal="test goal",
backstory="test backstory",
diff --git a/tests/cli/deploy/test_deploy_main.py b/tests/cli/deploy/test_deploy_main.py
index ca89b2aa2..c9a1b884e 100644
--- a/tests/cli/deploy/test_deploy_main.py
+++ b/tests/cli/deploy/test_deploy_main.py
@@ -177,12 +177,12 @@ class TestDeployCommand(unittest.TestCase):
def test_get_crew_status(self):
mock_response = MagicMock()
mock_response.status_code = 200
- mock_response.json.return_value = {"name": "TestCrew", "status": "active"}
+ mock_response.json.return_value = {"name": "InternalCrew", "status": "active"}
self.mock_client.crew_status_by_name.return_value = mock_response
with patch("sys.stdout", new=StringIO()) as fake_out:
self.deploy_command.get_crew_status()
- self.assertIn("TestCrew", fake_out.getvalue())
+ self.assertIn("InternalCrew", fake_out.getvalue())
self.assertIn("active", fake_out.getvalue())
def test_get_crew_logs(self):
diff --git a/tests/project_test.py b/tests/project_test.py
index 6c68f4993..ed9d86f2f 100644
--- a/tests/project_test.py
+++ b/tests/project_test.py
@@ -27,7 +27,7 @@ class SimpleCrew:
@CrewBase
-class TestCrew:
+class InternalCrew:
agents_config = "config/agents.yaml"
tasks_config = "config/tasks.yaml"
@@ -84,7 +84,7 @@ def test_task_memoization():
def test_crew_memoization():
- crew = TestCrew()
+ crew = InternalCrew()
first_call_result = crew.crew()
second_call_result = crew.crew()
@@ -107,7 +107,7 @@ def test_task_name():
@pytest.mark.vcr(filter_headers=["authorization"])
def test_before_kickoff_modification():
- crew = TestCrew()
+ crew = InternalCrew()
inputs = {"topic": "LLMs"}
result = crew.crew().kickoff(inputs=inputs)
assert "bicycles" in result.raw, "Before kickoff function did not modify inputs"
@@ -115,7 +115,7 @@ def test_before_kickoff_modification():
@pytest.mark.vcr(filter_headers=["authorization"])
def test_after_kickoff_modification():
- crew = TestCrew()
+ crew = InternalCrew()
# Assuming the crew execution returns a dict
result = crew.crew().kickoff({"topic": "LLMs"})
@@ -126,7 +126,7 @@ def test_after_kickoff_modification():
@pytest.mark.vcr(filter_headers=["authorization"])
def test_before_kickoff_with_none_input():
- crew = TestCrew()
+ crew = InternalCrew()
crew.crew().kickoff(None)
# Test should pass without raising exceptions
diff --git a/tests/test_manager_llm_delegation.py b/tests/test_manager_llm_delegation.py
index 6f8671255..6b1b97b9a 100644
--- a/tests/test_manager_llm_delegation.py
+++ b/tests/test_manager_llm_delegation.py
@@ -6,7 +6,7 @@ from crewai import Agent, Task
from crewai.tools.agent_tools.base_agent_tools import BaseAgentTool
-class TestAgentTool(BaseAgentTool):
+class InternalAgentTool(BaseAgentTool):
"""Concrete implementation of BaseAgentTool for testing."""
def _run(self, *args, **kwargs):
@@ -39,7 +39,7 @@ def test_agent_tool_role_matching(role_name, should_match):
)
# Create test agent tool
- agent_tool = TestAgentTool(
+ agent_tool = InternalAgentTool(
name="test_tool", description="Test tool", agents=[test_agent]
)
diff --git a/tests/tools/test_base_tool.py b/tests/tools/test_base_tool.py
index 9f46b13ba..51eb05b75 100644
--- a/tests/tools/test_base_tool.py
+++ b/tests/tools/test_base_tool.py
@@ -15,7 +15,7 @@ def test_creating_a_tool_using_annotation():
my_tool.description
== "Tool Name: Name of my tool\nTool Arguments: {'question': {'description': None, 'type': 'str'}}\nTool Description: Clear description for what this tool is useful for, your agent will need this information to use it."
)
- assert my_tool.args_schema.schema()["properties"] == {
+ assert my_tool.args_schema.model_json_schema()["properties"] == {
"question": {"title": "Question", "type": "string"}
}
assert (
@@ -29,7 +29,7 @@ def test_creating_a_tool_using_annotation():
converted_tool.description
== "Tool Name: Name of my tool\nTool Arguments: {'question': {'description': None, 'type': 'str'}}\nTool Description: Clear description for what this tool is useful for, your agent will need this information to use it."
)
- assert converted_tool.args_schema.schema()["properties"] == {
+ assert converted_tool.args_schema.model_json_schema()["properties"] == {
"question": {"title": "Question", "type": "string"}
}
assert (
@@ -54,7 +54,7 @@ def test_creating_a_tool_using_baseclass():
my_tool.description
== "Tool Name: Name of my tool\nTool Arguments: {'question': {'description': None, 'type': 'str'}}\nTool Description: Clear description for what this tool is useful for, your agent will need this information to use it."
)
- assert my_tool.args_schema.schema()["properties"] == {
+ assert my_tool.args_schema.model_json_schema()["properties"] == {
"question": {"title": "Question", "type": "string"}
}
assert my_tool.run("What is the meaning of life?") == "What is the meaning of life?"
@@ -66,7 +66,7 @@ def test_creating_a_tool_using_baseclass():
converted_tool.description
== "Tool Name: Name of my tool\nTool Arguments: {'question': {'description': None, 'type': 'str'}}\nTool Description: Clear description for what this tool is useful for, your agent will need this information to use it."
)
- assert converted_tool.args_schema.schema()["properties"] == {
+ assert converted_tool.args_schema.model_json_schema()["properties"] == {
"question": {"title": "Question", "type": "string"}
}
assert (
diff --git a/tests/tools/test_structured_tool.py b/tests/tools/test_structured_tool.py
index 32ebd805b..333220486 100644
--- a/tests/tools/test_structured_tool.py
+++ b/tests/tools/test_structured_tool.py
@@ -25,7 +25,7 @@ def schema_class():
return TestSchema
-class TestCrewStructuredTool:
+class InternalCrewStructuredTool:
def test_initialization(self, basic_function, schema_class):
"""Test basic initialization of CrewStructuredTool"""
tool = CrewStructuredTool(
diff --git a/tests/utilities/evaluators/test_crew_evaluator_handler.py b/tests/utilities/evaluators/test_crew_evaluator_handler.py
index 649c25998..4fbe2b2d4 100644
--- a/tests/utilities/evaluators/test_crew_evaluator_handler.py
+++ b/tests/utilities/evaluators/test_crew_evaluator_handler.py
@@ -12,7 +12,7 @@ from crewai.utilities.evaluators.crew_evaluator_handler import (
)
-class TestCrewEvaluator:
+class InternalCrewEvaluator:
@pytest.fixture
def crew_planner(self):
agent = Agent(role="Agent 1", goal="Goal 1", backstory="Backstory 1")
diff --git a/tests/utilities/test_planning_handler.py b/tests/utilities/test_planning_handler.py
index e15877c9f..e1c27c341 100644
--- a/tests/utilities/test_planning_handler.py
+++ b/tests/utilities/test_planning_handler.py
@@ -16,7 +16,7 @@ from crewai.utilities.planning_handler import (
)
-class TestCrewPlanner:
+class InternalCrewPlanner:
@pytest.fixture
def crew_planner(self):
tasks = [
@@ -115,13 +115,13 @@ class TestCrewPlanner:
def __init__(self, name: str, description: str):
tool_data = {"name": name, "description": description}
super().__init__(**tool_data)
-
+
def __str__(self):
return self.name
-
+
def __repr__(self):
return self.name
-
+
def to_structured_tool(self):
return self
@@ -149,11 +149,11 @@ class TestCrewPlanner:
]
)
)
-
+
# Create planner with the new task
planner = CrewPlanner([task], None)
tasks_summary = planner._create_tasks_summary()
-
+
# Verify task summary content
assert isinstance(tasks_summary, str)
assert task.description in tasks_summary
diff --git a/tests/utilities/test_training_handler.py b/tests/utilities/test_training_handler.py
index a4da5a3dc..17a1ceb54 100644
--- a/tests/utilities/test_training_handler.py
+++ b/tests/utilities/test_training_handler.py
@@ -4,7 +4,7 @@ import unittest
from crewai.utilities.training_handler import CrewTrainingHandler
-class TestCrewTrainingHandler(unittest.TestCase):
+class InternalCrewTrainingHandler(unittest.TestCase):
def setUp(self):
self.handler = CrewTrainingHandler("trained_data.pkl")
diff --git a/uv.lock b/uv.lock
index 1ed8e9bcd..6c2387dd2 100644
--- a/uv.lock
+++ b/uv.lock
@@ -631,7 +631,7 @@ wheels = [
[[package]]
name = "crewai"
-version = "0.86.0"
+version = "0.95.0"
source = { editable = "." }
dependencies = [
{ name = "appdirs" },