Skip to content

Commit 2fb76f0

Browse files
authored
Merge pull request #216 from tcdent/issue-215
Move crewai tool decorator import to function where it is used to prevent import errors on `init`.
2 parents 6b00ee9 + 5b3bb3c commit 2fb76f0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

agentstack/frameworks/crewai.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
from agentstack.agents import AgentConfig
99
from agentstack.generation import asttools
1010

11-
try:
12-
from crewai.tools import tool as _crewai_tool_decorator
13-
except ImportError:
14-
raise ValidationError("Could not import `crewai`. Is this an AgentStack CrewAI project?")
15-
1611
ENTRYPOINT: Path = Path('src/crew.py')
1712

1813

@@ -330,6 +325,11 @@ def get_tool_callables(tool_name: str) -> list[Callable]:
330325
"""
331326
Get a tool implementations for use directly by a CrewAI agent.
332327
"""
328+
try:
329+
from crewai.tools import tool as _crewai_tool_decorator
330+
except ImportError:
331+
raise ValidationError("Could not import `crewai`. Is this an AgentStack CrewAI project?")
332+
333333
tool_funcs = []
334334
tool_config = ToolConfig.from_tool_name(tool_name)
335335
for tool_func_name in tool_config.tools:

0 commit comments

Comments
 (0)