Skip to content

Upgrade Firecrawl loader to firecrawl-py v2 (v4 SDK) + add search()#4095

Open
rakshith48 wants to merge 2 commits into
camel-ai:masterfrom
rakshith48:firecrawl-v2-upgrade
Open

Upgrade Firecrawl loader to firecrawl-py v2 (v4 SDK) + add search()#4095
rakshith48 wants to merge 2 commits into
camel-ai:masterfrom
rakshith48:firecrawl-v2-upgrade

Conversation

@rakshith48

@rakshith48 rakshith48 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Resolves #4100

Upgrades camel/loaders/firecrawl_reader.py from firecrawl-py v1 to v2 (v4 SDK): FirecrawlAppFirecrawl, v2 methods + typed-response handling, pin firecrawl-py>=4,<5. Public wrapper method names/signatures preserved (scrape/crawl/structured_scrape/map_site); adds a new search() method. Unit tests migrated to the v2 API.

Verification: static + SDK-introspection/mocked against the real v2 SDK (firecrawl-py 4.28.2 / @mendable firecrawl v4); not run against the live API. Happy to address review/CI feedback.

🤖 Generated with Claude Code

rak-f and others added 2 commits June 4, 2026 13:01
Migrate camel/loaders/firecrawl_reader.py from the legacy v1 firecrawl-py
SDK to the current v2 SDK (firecrawl-py v4). Public method names and
signatures on the `Firecrawl` wrapper are unchanged so existing callers
keep working; only the underlying SDK calls change.

- Import `from firecrawl import Firecrawl as FirecrawlApp` (v2 unified
  client) instead of the v1 `FirecrawlApp`.
- crawl_url -> crawl, check_crawl_status -> get_crawl_status,
  scrape_url -> scrape, map_url -> map.
- structured_scrape now uses the v2 `json` scrape format
  (formats=[{"type": "json", "schema": ...}]) and reads `json` instead of
  the v1 `extract` field.
- v2 returns typed pydantic models (Document, CrawlJob, MapData); normalize
  them back to dict/list so the public return shapes are preserved
  (map_site still returns a list of URL strings).
- Bump the firecrawl-py pin to `>=4.0.0,<5` in pyproject.toml.
- Update test/loaders/test_firecrawl.py to the v2 API (patch
  `firecrawl.Firecrawl`, mock crawl/get_crawl_status/scrape/map) and add
  structured_scrape success coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 27a54401-a15a-4dc5-90e6-ad4cba7832fc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@fengju0213

Copy link
Copy Markdown
Collaborator

@rakshith48 thanks,could you please also open a related issue?

@rakshith48

rakshith48 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Done, opened #4100 and linked it to this PR (Resolves #4100). Thanks @fengju0213!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Upgrade the Firecrawl loader to the v2 SDK (firecrawl-py v4) and add search()

3 participants