Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

chore(agent): run agent location tests in CI and clarify search behaviour (#5255)

Rakshith Ramprakash5c198a7d9376
diff --git a/.github/workflows/test-server.yml b/.github/workflows/test-server.yml
index 42336783c..34004dcf5 100644
--- a/.github/workflows/test-server.yml
+++ b/.github/workflows/test-server.yml
@@ -295,6 +295,11 @@ jobs:
--reporter=default
working-directory: apps/api
+ - name: Run agent location regression tests
+ if: matrix.engine == 'fetch' && matrix.proxy == 'no-proxy' && matrix.nuq == 'postgres'
+ run: pnpm exec vitest run src/controllers/v2/__tests__/agent-location.test.ts --reporter=default
+ working-directory: apps/api
+
- name: Install test site dependencies
run: pnpm install --frozen-lockfile
working-directory: apps/test-site
diff --git a/apps/api/src/controllers/v2/__tests__/agent-location.test.ts b/apps/api/src/controllers/v2/__tests__/agent-location.test.ts
index 9c81431db..a352acaf5 100644
--- a/apps/api/src/controllers/v2/__tests__/agent-location.test.ts
+++ b/apps/api/src/controllers/v2/__tests__/agent-location.test.ts
@@ -8,7 +8,13 @@ vi.mock("../../../lib/crawl-regex", async () => {
import { agentController } from "../agent";
import { agentRequestSchema } from "../types";
vi.mock("../../../lib/logger", () => {
- const logger = { info: vi.fn(), error: vi.fn(), child: vi.fn() };
+ const logger = {
+ info: vi.fn(),
+ warn: vi.fn(),
+ error: vi.fn(),
+ debug: vi.fn(),
+ child: vi.fn(),
+ };
logger.child.mockReturnValue(logger);
return { logger };
});
diff --git a/apps/js-sdk/firecrawl/src/v2/methods/agent.ts b/apps/js-sdk/firecrawl/src/v2/methods/agent.ts
index f2a19d3a5..c45e8c3f5 100644
--- a/apps/js-sdk/firecrawl/src/v2/methods/agent.ts
+++ b/apps/js-sdk/firecrawl/src/v2/methods/agent.ts
@@ -21,7 +21,10 @@ function prepareAgentPayload(args: {
threadId?: string;
mode?: AgentMode;
exchange?: AgentExchangeOptions;
- /** Proxy country for every request the agent makes (ISO 3166-1 alpha-2). The agent cannot change it. */
+ /**
+ * Country for the whole run (ISO 3166-1 alpha-2). Scrapes and browser sessions are proxied from it,
+ * and search results are localized to it without changing where requests come from. The agent cannot change it.
+ */
location?: { country: string };
}): Record<string, unknown> {
const body: Record<string, unknown> = {};
diff --git a/apps/python-sdk/firecrawl/v2/client.py b/apps/python-sdk/firecrawl/v2/client.py
index 648f35268..3103e7f29 100644
--- a/apps/python-sdk/firecrawl/v2/client.py
+++ b/apps/python-sdk/firecrawl/v2/client.py
@@ -1571,8 +1571,10 @@ class FirecrawlClient:
thread_id: Continue an existing thread instead of starting one
mode: "extract" (default) or "chat"
exchange: Data provider options, forwarded as sent
- location: Proxy country for every request the agent makes, as
- ``{"country": "DE"}`` (ISO 3166-1 alpha-2). The agent cannot change it.
+ location: Country for the whole run, as ``{"country": "DE"}``
+ (ISO 3166-1 alpha-2). Scrapes and browser sessions are proxied
+ from it, and search results are localized to it without changing
+ where requests come from. The agent cannot change it.
Returns:
Response payload with job id/status (poll with get_agent_status)
"""
@@ -1635,8 +1637,10 @@ class FirecrawlClient:
thread_id: Continue an existing thread instead of starting one
mode: "extract" (default) or "chat"
exchange: Data provider options, forwarded as sent
- location: Proxy country for every request the agent makes, as
- ``{"country": "DE"}`` (ISO 3166-1 alpha-2). The agent cannot change it.
+ location: Country for the whole run, as ``{"country": "DE"}``
+ (ISO 3166-1 alpha-2). Scrapes and browser sessions are proxied
+ from it, and search results are localized to it without changing
+ where requests come from. The agent cannot change it.
Returns:
Final agent response when completed
"""