Documentation Index
Fetch the complete documentation index at: https://spacesail.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The Firecrawl Reader with asynchronous processing uses the Firecrawl API to scrape and crawl web content efficiently, converting it into documents for your knowledge base.
Code
examples/concepts/knowledge/readers/firecrawl_reader_async.py
import os
import asyncio
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.knowledge.reader.firecrawl_reader import FirecrawlReader
from agno.vectordb.pgvector import PgVector
api_key = os.getenv("FIRECRAWL_API_KEY")
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
knowledge = Knowledge(
vector_db=PgVector(
table_name="firecrawl_documents",
db_url=db_url,
),
)
agent = Agent(
knowledge=knowledge,
search_knowledge=True,
)
async def main():
# Add Firecrawl content to knowledge base
await knowledge.add_content_async(
url="https://github.com/agno-agi/agno",
reader=FirecrawlReader(
api_key=api_key,
mode="scrape",
chunk=True,
params={"formats": ["markdown"]},
),
)
# Query the knowledge base
await agent.aprint_response(
"What is the main purpose of this repository?",
markdown=True,
)
if __name__ == "__main__":
asyncio.run(main())
Usage
Create a virtual environment
Open the Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Install libraries
pip install -U firecrawl-py sqlalchemy psycopg pgvector agno
Set API Key
export FIRECRAWL_API_KEY="your-firecrawl-api-key"
Run PgVector
docker run -d \
-e POSTGRES_DB=ai \
-e POSTGRES_USER=ai \
-e POSTGRES_PASSWORD=ai \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v pgvolume:/var/lib/postgresql/data \
-p 5532:5432 \
--name pgvector \
agno/pgvector:16
Run Agent
python examples/concepts/knowledge/readers/firecrawl_reader_async.py
Params
| Parameter | Type | Default | Description |
api_key | Optional[str] | None | Firecrawl API key for authentication |
params | Optional[Dict] | None | Additional parameters to pass to the Firecrawl API |
mode | Literal["scrape", "crawl"] | "scrape" | Mode of operation - "scrape" for single page, "crawl" for multiple pages |
url | str | Required | URL of the website to scrape or crawl |