Firecrawl Tools

This is an example of how to use the FirecrawlTools.

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/")

Configure formats on the toolkit

Move formats=["markdown", "links"] from agent.print_response(...) into the FirecrawlTools(...) constructor. The agent's run arguments do not configure Firecrawl's scrape options.

The second prompt uses crawling because scraping is disabled, so it can fetch several pages. For a single-page summary, enable enable_scrape=True and ask the agent to use scrape_website. The toolkit's default crawl limit is ten pages; an explicit per-call limit can override it.

Run the Example

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U agno firecrawl-py openai

Export your API keys

export FIRECRAWL_API_KEY="your_firecrawl_api_key_here"
export OPENAI_API_KEY="your_openai_api_key_here"

Run the example

Save the code above as firecrawl_tools.py, then run:

python firecrawl_tools.py

Full source: cookbook/91_tools/firecrawl_tools.py