Skip to main content

Firecrawl Python Agent Quickstart

Canonical quickstart for external agents. Generated from SDK source (firecrawl-py) and the v2 OpenAPI spec. Method names and parameters match the SDK public API.

Install

Authenticate

Constructor options: api_key (falls back to FIRECRAWL_API_KEY env var), api_url (default "https://api.firecrawl.dev"), timeout (seconds), max_retries (default 3), backoff_factor (default 0.5). An async client is available as AsyncFirecrawl.

When To Use What

  • search: use when you start with a query and need discovery.
  • scrape: use when you already have a URL and want page content.
  • interact: use when the page needs clicks, forms, or post-scrape browser actions. Requires a scrape_id from a prior scrape.

Why use it

Discover relevant pages from a query, then pick URLs to scrape or interact with. Constrain results to a site with site: in the query.

Preferred SDK method

client.search(query, **options)SearchData

Example

Important: search() does not return { data: [...] }. Results are in results.web, results.news, results.images.

Parameters

Scrape

Why use it

Get structured content from a URL in one or more formats.

Preferred SDK method

client.scrape(url, **options)Document

Example

Parameters

Interact

Why use it

Control the browser session tied to a prior scrape. Use for clicks, form fills, code execution, or natural-language instructions. Requires a scrape_id from doc.metadata.scrape_id.

Preferred SDK method

client.interact(job_id, code=None, *, prompt=None, language="node", timeout=None) prompt is keyword-only. At least one of code or prompt must be non-empty.

Example

Parameters

Stop the session with client.stop_interaction(job_id).

Notes

  • Deprecated aliases: scrape_urlscrape, scrape_executeinteract, stop_interactive_browser / delete_scrape_browserstop_interaction.
  • The top-level Firecrawl client exposes v2 methods directly. V1 remains under client.v1.
  • search() returns SearchData with .web, .news, .images — not .data.
  • Python uses snake_case parameter names (only_main_content, wait_for, etc.).

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