Skip to main content
Integrate Firecrawl with Mastra, the TypeScript framework for building AI agents and workflows.

Setup

Create .env file:
Note: If using Node < 20, install dotenv and add import 'dotenv/config' to your code.

Multi-Step Workflow

This example demonstrates a complete workflow that searches, scrapes, and summarizes documentation using Firecrawl and Mastra.

Browser Sessions

Mastra’s @mastra/browser-firecrawl package gives an agent a hosted Firecrawl browser. The agent gets Mastra’s browser tools, such as browser_goto, browser_snapshot, and browser_click, and each conversation thread gets its own browser session.
Install agent-browser@0.19.0 alongside it. Newer agent-browser releases don’t export the library this package imports, so the import fails with them.
See the Mastra Firecrawl browser guide for session scope, profiles, and self-hosted options. For more examples, check the Mastra documentation.