Home/Tools/firecrawl-aisdk

crawlTool

firecrawl-aisdk

Start a crawl job to extract content from multiple related pages on a website. Best for: Comprehensive content extraction from multiple pages with depth control. Note: This is an asynchronous operation that returns a job ID. Use checkCrawlStatusTool to monitor progress. Example use cases: - Crawl an entire blog section - Extract all documentation pages - Scrape product catalog with pagination - Comprehensive site analysis

by firecrawl

search
v0.7.2
MIT

Interactive Playground

Test firecrawl-aisdk (crawlTool) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install firecrawl-aisdk
pnpm add firecrawl-aisdk

2. Import the tool

import { crawlTool } from 'firecrawl-aisdk';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { crawlTool } from 'firecrawl-aisdk';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { crawlTool },
  prompt: 'Your prompt here...',
});

console.log(result.text);

AI Agent Integration

How AI agents can use this tool

Use Case

Use when you need to crawl and extract data from entire websites

Examples

  • Crawl documentation sites
  • Extract all articles from a blog
  • Build knowledge base from website

Parameters

Available configuration options

Auto-extracted
url
Required
Type: string

The starting URL to crawl from

limit
Optional
Type: integer

Maximum number of pages to crawl

maxDepth
Optional
Type: integer

Maximum depth of crawling from the starting URL

allowExternalLinks
Optional
Type: boolean

Allow crawling external links

allowBackwardLinks
Optional
Type: boolean

Allow crawling backward links

includePaths
Optional
Type: array

Only crawl URLs matching these path patterns

excludePaths
Optional
Type: array

Exclude URLs matching these path patterns

scrapeOptions
Optional
Type: object

Options for scraping crawled pages

Schema extracted: 12/29/2025, 3:52:27 AM

README

Firecrawl AI SDK Tools

Firecrawl tools for Vercel AI SDK v5. Web scraping, search, crawling, and data extraction for AI applications.

Install

npm install firecrawl-aisdk ai @ai-sdk/openai

Set environment variables:

FIRECRAWL_API_KEY=fc-your-key
OPENAI_API_KEY=sk-your-key

Quick Start

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { scrapeTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Scrape https://firecrawl.dev and summarize what it does',
  tools: { scrape: scrapeTool },
});

Available Tools

import {
  scrapeTool,         // Scrape single URL
  searchTool,         // Search the web
  mapTool,            // Discover URLs on a site
  crawlTool,          // Crawl multiple pages
  batchScrapeTool,    // Scrape multiple URLs
  extractTool,        // Extract structured data
  pollTool,           // Poll async jobs
  statusTool,         // Check job status
  cancelTool,         // Cancel jobs
} from 'firecrawl-aisdk';

Examples

Scrape

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { scrapeTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Scrape https://firecrawl.dev and summarize what it does',
  tools: { scrape: scrapeTool },
});

console.log(text);

Search

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { searchTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Search for Firecrawl and summarize what you find',
  tools: { search: searchTool },
});

console.log(text);

Map

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { mapTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Map https://docs.firecrawl.dev and list the main sections',
  tools: { map: mapTool },
});

console.log(text);

Crawl (async - requires polling)

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { crawlTool, pollTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Crawl https://docs.firecrawl.dev (limit 3 pages) and summarize',
  tools: { crawl: crawlTool, poll: pollTool },
});

console.log(text);

Batch (async - requires polling)

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { batchScrapeTool, pollTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Scrape https://firecrawl.dev and https://docs.firecrawl.dev, then compare',
  tools: { batchScrape: batchScrapeTool, poll: pollTool },
});

console.log(text);

Extract (async - requires polling)

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { extractTool, pollTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Extract the main features from https://firecrawl.dev',
  tools: { extract: extractTool, poll: pollTool },
});

console.log(text);

Search + Scrape

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { searchTool, scrapeTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Search for Firecrawl, scrape the top result, and explain what it does',
  tools: { search: searchTool, scrape: scrapeTool },
});

console.log(text);

Stream

import { streamText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { scrapeTool } from 'firecrawl-aisdk';

const result = streamText({
  model: openai('gpt-5-mini'),
  prompt: 'Scrape https://firecrawl.dev and explain what it does',
  tools: { scrape: scrapeTool },
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Development

Run tests:

pnpm test          # Run all tests
pnpm test:watch    # Watch mode

License

MIT

Statistics

Downloads/month

2,435

GitHub Stars

0

Quality Score

87%

NPM Keywords

ai
ai-sdk
vercel
firecrawl
web-scraping
web-search
tools
llm

Maintainers

hello_sideguide(hello@sideguide.dev)

Frameworks

vercel-ai