Dear Friends:
I created the following trivial setup to ask this question:
- Directory structure
user$ tree .
.
├── crew.py
├── config
│ ├── agents.yaml
│ └── tasks.yaml # Intentionally empty for simplicity.
└── tools
└── my_tools.py
- ./crew.py
from crewai.project import (CrewBase, agent, task, llm, crew, before_kickoff, after_kickoff,)
from tools.my_tools import some_fantastic_tool
@CrewBase
class FantasticCrew():
""" Some Fantastic Crew """
print(f"+{'*'* 42}\n{some_fantastic_tool}\n+{'*'* 42}")
agents_config = "config/agents.yaml"
FantasticCrew()
- ./config/agents.yaml
ome_fantastic_agent:
role: >
Some fantastic role.
goal: >
Some fantastic goal.
backstory: >
Some fantastic backstory.
verbose: True
allow_delegation: False
llm: ollama_gemma3_27b_llm
tools: ['some_fantastic_tool',] # CrewAI @tool decorated functions inside: ./tools/sqlite_tools.py
- ./tools/my_tools.py
from crewai.tools import tool
@tool("some_fantastic_tool")
def some_fantastic_tool() -> str:
"""
Performs some fantastic function.
Returns:
str: A string containing some fantastic text.
"""
return "Some fantastic text."
When I run this trivial Crew as shown below, I receive the indicated key_error
:
user$ python ./crew.py
+******************************************
name='some_fantastic_tool'
description='Tool Name: some_fantastic_tool
Tool Arguments: {}
Tool Description: Performs some fantastic function.
Returns:
str: A string containing some fantastic text.
'args_schema=<class 'abc.Some_Fantastic_Tool'>
description_updated=False
cache_function=<function BaseTool.<lambda> at
0x7f6346fc8b80>
result_as_answer=False func=<function some_fantastic_tool
at 0x7f639e749bc0>
+******************************************
Traceback (most recent call last):
File "/home/nmvega/WORKSPACES.d/AGENTIC.GEN.AI.d/CREWAI.d/ttt.d/./crew.py", line 11, in <module>
FantasticCrew()
File "/home/nmvega/WORKSPACES.d/AGENTIC.GEN.AI.d/CREWAI.d/.venv/lib64/python3.12/site-packages/crewai/project/crew_base.py", line 35, in __init__
self.map_all_agent_variables()
File "/home/nmvega/WORKSPACES.d/AGENTIC.GEN.AI.d/CREWAI.d/.venv/lib64/python3.12/site-packages/crewai/project/crew_base.py", line 143, in map_all_agent_variables
self._map_agent_variables(
File "/home/nmvega/WORKSPACES.d/AGENTIC.GEN.AI.d/CREWAI.d/.venv/lib64/python3.12/site-packages/crewai/project/crew_base.py", line 171, in _map_agent_variables
tool_functions[tool]() for tool in tools
~~~~~~~~~~~~~~^^^^^^
KeyError: 'some_fantastic_tool'
What am I missing? Thank you.