Skip to content

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

feat(agent): include model in status responses (#2717)

firecrawl-spring[bot]c9df6959c7d0
diff --git a/apps/api/src/controllers/v2/__tests__/agent-status.test.ts b/apps/api/src/controllers/v2/__tests__/agent-status.test.ts
new file mode 100644
index 000000000..d2bfe77ad
--- /dev/null
+++ b/apps/api/src/controllers/v2/__tests__/agent-status.test.ts
@@ -0,0 +1,77 @@
+import type { Response } from "express";
+import { agentStatusController } from "../agent-status";
+import type { RequestWithAuth } from "../types";
+import {
+ supabaseGetAgentByIdDirect,
+ supabaseGetAgentRequestByIdDirect,
+} from "../../../lib/supabase-jobs";
+import { getJobFromGCS } from "../../../lib/gcs-jobs";
+
+jest.mock("../../../lib/supabase-jobs", () => ({
+ supabaseGetAgentByIdDirect: jest.fn(),
+ supabaseGetAgentRequestByIdDirect: jest.fn(),
+}));
+
+jest.mock("../../../lib/gcs-jobs", () => ({
+ getJobFromGCS: jest.fn(),
+}));
+
+describe("agentStatusController", () => {
+ const baseReq = {
+ params: { jobId: "job-123" },
+ auth: { team_id: "team-123" },
+ } as RequestWithAuth<{ jobId: string }, any, any>;
+
+ const buildRes = () =>
+ ({
+ status: jest.fn().mockReturnThis(),
+ json: jest.fn(),
+ }) as unknown as Response;
+
+ beforeEach(() => {
+ jest.clearAllMocks();
+ });
+
+ it("returns model from agent options", async () => {
+ (supabaseGetAgentRequestByIdDirect as jest.Mock).mockResolvedValue({
+ team_id: "team-123",
+ created_at: "2025-01-01T00:00:00Z",
+ });
+ (supabaseGetAgentByIdDirect as jest.Mock).mockResolvedValue({
+ id: "job-123",
+ is_successful: true,
+ options: { model: "spark-1-mini" },
+ created_at: "2025-01-01T00:00:00Z",
+ });
+ (getJobFromGCS as jest.Mock).mockResolvedValue({ result: "ok" });
+
+ const res = buildRes();
+ await agentStatusController(baseReq, res);
+
+ expect(res.status).toHaveBeenCalledWith(200);
+ expect(res.json).toHaveBeenCalledWith(
+ expect.objectContaining({ model: "spark-1-mini" }),
+ );
+ });
+
+ it("defaults model to spark-1-pro when missing", async () => {
+ (supabaseGetAgentRequestByIdDirect as jest.Mock).mockResolvedValue({
+ team_id: "team-123",
+ created_at: "2025-01-01T00:00:00Z",
+ });
+ (supabaseGetAgentByIdDirect as jest.Mock).mockResolvedValue({
+ id: "job-123",
+ is_successful: false,
+ options: null,
+ created_at: "2025-01-01T00:00:00Z",
+ });
+
+ const res = buildRes();
+ await agentStatusController(baseReq, res);
+
+ expect(res.status).toHaveBeenCalledWith(200);
+ expect(res.json).toHaveBeenCalledWith(
+ expect.objectContaining({ model: "spark-1-pro" }),
+ );
+ });
+});
diff --git a/apps/api/src/controllers/v2/agent-status.ts b/apps/api/src/controllers/v2/agent-status.ts
index a2c99ce5f..9280e013c 100644
--- a/apps/api/src/controllers/v2/agent-status.ts
+++ b/apps/api/src/controllers/v2/agent-status.ts
@@ -28,6 +28,15 @@ export async function agentStatusController(
if (agent?.is_successful) {
data = await getJobFromGCS(agent.id);
}
+ const model =
+ (
+ agent?.options as
+ | { model?: "spark-1-pro" | "spark-1-mini" }
+ | null
+ | undefined
+ )?.model === "spark-1-mini"
+ ? "spark-1-mini"
+ : "spark-1-pro";
return res.status(200).json({
success: true,
@@ -38,6 +47,7 @@ export async function agentStatusController(
: "failed",
error: agent?.error || undefined,
data,
+ model,
expiresAt: new Date(
new Date(agent?.created_at ?? agentRequest.created_at).getTime() +
1000 * 60 * 60 * 24,
diff --git a/apps/api/src/controllers/v2/types.ts b/apps/api/src/controllers/v2/types.ts
index 4cb2b3beb..1273b92c0 100644
--- a/apps/api/src/controllers/v2/types.ts
+++ b/apps/api/src/controllers/v2/types.ts
@@ -1133,6 +1133,7 @@ export type AgentStatusResponse =
status: "processing" | "completed" | "failed";
error?: string;
data?: any;
+ model?: "spark-1-pro" | "spark-1-mini";
expiresAt: string;
creditsUsed?: number;
};
diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.json
index 9357ae19f..fb0479336 100644
--- a/apps/js-sdk/firecrawl/package.json
+++ b/apps/js-sdk/firecrawl/package.json
@@ -1,6 +1,6 @@
{
"name": "@mendable/firecrawl-js",
- "version": "4.11.3",
+ "version": "4.11.4",
"description": "JavaScript SDK for Firecrawl API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/apps/js-sdk/firecrawl/src/v2/types.ts b/apps/js-sdk/firecrawl/src/v2/types.ts
index 02be36336..b3ec7523e 100644
--- a/apps/js-sdk/firecrawl/src/v2/types.ts
+++ b/apps/js-sdk/firecrawl/src/v2/types.ts
@@ -556,6 +556,7 @@ export interface AgentStatusResponse {
status: 'processing' | 'completed' | 'failed';
error?: string;
data?: unknown;
+ model?: 'spark-1-pro' | 'spark-1-mini';
expiresAt: string;
creditsUsed?: number;
}
diff --git a/apps/python-sdk/firecrawl/__init__.py b/apps/python-sdk/firecrawl/__init__.py
index 76deaa9be..fbea47891 100644
--- a/apps/python-sdk/firecrawl/__init__.py
+++ b/apps/python-sdk/firecrawl/__init__.py
@@ -17,7 +17,7 @@ from .v1 import (
V1ChangeTrackingOptions,
)
-__version__ = "4.13.3"
+__version__ = "4.13.4"
# Define the logger for the Firecrawl project
logger: logging.Logger = logging.getLogger("firecrawl")
diff --git a/apps/python-sdk/firecrawl/v2/types.py b/apps/python-sdk/firecrawl/v2/types.py
index 297332a04..6439c3142 100644
--- a/apps/python-sdk/firecrawl/v2/types.py
+++ b/apps/python-sdk/firecrawl/v2/types.py
@@ -804,6 +804,7 @@ class AgentResponse(BaseModel):
status: Optional[Literal["processing", "completed", "failed"]] = None
data: Optional[Any] = None
error: Optional[str] = None
+ model: Optional[Literal["spark-1-pro", "spark-1-mini"]] = None
expires_at: Optional[datetime] = None
credits_used: Optional[int] = None