First day getting back into CrewAI after some time away and learning the newer YAML-based methods, so probably my error but here’s my attempt to use the official Firecrawl tools:
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
from crewai_tools import FirecrawlSearchTool, FirecrawlScrapeWebsiteTool, FirecrawlCrawlWebsiteTool
fc_search_tool = FirecrawlSearchTool()
fc_scrape_tool = FirecrawlScrapeWebsiteTool()
fc_crawl_tool = FirecrawlCrawlWebsiteTool()
@CrewBase
class ResearchTool():
"""ResearchTool crew"""
# Learn more about YAML configuration files here:
# Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
# Tasks: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
# If you would like to add tools to your agents, you can learn more about it here:
# https://docs.crewai.com/concepts/agents#agent-tools
@agent
def research_manager(self) -> Agent:
return Agent(
config=self.agents_config['research_manager'],
tools=[fc_search_tool, fc_scrape_tool, fc_crawl_tool],
verbose=True
)
and this error-laden monstrosity is what i get after ‘crewai install’ (do I have to do this on every edit?) and then ‘crewai run’
(research-tool) journeymapping-5043037:~/journeymapping/research_tool$ crewai run
Running the Crew
/home/user/journeymapping/research_tool/.venv/lib/python3.11/site-packages/pydantic/_internal/_config.py:295: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)
/home/user/journeymapping/research_tool/.venv/lib/python3.11/site-packages/pydantic/_internal/_fields.py:192: UserWarning: Field name "schema" in "DatabricksQueryToolSchema" shadows an attribute in parent "BaseModel"
warnings.warn(
/home/user/journeymapping/research_tool/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:502: UserWarning: <built-in function callable> is not a Python type (it may be an instance of an object), Pydantic will allow any object with no validation since we cannot even enforce that the input is an instance of the given type. To get rid of this error wrap the type with `pydantic.SkipValidation`.
warn(
/home/user/journeymapping/research_tool/.venv/lib/python3.11/site-packages/crewai_tools/tools/scrapegraph_scrape_tool/scrapegraph_scrape_tool.py:34: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
@validator("website_url")
/home/user/journeymapping/research_tool/.venv/lib/python3.11/site-packages/crewai_tools/tools/selenium_scraping_tool/selenium_scraping_tool.py:26: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
@validator("website_url")
/home/user/journeymapping/research_tool/.venv/lib/python3.11/site-packages/crewai_tools/tools/vision_tool/vision_tool.py:15: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.10/migration/
@validator("image_path_url")
Traceback (most recent call last):
File "/home/user/journeymapping/research_tool/.venv/bin/run_crew", line 4, in <module>
from research_tool.main import run
File "/home/user/journeymapping/research_tool/src/research_tool/main.py", line 7, in <module>
from research_tool.crew import ResearchTool
File "/home/user/journeymapping/research_tool/src/research_tool/crew.py", line 5, in <module>
fc_search_tool = FirecrawlSearchTool()
^^^^^^^^^^^^^^^^^^^^^
File "/home/user/journeymapping/research_tool/.venv/lib/python3.11/site-packages/crewai_tools/tools/firecrawl_search_tool/firecrawl_search_tool.py", line 55, in __init__
self._initialize_firecrawl()
File "/home/user/journeymapping/research_tool/.venv/lib/python3.11/site-packages/crewai_tools/tools/firecrawl_search_tool/firecrawl_search_tool.py", line 60, in _initialize_firecrawl
self._firecrawl = FirecrawlApp(api_key=self.api_key)
^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'FirecrawlApp' where it is not associated with a value
An error occurred while running the crew: Command '['uv', 'run', 'run_crew']' returned non-zero exit status 1.
What is this unbound error business and what am I doing wrong?