Skip to main content

Using Firecrawl with CrewAI

Firecrawl is the context API for AI agents, and CrewAI, the framework for orchestrating AI agents, ships three Firecrawl tools: FirecrawlSearchTool, FirecrawlScrapeWebsiteTool and FirecrawlCrawlWebsiteTool. Use them to let your crews search, scrape, and crawl the web for clean context.

Installing Firecrawl Tools inside of CrewAI

Each tool takes its Firecrawl options in a config dict at construction time. The URL or query comes from the agent when it calls the tool, so you only pass options up front.

Tools

FirecrawlCrawlWebsiteTool

Example

Utilize the FirecrawlCrawlWebsiteTool as follows to allow your agent to crawl websites:

Arguments

  • api_key: Optional. Specifies Firecrawl API key. Defaults is the FIRECRAWL_API_KEY environment variable.
  • config: Optional. Crawl parameters in snake_case. Passing config replaces the defaults below.
    • limit: Maximum number of pages to crawl. Default: 10.
    • max_discovery_depth: Maximum depth for discovering pages. Default: 2.
    • ignore_sitemap: Whether to ignore the sitemap. Default: True.
    • allow_external_links: Allow crawling external links. Default: False.
    • allow_subdomains: Allow crawling subdomains. Default: False.
    • delay: Delay between requests in milliseconds. Default: None.
    • scrape_options: Options for each crawled page. Default: {"formats": ["markdown"], "only_main_content": True, "timeout": 10000}.

FirecrawlScrapeWebsiteTool

Example

Utilize the FirecrawlScrapeWebsiteTool as follows to allow your agent to load websites:

Arguments

  • api_key: Optional. Specifies Firecrawl API key. Defaults is the FIRECRAWL_API_KEY environment variable.
  • config: Optional. Scrape parameters in snake_case. Passing config replaces the defaults below.
    • formats: Output formats, such as "markdown", "html", "links", or a JSON format object for structured extraction. Default: ["markdown"].
    • only_main_content: Only return the main content of the page excluding headers, navs, footers, etc. Default: True.
    • include_tags / exclude_tags: HTML tags to include or exclude. Default: [].
    • max_age: Return a cached version if it is younger than this many milliseconds. Default: 172800000 (2 days).
    • wait_for: Delay in milliseconds before fetching content. Default: 0.
    • mobile: Emulate a mobile device. Default: False.
    • timeout: Timeout in milliseconds for the request. Default: None.

FirecrawlSearchTool

Example

Utilize the FirecrawlSearchTool as follows to allow your agent to search the web:

Arguments

  • api_key: Optional. Specifies Firecrawl API key. Defaults is the FIRECRAWL_API_KEY environment variable.
  • config: Optional. Search parameters in snake_case. Passing config replaces the defaults below.
    • limit: Maximum number of search results to return. Default: 5.
    • tbs: Time-based search filter, for example "qdr:d" for the past day. Default: None.
    • location: Location for search results. Default: None.
    • timeout: Timeout in milliseconds for the request. Default: None.
    • scrape_options: Scrape each result and return its content. Default: {"formats": ["markdown"], "only_main_content": True}. Leave it out to get only titles, URLs, and descriptions.