Skip to main content

Firecrawl Python Agent Quickstart

Canonical quickstart for external agents integrating with Firecrawl via the Python SDK. Generated from SDK source and the OpenAPI spec.

Install

Authenticate

Or use the FIRECRAWL_API_KEY environment variable:
Constructor parameters: An async client is also available: from firecrawl import AsyncFirecrawl.

When To Use What

  • search: Start with a query and discover relevant pages. Returns URLs, titles, descriptions, and optionally scraped content.
  • scrape: You already have a URL and want structured page content — markdown, HTML, screenshots, JSON extraction, etc.
  • interact: The page needs post-scrape browser actions — clicking, typing, executing code, or natural-language browser instructions.

Why use it

Discover web pages matching a query. Optionally scrape each result for full content in one call.

Preferred SDK method

firecrawl.search(query, **kwargs)

Example

Parameters

Results are grouped by source: results.web, results.news, results.images, results.developer.

Scrape

Why use it

Extract structured content from a single URL — markdown, HTML, screenshots, JSON extraction, audio, video, and more.

Preferred SDK method

firecrawl.scrape(url, **kwargs)

Example

Parameters

Interact

Why use it

Continue interacting with a live browser session after scraping. Execute code or send natural-language prompts to control the page — click buttons, fill forms, navigate, and extract dynamic content.

Preferred SDK method

firecrawl.interact(job_id, code=None, *, prompt=None, language="node", timeout=None)

Example

Parameters

Call firecrawl.stop_interaction(job_id) to end the browser session when done.

Notes

  • snake_case parameters: All parameters use snake_case (e.g. only_main_content, include_tags, scrape_options). The SDK converts to camelCase for the API.
  • Format string aliases: Both camelCase and snake_case format strings are accepted (e.g. "rawHtml" and "raw_html" both work).
  • SearchData structure: Access results via results.web, results.news, results.images, or results.developer. Accessing results.data raises AttributeError.
  • Pydantic models: Return types (Document, SearchData, BrowserExecuteResponse) are Pydantic models with attribute-style access.
  • Deprecated aliases: FirecrawlApp -> Firecrawl, scrape_execute -> interact, stop_interactive_browser / delete_scrape_browser -> stop_interaction, scrape_url -> scrape.

Source Of Truth

  • SDK source: firecrawl/apps/python-sdk/firecrawl/v2/client.py, firecrawl/apps/python-sdk/firecrawl/v2/types.py
  • OpenAPI spec: firecrawl-docs/api-reference/v2-openapi.json