Skip to main content

Firecrawl Python Agent Quickstart

This file is the canonical quickstart for external agents integrating with Firecrawl using 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. Omitting the key uses the keyless free tier (rate-limited per IP). Client options:

When To Use What

  • search: Use when you start with a query and need to discover relevant pages. Returns ranked results with optional scraping of each result.
  • scrape: Use when you already have a URL and want its content in markdown, HTML, JSON, or other formats.
  • interact: Use when a page needs post-scrape browser actions — clicking, filling forms, running code, or prompting an AI agent in the browser.

Why use it

Search the web for a query and get back ranked results. Optionally scrape each result page inline by passing scrape_options.

Preferred SDK method

Example

Parameters

Returns: SearchData with optional .web, .news, and .images attributes.

Scrape

Why use it

Scrape a single URL and get its content as markdown, HTML, structured JSON, screenshots, or other formats.

Preferred SDK method

Example

Parameters

Returns: Document with attributes like markdown, html, raw_html, links, images, screenshot, metadata, etc.

Interact

Why use it

Execute code or send a natural-language prompt in the browser session of a previous scrape job. Use this for clicking buttons, filling forms, navigating multi-step flows, or running arbitrary JavaScript/Python/Bash in the browser sandbox.

Preferred SDK method

Example

Parameters

Returns: BrowserExecuteResponse with success, stdout, stderr, result, exit_code, killed, error. Stop the session:

Notes

  • All parameter names use snake_case (e.g. only_main_content, skip_tls_verification, scrape_options).
  • include_domains and exclude_domains on search are mutually exclusive.
  • The SearchData return type has .web, .news, and .images attributes. Accessing .data raises an AttributeError with migration guidance.
  • An async client is available: from firecrawl import AsyncFirecrawl.
  • Deprecated aliases (use the preferred names instead):
    • scrape_url()scrape()
    • scrape_execute()interact()
    • stop_interactive_browser() / delete_scrape_browser()stop_interaction()
    • FirecrawlAppFirecrawl

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