Skip to content

The agent that grows with you

fix(web/firecrawl): accept the server timeout in the keyless scrape client

Brooklyn Nicholsona510d6c64a61
diff --git a/plugins/web/firecrawl/provider.py b/plugins/web/firecrawl/provider.py
index 5e960553680..9363a9596e6 100644
--- a/plugins/web/firecrawl/provider.py
+++ b/plugins/web/firecrawl/provider.py
@@ -121,7 +121,12 @@ class _KeylessFirecrawlClient:
return response.json()
search = lambda self, *, query, limit=5: self._post("/v2/search", {"query": query, "limit": limit}) # noqa: E731
- scrape = lambda self, *, url, formats: self._post("/v2/scrape", {"url": url, "formats": formats}) # noqa: E731
+ def scrape(self, *, url, formats, timeout=None):
+ # _scrape_one passes the SDK's server-side ``timeout`` (ms); the v2 REST payload takes the same field.
+ payload = {"url": url, "formats": formats}
+ if timeout is not None:
+ payload["timeout"] = timeout
+ return self._post("/v2/scrape", payload)
def _get_firecrawl_gateway_url() -> str:
diff --git a/tests/tools/test_web_tools_config.py b/tests/tools/test_web_tools_config.py
index b504d98e419..9c73c9a0066 100644
--- a/tests/tools/test_web_tools_config.py
+++ b/tests/tools/test_web_tools_config.py
@@ -192,6 +192,34 @@ class TestFirecrawlClientConfig:
assert captured["headers"] == {"Content-Type": "application/json"}
assert "Authorization" not in captured["headers"]
+ def test_extract_through_keyless_client_forwards_server_timeout(self, monkeypatch):
+ """_scrape_one passes the SDK's ``timeout`` kwarg; the keyless client must accept and forward it."""
+ import asyncio
+
+ from plugins.web.firecrawl import provider as firecrawl_provider
+
+ captured = {}
+
+ class _Response:
+ def raise_for_status(self):
+ return None
+
+ def json(self):
+ return {"success": True, "data": {"markdown": "# ok", "metadata": {"sourceURL": "https://example.com"}}}
+
+ def _fake_post(url, *, json, headers, timeout):
+ captured["json"] = json
+ return _Response()
+
+ monkeypatch.setattr(firecrawl_provider.httpx, "post", _fake_post)
+ monkeypatch.setattr(firecrawl_provider, "_get_firecrawl_client", firecrawl_provider._KeylessFirecrawlClient)
+ monkeypatch.setattr(firecrawl_provider, "check_website_access", lambda url: None)
+
+ entry = asyncio.run(firecrawl_provider._scrape_one("https://example.com", ["markdown"], None))
+
+ assert "error" not in entry or not entry["error"], entry
+ assert captured["json"]["timeout"] == 60_000
+
class TestBackendSelection:
"""Test suite for _get_backend() backend selection logic.