firecrawl_tools.py
"""
This is an example of how to use the FirecrawlTools.
Prerequisites:
- Create a Firecrawl account and get an API key
- Set the API key as an environment variable:
export FIRECRAWL_API_KEY=<your-api-key>
"""
from agno.agent import Agent
from agno.tools.firecrawl import FirecrawlTools
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
tools=[
FirecrawlTools(
enable_scrape=False, enable_crawl=True, enable_search=True, poll_interval=2
)
],
markdown=True,
)
# Should use search
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
agent.print_response(
"Search for the web for the latest on 'web scraping technologies'",
formats=["markdown", "links"],
)
# Should use crawl
agent.print_response("Summarize this https://docs.agno.com/introduction/")
Run the Example
1
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
2
Install dependencies
uv pip install -U agno firecrawl-py openai
3
Export your API keys
export FIRECRAWL_API_KEY="your_firecrawl_api_key_here"
export OPENAI_API_KEY="your_openai_api_key_here"
$Env:FIRECRAWL_API_KEY="your_firecrawl_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
4
Run the example
Save the code above as
firecrawl_tools.py, then run:python firecrawl_tools.py