Repository navigation
feat(search): add Firecrawl as an opt-in keyed fallback search engine - #116
Closed
JuampiHernandez wants to merge 1 commit into
Closed
JuampiHernandez wants to merge 1 commit into
JuampiHernandez wants to merge 1 commit into
Conversation
Adds a firecrawl adapter to the keyed fallback registry, after serply in the default SEARCH_FALLBACK_ORDER. POST https://api.firecrawl.dev/v2/search with the query in the JSON body and the key in an Authorization: Bearer header (neither in the URL), limit capped at 100 (the API's per-request max), highlights off so description is the plain result snippet, data.web[] title/url/description mapped to the shared title/href/body shape, non-http links skipped. A new _http_post_json helper mirrors _http_get_json (same timeout, returns None on any failure). Inert unless FIRECRAWL_API_KEY is set. Signed-off-by: JuampiHernandez <102912458+JuampiHernandez@users.noreply.github.com>
8 of 9 tasks
Owner
|
Thanks for contributing the Firecrawl integration. The native Go implementation is now merged in #118, carrying the opt-in fallback behavior proposed here with Go-side request/response guards and tests. Closing this Python-backend PR as superseded by #118. The accompanying Spicrawl integration and sponsor README are also merged in #119. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey, I'm Juampi from the Firecrawl team.
What & why
This adds Firecrawl as one more opt-in keyed engine in the search fallback chain behind DuckDuckGo. It's built the same way as the keyed adapters added in #14 and #39: same 5 files, same spots in each. With
FIRECRAWL_API_KEYunset, nothing changes.The chain is there for
site:lookups that come back empty from DDG. Firecrawl search handlessite:operators in the query, so it covers that case (live output below), and it returns the plain title, URL and snippet for each result with no page content fetched.Changes
apps/api/services/leadgen/search_engines.py: new_firecrawladapter, registered asfirecrawlin_ADAPTERSand appended last in the defaultSEARCH_FALLBACK_ORDER, so existing setups route exactly as before. It sendsPOST https://api.firecrawl.dev/v2/searchwith the query in the JSON body and the key in anAuthorization: Bearerheader.limitis capped at 100, the API's per-request max, andhighlightsis off sodescriptionis the plain result snippet.data.web[](title/url/description) maps to the sharedtitle/href/bodyshape, and links that aren'thttp(s)are skipped. A new_http_post_jsonhelper sits next to_http_get_jsonwith the same contract: same timeout,Noneon any failure, nothing raised to the caller.apps/api/services/leadgen/config.py:FIRECRAWL_API_KEY..env.example: commentedFIRECRAWL_API_KEYline.tests/test_search_multi_engine.py: Firecrawl in the shape-parity test and the clean-env lists, plustest_firecrawl_posts_query_with_bearer_key_and_caps_limit(POST only, endpoint, bearer header, key not in the URL or body,limitcap and pass-through, non-URL link dropped, no page content or highlights requested).tests/test_search_cache.py:FIRECRAWL_API_KEYin the clean-env list.Type
Checklist
git commit -s) per the DCOuv run pytest): 2360 passed, 134 skipped, 8 deselected with CI's-m 'not live and not postgres'bun run lint && bun run build): 4 of 4 tasks successfulSecurity-sensitive?
Yes, it adds one outbound fetch to a fixed host (
api.firecrawl.dev) over HTTPS, only whenFIRECRAWL_API_KEYis set. You asked about these points on #14, so here they are for this provider:POST, so the query isn't in the URL and doesn't show up in logs that record URLs. The key travels in theAuthorizationheader, and failures return[]without logging it.enterprise: ["zdr"]on the request, enforced at Firecrawl and at the upstream provider. This adapter doesn't send it, so users should assume standard retention. Details are on the security overview.If you want a short note like this next to the key in
.env.exampleor the docs, or an opt-in setting that sends the ZDR flag for teams that have it, I can add it here.Screenshots / notes
How I tested it
uv run pytest tests/test_search_multi_engine.py tests/test_search_cache.py: 33 passed. Then a live run with a real key andSEARCH_FALLBACK_ORDER=firecrawl:Links: firecrawl.dev, search API docs.