Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move crewai tool decorator import to function where it is used to prevent import errors on init. #216

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions agentstack/frameworks/crewai.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
from agentstack.agents import AgentConfig
from agentstack.generation import asttools

try:
from crewai.tools import tool as _crewai_tool_decorator
except ImportError:
raise ValidationError("Could not import `crewai`. Is this an AgentStack CrewAI project?")

ENTRYPOINT: Path = Path('src/crew.py')


Expand Down Expand Up @@ -330,6 +325,11 @@ def get_tool_callables(tool_name: str) -> list[Callable]:
"""
Get a tool implementations for use directly by a CrewAI agent.
"""
try:
from crewai.tools import tool as _crewai_tool_decorator
except ImportError:
raise ValidationError("Could not import `crewai`. Is this an AgentStack CrewAI project?")

tool_funcs = []
tool_config = ToolConfig.from_tool_name(tool_name)
for tool_func_name in tool_config.tools:
Expand Down
Loading