Overview
Searches the web using the Firecrawl v2 API and returns structured, scraped search results.
Description
FirecrawlSearchTool extends BaseTool and integrates with FirecrawlApp from the firecrawl-py package. It accepts a search query and returns results with configurable parameters including limit (default: 5 results), tbs (time-based search filter), location, timeout, and scrape_options for content extraction from result pages. The tool initializes FirecrawlApp with an API key from the constructor or the FIRECRAWL_API_KEY environment variable, and handles automatic package installation if firecrawl-py is missing. The _run() method calls search() on the FirecrawlApp instance with the configured options.
Usage
Use this tool when a CrewAI agent needs to perform web searches and retrieve both search results and their scraped content in a single operation. Suitable for research tasks that need structured web data.
Code Reference
Source Location
- Repository: CrewAI
- File:
lib/crewai-tools/src/crewai_tools/tools/firecrawl_search_tool/firecrawl_search_tool.py
- Lines: 1-133
Signature
class FirecrawlSearchTool(BaseTool):
name: str = "Firecrawl web search tool"
description: str = "Search webpages using Firecrawl and return the results"
args_schema: type[BaseModel] = FirecrawlSearchToolSchema
api_key: str | None = None
config: dict[str, Any] | None = Field(default_factory=lambda: {...})
def __init__(self, api_key: str | None = None, **kwargs): ...
def _run(self, query: str) -> Any: ...
Import
from crewai_tools import FirecrawlSearchTool
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| query |
str |
Yes |
Search query string
|
| api_key |
str |
No |
Firecrawl API key (constructor param; falls back to FIRECRAWL_API_KEY env var)
|
| config |
dict |
No |
Search configuration overriding defaults (constructor param)
|
Default Configuration
| Parameter |
Default |
Description
|
| limit |
5 |
Maximum number of search results
|
| tbs |
None |
Time-based search filter (e.g., qdr:d for past day)
|
| location |
None |
Location for search results
|
| timeout |
None |
Request timeout in milliseconds
|
| scrape_options.formats |
["markdown"] |
Content formats for scraped results
|
| scrape_options.only_main_content |
True |
Only return main content
|
Outputs
| Name |
Type |
Description
|
| _run() returns |
Any |
Firecrawl search results with scraped content from matching pages
|
Usage Examples
Basic Usage
from crewai_tools import FirecrawlSearchTool
tool = FirecrawlSearchTool(api_key="your-firecrawl-key")
result = tool.run(query="CrewAI agent framework documentation")
With Time Filter
from crewai_tools import FirecrawlSearchTool
tool = FirecrawlSearchTool(
api_key="your-firecrawl-key",
config={
"limit": 10,
"tbs": "qdr:w", # past week
"scrape_options": {"formats": ["markdown"], "only_main_content": True},
},
)
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.