Skip to main content

Firecrawl Python Agent Quickstart

Canonical quickstart for external agents. Generated from SDK source (firecrawl-py v4.41.0) and the v2 OpenAPI spec. Method names, parameters, and types match the v2 client.

Install

Requires Python >= 3.8.

Authenticate

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:, for example site:docs.firecrawl.dev crawl webhooks.

Preferred SDK method

client.search(query, **options)SearchData

Example

Wrong turn to avoid: search() does not return { data: [...] }. Web results are in result.web, news in result.news, images in result.images.

Parameters

Scrape

Why use it

Fetch structured content from a URL in one or more formats. Use when you already have the URL.

Preferred SDK method

client.scrape(url, **options)Document

Example

Parameters

Format options: String formats: "markdown", "html", "rawHtml" (or "raw_html"), "links", "images", "screenshot", "summary", "changeTracking" (or "change_tracking"), "attributes", "branding", "audio", "video". Object formats:
  • {"type": "json", "prompt": "...", "schema": {...}} — at least one of prompt or schema required.
  • {"type": "question", "question": "..."} — question-answer extraction.
  • {"type": "highlights", "query": "..."} — relevant source-text extraction.
  • {"type": "screenshot", "full_page": True, "quality": 80, "viewport": {"width": 1280, "height": 720}}
  • {"type": "changeTracking", "modes": ["git-diff"], "tag": "..."}modes required.
  • {"type": "attributes", "selectors": [{"selector": "a", "attribute": "href"}]}

Interact

Why use it

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

Preferred SDK method

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

Example

Parameters

At least one of code or prompt must be provided. Stop session: client.stop_interaction(job_id) ends the browser session.

Notes

  • Deprecated aliases: scrape_executeinteract; stop_interactive_browser / delete_scrape_browserstop_interaction.
  • The top-level Firecrawl client exposes v2 methods directly; v1 remains under client.v1.
  • FirecrawlApp is a direct alias for Firecrawl.
  • search() location is a plain str, not a Location object (unlike scrape()).
  • SearchRequest model defaults: limit=5, timeout=300000.

Source Of Truth

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