Skip to main content

Firecrawl Python Agent Quickstart

This file is the canonical quickstart for external agents integrating Firecrawl via the Python SDK. It is generated from SDK source and OpenAPI spec.

Install

Authenticate

The API key can also be set via the FIRECRAWL_API_KEY environment variable. If omitted, the client falls back to keyless free tier (rate-limited per IP). Constructor options: api_key (str), api_url (str, default "https://api.firecrawl.dev"), timeout (float), max_retries (int, default 3), backoff_factor (float, default 0.5). An async client is also available: from firecrawl import AsyncFirecrawl.

When To Use What

  • search: Use when you start with a query and need to discover relevant URLs and their content. Returns results from web, news, and image sources.
  • scrape: Use when you already have a specific URL and want its page content in markdown, HTML, JSON, or other formats.
  • interact: Use when the page needs post-scrape browser actions like clicking, typing, scrolling, or executing code in a live browser session.

Why use it

Search the web for a query and optionally scrape the results. Returns categorized results from web, news, and image sources with optional content extraction.

Preferred SDK method

Example

Parameters

Return type

SearchData with attributes: web, news, images, developer. Each is a list of result dicts or None. Access results via results.web, not results.data.

Scrape

Why use it

Scrape a single URL and get its content in one or more formats. Supports browser automation, LLM extraction, screenshots, and more.

Preferred SDK method

Example

Parameters

Actions

Interact

Why use it

Execute code or send natural-language prompts in a live browser session tied to a scrape job. Use for post-scrape interactions like clicking buttons, filling forms, or running scripts.

Preferred SDK method

Example

Parameters

Either code or prompt must be provided. Use client.stop_interaction(job_id) to end the browser session.

Notes

  • Naming style: All parameters use snake_case.
  • Deprecated aliases: scrape_url() is deprecated in favor of scrape(). scrape_execute() is deprecated in favor of interact(). stop_interactive_browser() and delete_scrape_browser() are deprecated in favor of stop_interaction(). FirecrawlApp is deprecated in favor of Firecrawl.
  • Async support: Use AsyncFirecrawl for async/await usage with the same method signatures.
  • Search return type: Access results via results.web, results.news, results.images, results.developer. Accessing results.data raises AttributeError with guidance.

Source Of Truth

  • /firecrawl/apps/python-sdk/firecrawl/client.py
  • /firecrawl/apps/python-sdk/firecrawl/v2/client.py
  • /firecrawl/apps/python-sdk/firecrawl/v2/types.py
  • /firecrawl-docs/api-reference/v2-openapi.json