Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat: add custom model option

Gusc222787a3569
diff --git a/src/cli/daemon/daemon.test.ts b/src/cli/daemon/daemon.test.ts
index 0ef0c4258..0a3cc3835 100644
--- a/src/cli/daemon/daemon.test.ts
+++ b/src/cli/daemon/daemon.test.ts
@@ -237,6 +237,52 @@ describe("daemon session runner dispatch", () => {
expect(input.agentTimeout).toBe(7200000);
});
+ it("uses runtime_config.model when set on agent", async () => {
+ const fakeTask = {
+ id: "t1",
+ agent_id: "a1",
+ runtime_id: "rt1",
+ conversation_id: "c1",
+ workspace_id: "ws1",
+ prompt: "do stuff",
+ status: "dispatched",
+ priority: 0,
+ dispatched_at: null,
+ started_at: null,
+ completed_at: null,
+ created_at: "2026-01-01T00:00:00Z",
+ type: "user_dm_message",
+ result: null,
+ error: null,
+ agent: { name: "Agent 1", instructions: "be helpful", runtime_config: { model: "custom-model" } },
+ };
+
+ let claimed = false;
+ mockClientInstance.poll.mockImplementation(async () => {
+ if (!claimed) {
+ claimed = true;
+ return [fakeTask];
+ }
+ return [];
+ });
+
+ await startDaemon();
+ await new Promise((r) => setTimeout(r, 50));
+
+ const input = decodeSpawnInput(vi.mocked(spawn).mock.calls[0]);
+ expect(input.model).toBe("custom-model");
+ });
+
+ it("falls back to config model when runtime_config.model is empty", async () => {
+ setupTaskClaim();
+
+ await startDaemon();
+ await new Promise((r) => setTimeout(r, 50));
+
+ const input = decodeSpawnInput(vi.mocked(spawn).mock.calls[0]);
+ expect(input.model).toBe("opus");
+ });
+
it("spawns with detached: true and calls unref()", async () => {
setupTaskClaim();
diff --git a/src/cli/daemon/daemon.ts b/src/cli/daemon/daemon.ts
index 0b07cdbcc..70d862daa 100644
--- a/src/cli/daemon/daemon.ts
+++ b/src/cli/daemon/daemon.ts
@@ -292,12 +292,14 @@ async function handleTask(
: provider === "codex"
? config.codexPath
: config.opencodePath;
- const model =
+ const configModel =
provider === "claude"
? config.claudeModel
: provider === "codex"
? config.codexModel
: config.opencodeModel;
+ const agentModel = task.agent?.runtimeConfig?.model;
+ const model = (typeof agentModel === "string" && agentModel) ? agentModel : configModel;
const input: SessionRunnerInput = {
task,
diff --git a/src/cli/daemon/types.test.ts b/src/cli/daemon/types.test.ts
new file mode 100644
index 000000000..8158adaee
--- /dev/null
+++ b/src/cli/daemon/types.test.ts
@@ -0,0 +1,57 @@
+import { describe, it, expect } from "vitest";
+import { fromApiTask } from "./types.js";
+import type { TaskApi } from "@alook/shared";
+
+describe("fromApiTask", () => {
+ const baseTask: TaskApi = {
+ id: "t1",
+ agent_id: "a1",
+ runtime_id: "rt1",
+ conversation_id: "c1",
+ workspace_id: "ws1",
+ prompt: "hello",
+ status: "dispatched",
+ priority: 0,
+ dispatched_at: null,
+ started_at: null,
+ completed_at: null,
+ result: null,
+ error: null,
+ created_at: "2026-01-01T00:00:00Z",
+ type: "user_dm_message",
+ agent: null,
+ };
+
+ it("maps runtime_config from agent data", () => {
+ const task: TaskApi = {
+ ...baseTask,
+ agent: {
+ name: "Agent 1",
+ instructions: "be helpful",
+ runtime_config: { model: "custom-model" },
+ },
+ };
+
+ const result = fromApiTask(task);
+ expect(result.agent?.runtimeConfig).toEqual({ model: "custom-model" });
+ });
+
+ it("sets runtimeConfig to empty object when runtime_config is empty", () => {
+ const task: TaskApi = {
+ ...baseTask,
+ agent: {
+ name: "Agent 1",
+ instructions: "be helpful",
+ runtime_config: {},
+ },
+ };
+
+ const result = fromApiTask(task);
+ expect(result.agent?.runtimeConfig).toEqual({});
+ });
+
+ it("handles missing agent gracefully", () => {
+ const result = fromApiTask(baseTask);
+ expect(result.agent).toBeUndefined();
+ });
+});
diff --git a/src/cli/daemon/types.ts b/src/cli/daemon/types.ts
index b39270e02..5c5e972ed 100644
--- a/src/cli/daemon/types.ts
+++ b/src/cli/daemon/types.ts
@@ -19,6 +19,7 @@ export interface TaskAgentData {
instructions: string;
emailHandle?: string | null;
userEmail?: string | null;
+ runtimeConfig?: Record<string, unknown>;
}
export interface RepoData {
@@ -101,7 +102,7 @@ export function fromApiTask(api: import("@alook/shared").TaskApi): Task {
priority: api.priority,
type: api.type,
agent: api.agent
- ? { name: api.agent.name, instructions: api.agent.instructions, emailHandle: api.agent.email_handle ?? undefined, userEmail: api.agent.user_email ?? undefined }
+ ? { name: api.agent.name, instructions: api.agent.instructions, emailHandle: api.agent.email_handle ?? undefined, userEmail: api.agent.user_email ?? undefined, runtimeConfig: api.agent.runtime_config ?? undefined }
: undefined,
repos: undefined,
createdAt: api.created_at,
diff --git a/src/shared/src/db/queries/agent.ts b/src/shared/src/db/queries/agent.ts
index 16f070110..984834f87 100644
--- a/src/shared/src/db/queries/agent.ts
+++ b/src/shared/src/db/queries/agent.ts
@@ -83,6 +83,7 @@ export async function updateAgent(
description?: string;
instructions?: string;
runtimeId?: string | null;
+ runtimeConfig?: unknown;
}
) {
const rows = await db
diff --git a/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx b/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx
index b2f9880c9..d80ac3644 100644
--- a/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx
+++ b/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useState, type ReactNode } from "react";
+import { useState, useEffect, type ReactNode } from "react";
import { useParams, useRouter, usePathname } from "next/navigation";
import Link from "next/link";
import { useAgentContext } from "@/contexts/agent-context";
@@ -11,6 +11,7 @@ import { AgentEditForm } from "@/components/agent-edit-form";
import { Skeleton } from "@/components/ui/skeleton";
import { cn } from "@/lib/utils";
import { CalendarDays, Mail, MessageSquare, Pencil, Trash2, X } from "lucide-react";
+import { fetchModelOptions } from "@/lib/api";
export default function AgentDetailLayout({ children }: { children: ReactNode }) {
const params = useParams();
@@ -29,6 +30,11 @@ export default function AgentDetailLayout({ children }: { children: ReactNode })
const [saving, setSaving] = useState(false);
const [agentConfirmOpen, setAgentConfirmOpen] = useState(false);
const [agentDeleting, setAgentDeleting] = useState(false);
+ const [modelOptions, setModelOptions] = useState<Record<string, string[]>>({});
+
+ useEffect(() => {
+ fetchModelOptions().then(setModelOptions).catch(() => {});
+ }, []);
return (
<>
@@ -136,6 +142,7 @@ export default function AgentDetailLayout({ children }: { children: ReactNode })
<AgentEditForm
agent={agent}
runtimes={runtimes}
+ modelOptions={modelOptions}
saving={saving}
onCancel={() => setEditing(false)}
onSave={async (data) => {
diff --git a/src/web/src/app/(app)/w/[slug]/agents/new/page.tsx b/src/web/src/app/(app)/w/[slug]/agents/new/page.tsx
index b9d46328d..1465d5435 100644
--- a/src/web/src/app/(app)/w/[slug]/agents/new/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/agents/new/page.tsx
@@ -1,10 +1,11 @@
"use client";
-import { useState } from "react";
+import { useState, useEffect } from "react";
import { useRouter } from "next/navigation";
import { useAgentContext } from "@/contexts/agent-context";
import { useWorkspace } from "@/contexts/workspace-context";
import { AgentEditForm } from "@/components/agent-edit-form";
+import { fetchModelOptions } from "@/lib/api";
export default function CreateAgentPage() {
const router = useRouter();
@@ -16,6 +17,11 @@ export default function CreateAgentPage() {
} = useAgentContext();
const [saving, setSaving] = useState(false);
+ const [modelOptions, setModelOptions] = useState<Record<string, string[]>>({});
+
+ useEffect(() => {
+ fetchModelOptions().then(setModelOptions).catch(() => {});
+ }, []);
return (
<>
@@ -26,6 +32,7 @@ export default function CreateAgentPage() {
<AgentEditForm
runtimes={runtimes}
defaultRuntimeId={getFirstOnlineRuntimeId()}
+ modelOptions={modelOptions}
saving={saving}
submitLabel="Create"
savingLabel="Creating..."
@@ -39,6 +46,7 @@ export default function CreateAgentPage() {
instructions: data.instructions || undefined,
runtime_id: data.runtime_id,
email_handle: data.email_handle || undefined,
+ runtime_config: data.runtime_config,
});
if (agent) {
router.push(`/w/${slug}/agents/${agent.id}/chat`);
diff --git a/src/web/src/app/(app)/workspaces/client.tsx b/src/web/src/app/(app)/workspaces/client.tsx
index ad29bbc53..6e3bc9bfa 100644
--- a/src/web/src/app/(app)/workspaces/client.tsx
+++ b/src/web/src/app/(app)/workspaces/client.tsx
@@ -83,12 +83,12 @@ export function WorkspaceListClient({
className="cursor-pointer transition-colors duration-200 hover:bg-accent/50"
onClick={() => router.push(`/w/${ws.slug}/home`)}
>
- <CardContent className="flex items-center justify-between p-4">
- <div className="min-w-0">
+ <CardContent className="flex items-center justify-between px-3 py-1.5">
+ <div className="flex items-center gap-2 min-w-0">
<p className="text-sm font-medium truncate">{ws.name}</p>
<p className="text-xs text-muted-foreground">{ws.slug}</p>
</div>
- <ArrowRight className="size-4 text-muted-foreground shrink-0" />
+ <ArrowRight className="size-3.5 text-muted-foreground shrink-0" />
</CardContent>
</Card>
))}
diff --git a/src/web/src/app/api/agents/[id]/route.test.ts b/src/web/src/app/api/agents/[id]/route.test.ts
index f9986c01e..11e14ce17 100644
--- a/src/web/src/app/api/agents/[id]/route.test.ts
+++ b/src/web/src/app/api/agents/[id]/route.test.ts
@@ -145,4 +145,42 @@ describe("PATCH /api/agents/[id]", () => {
expect(body.error).toBe("invalid request body");
});
+ it("accepts and persists runtime_config", async () => {
+ mockUpdateAgent.mockResolvedValue({ id: "a1", name: "Agent" });
+
+ const req = new NextRequest("http://localhost/api/agents/a1", {
+ method: "PATCH",
+ body: JSON.stringify({ name: "Agent", runtime_config: { model: "claude-sonnet-4-6" } }),
+ });
+ const ctx = { params: Promise.resolve({ id: "a1" }) };
+ const res = await PATCH(req, ctx);
+
+ expect(res.status).toBe(200);
+ expect(mockUpdateAgent).toHaveBeenCalledWith(
+ expect.anything(),
+ "a1",
+ "w1",
+ expect.objectContaining({ runtimeConfig: { model: "claude-sonnet-4-6" } }),
+ );
+ });
+
+ it("runtime_config alone is a valid update", async () => {
+ mockUpdateAgent.mockResolvedValue({ id: "a1", name: "Agent" });
+
+ const req = new NextRequest("http://localhost/api/agents/a1", {
+ method: "PATCH",
+ body: JSON.stringify({ runtime_config: { model: "x" } }),
+ });
+ const ctx = { params: Promise.resolve({ id: "a1" }) };
+ const res = await PATCH(req, ctx);
+
+ expect(res.status).toBe(200);
+ expect(mockUpdateAgent).toHaveBeenCalledWith(
+ expect.anything(),
+ "a1",
+ "w1",
+ expect.objectContaining({ runtimeConfig: { model: "x" } }),
+ );
+ });
+
});
diff --git a/src/web/src/app/api/agents/[id]/route.ts b/src/web/src/app/api/agents/[id]/route.ts
index 5781dc549..c3917a017 100644
--- a/src/web/src/app/api/agents/[id]/route.ts
+++ b/src/web/src/app/api/agents/[id]/route.ts
@@ -49,12 +49,22 @@ export const PATCH = withAuth(async (req, ctx) => {
if (typeof body.description === "string") data.description = body.description;
if (typeof body.instructions === "string") data.instructions = body.instructions;
if (typeof body.runtime_id === "string") data.runtimeId = body.runtime_id;
+ if (body.runtime_config !== undefined) {
+ if (typeof body.runtime_config === "object" && body.runtime_config !== null && !Array.isArray(body.runtime_config)) {
+ const rc = body.runtime_config as Record<string, unknown>;
+ const sanitized: Record<string, unknown> = {};
+ if (typeof rc.model === "string" && rc.model.length <= 100) {
+ sanitized.model = rc.model;
+ }
+ data.runtimeConfig = sanitized;
+ }
+ }
if (Object.keys(data).length === 0) {
return writeError("no fields to update", 400);
}
- const updated = await queries.agent.updateAgent(db, id, ws.workspaceId, data as { name?: string; description?: string; instructions?: string; runtimeId?: string });
+ const updated = await queries.agent.updateAgent(db, id, ws.workspaceId, data as { name?: string; description?: string; instructions?: string; runtimeId?: string; runtimeConfig?: unknown });
if (!updated) {
return writeError("agent not found", 404);
}
diff --git a/src/web/src/app/api/agents/route.test.ts b/src/web/src/app/api/agents/route.test.ts
index 8c875df34..51139446c 100644
--- a/src/web/src/app/api/agents/route.test.ts
+++ b/src/web/src/app/api/agents/route.test.ts
@@ -162,4 +162,26 @@ describe("POST /api/agents", () => {
expect(mockReconcileAgentStatus).not.toHaveBeenCalled();
expect(body).toEqual({ id: "a1", name: "New Agent" });
});
+
+ it("passes runtime_config through to createAgent", async () => {
+ mockGetAgentRuntimeForWorkspace.mockResolvedValue({ machineLastSeenAt: null, runtimeMode: "local" });
+ mockCreateAgent.mockResolvedValue({ id: "a1", name: "New Agent" });
+
+ const req = new NextRequest("http://localhost/api/agents", {
+ method: "POST",
+ body: JSON.stringify({
+ ...validBody,
+ runtime_config: { model: "claude-sonnet-4-6" },
+ }),
+ });
+ const res = await POST(req, {});
+
+ expect(res.status).toBe(201);
+ expect(mockCreateAgent).toHaveBeenCalledWith(
+ expect.anything(),
+ expect.objectContaining({
+ runtimeConfig: { model: "claude-sonnet-4-6" },
+ }),
+ );
+ });
});
diff --git a/src/web/src/app/api/agents/route.ts b/src/web/src/app/api/agents/route.ts
index cce9898b2..e00bb44f4 100644
--- a/src/web/src/app/api/agents/route.ts
+++ b/src/web/src/app/api/agents/route.ts
@@ -77,6 +77,15 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {
return writeError("runtime not found in workspace", 404);
}
+ let sanitizedRc: Record<string, unknown> | null = null;
+ if (typeof body.runtime_config === "object" && body.runtime_config !== null && !Array.isArray(body.runtime_config)) {
+ const rc = body.runtime_config as Record<string, unknown>;
+ sanitizedRc = {};
+ if (typeof rc.model === "string" && rc.model.length <= 100) {
+ sanitizedRc.model = rc.model;
+ }
+ }
+
const newAgent = await queries.agent.createAgent(db, {
workspaceId: ws.workspaceId,
name,
@@ -84,7 +93,7 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {
instructions: body.instructions || "",
runtimeId,
runtimeMode: runtime.runtimeMode,
- runtimeConfig: body.runtime_config ?? null,
+ runtimeConfig: sanitizedRc,
visibility: "private",
maxConcurrentTasks,
ownerId: ctx.userId,
diff --git a/src/web/src/app/api/config/model-options/route.test.ts b/src/web/src/app/api/config/model-options/route.test.ts
new file mode 100644
index 000000000..12a194e65
--- /dev/null
+++ b/src/web/src/app/api/config/model-options/route.test.ts
@@ -0,0 +1,80 @@
+import { NextRequest } from "next/server";
+
+const mockEnv: Record<string, unknown> = { DB: {} };
+
+vi.mock("@opennextjs/cloudflare", () => ({
+ getCloudflareContext: vi.fn(() => ({ env: mockEnv })),
+}));
+
+vi.mock("@/lib/middleware/auth", () => ({
+ withAuth: vi.fn((handler: any) => async (req: any, ctx?: any) => {
+ const params = ctx?.params instanceof Promise ? await ctx.params : ctx?.params;
+ return handler(req, { userId: "u1", email: "[email protected]", params });
+ }),
+}));
+
+import { GET } from "./route";
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ delete mockEnv.RUNTIME_MODEL_OPTIONS;
+});
+
+describe("GET /api/config/model-options", () => {
+ it("returns parsed config when valid JSON", async () => {
+ mockEnv.RUNTIME_MODEL_OPTIONS = '{"claude":["claude-opus-4-6","claude-sonnet-4-6"],"opencode":["gpt-4.1"]}';
+
+ const req = new NextRequest("http://localhost/api/config/model-options");
+ const res = await GET(req, {});
+ const body = await res.json();
+
+ expect(res.status).toBe(200);
+ expect(body).toEqual({
+ claude: ["claude-opus-4-6", "claude-sonnet-4-6"],
+ opencode: ["gpt-4.1"],
+ });
+ });
+
+ it("returns {} when env var is unset", async () => {
+ const req = new NextRequest("http://localhost/api/config/model-options");
+ const res = await GET(req, {});
+ const body = await res.json();
+
+ expect(res.status).toBe(200);
+ expect(body).toEqual({});
+ });
+
+ it("returns {} for invalid JSON string", async () => {
+ mockEnv.RUNTIME_MODEL_OPTIONS = "not json{";
+
+ const req = new NextRequest("http://localhost/api/config/model-options");
+ const res = await GET(req, {});
+ const body = await res.json();
+
+ expect(res.status).toBe(200);
+ expect(body).toEqual({});
+ });
+
+ it("drops keys with invalid values (non-array)", async () => {
+ mockEnv.RUNTIME_MODEL_OPTIONS = '{"claude":"not-array","opencode":["gpt-4.1"]}';
+
+ const req = new NextRequest("http://localhost/api/config/model-options");
+ const res = await GET(req, {});
+ const body = await res.json();
+
+ expect(res.status).toBe(200);
+ expect(body).toEqual({ opencode: ["gpt-4.1"] });
+ });
+
+ it("returns {} for non-object JSON (array)", async () => {
+ mockEnv.RUNTIME_MODEL_OPTIONS = '["a","b"]';
+
+ const req = new NextRequest("http://localhost/api/config/model-options");
+ const res = await GET(req, {});
+ const body = await res.json();
+
+ expect(res.status).toBe(200);
+ expect(body).toEqual({});
+ });
+});
+
diff --git a/src/web/src/app/api/config/model-options/route.ts b/src/web/src/app/api/config/model-options/route.ts
new file mode 100644
index 000000000..832d5b76c
--- /dev/null
+++ b/src/web/src/app/api/config/model-options/route.ts
@@ -0,0 +1,29 @@
+import { getCloudflareContext } from "@opennextjs/cloudflare"
+import { withAuth } from "@/lib/middleware/auth";
+import { writeJSON } from "@/lib/middleware/helpers";
+
+export const GET = withAuth(async () => {
+ const { env } = getCloudflareContext()
+ const raw = (env as Env).RUNTIME_MODEL_OPTIONS;
+ if (!raw) return writeJSON({});
+
+ let parsed: unknown;
+ try {
+ parsed = JSON.parse(raw);
+ } catch {
+ return writeJSON({});
+ }
+
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
+ return writeJSON({});
+ }
+
+ const result: Record<string, string[]> = {};
+ for (const [key, value] of Object.entries(parsed as Record<string, unknown>)) {
+ if (Array.isArray(value) && value.every((v) => typeof v === "string")) {
+ result[key] = value as string[];
+ }
+ }
+
+ return writeJSON(result);
+});
diff --git a/src/web/src/components/agent-edit-form.tsx b/src/web/src/components/agent-edit-form.tsx
index 128573193..15c61918e 100644
--- a/src/web/src/components/agent-edit-form.tsx
+++ b/src/web/src/components/agent-edit-form.tsx
@@ -23,12 +23,14 @@ interface AgentEditFormProps {
agent?: Agent;
runtimes: Runtime[];
defaultRuntimeId?: string;
+ modelOptions?: Record<string, string[]>;
onSave: (data: {
name: string;
description: string;
instructions: string;
runtime_id: string;
email_handle?: string;
+ runtime_config?: Record<string, unknown>;
}) => Promise<boolean>;
onCancel: () => void;
saving: boolean;
@@ -40,6 +42,7 @@ export function AgentEditForm({
agent,
runtimes,
defaultRuntimeId = "",
+ modelOptions,
onSave,
onCancel,
saving,
@@ -53,6 +56,17 @@ export function AgentEditForm({
agent?.runtime_id ?? defaultRuntimeId
);
const [emailHandle, setEmailHandle] = useState(agent?.email_handle ?? "");
+ const [model, setModel] = useState(
+ () => {
+ const rc = agent?.runtime_config;
+ return typeof rc?.model === "string" ? rc.model : "";
+ }
+ );
+
+ const selectedRuntime = runtimes.find((r) => r.id === runtimeId);
+ const providerModels = selectedRuntime && modelOptions
+ ? modelOptions[selectedRuntime.provider] ?? []
+ : [];
const derivedHandle = nameToHandle(name);
const effectiveHandle = emailHandle || derivedHandle;
@@ -69,6 +83,7 @@ export function AgentEditForm({
instructions,
runtime_id: runtimeId,
email_handle: emailHandle || derivedHandle || undefined,
+ runtime_config: model ? { model } : {},
});
};
@@ -136,6 +151,27 @@ export function AgentEditForm({
/>
</div>
+ <div className="space-y-1.5">
+ <Label htmlFor="agent-model">Model</Label>
+ <Input
+ id="agent-model"
+ value={model}
+ onChange={(e) => setModel(e.target.value)}
+ placeholder="Default (runtime model)"
+ list="agent-model-options"
+ />
+ {providerModels.length > 0 && (
+ <datalist id="agent-model-options">
+ {providerModels.map((m) => (
+ <option key={m} value={m} />
+ ))}
+ </datalist>
+ )}
+ <p className="text-xs text-muted-foreground/70">
+ Optional. Leave blank to use the runtime&apos;s default model.
+ </p>
+ </div>
+
{!agent && (
<div className="space-y-1.5">
<Label htmlFor="agent-runtime">Runtime</Label>
diff --git a/src/web/src/components/home/hero-section.tsx b/src/web/src/components/home/hero-section.tsx
index 3ff166b01..8674eeeb9 100644
--- a/src/web/src/components/home/hero-section.tsx
+++ b/src/web/src/components/home/hero-section.tsx
@@ -170,7 +170,7 @@ export function HeroSection({ isLoggedIn }: { isLoggedIn: boolean }) {
</svg>
OPEN SOURCE
</a>
- {isLoggedIn && (
+ {isLoggedIn ? (
<a
href="/workspaces?auto"
className="inline-flex items-center gap-2 px-6 py-2.5 text-sm transition-all duration-200 hover:opacity-80"
@@ -188,6 +188,24 @@ export function HeroSection({ isLoggedIn }: { isLoggedIn: boolean }) {
</svg>
DASHBOARD
</a>
+ ) : (
+ <a
+ href="/sign-in"
+ className="inline-flex items-center gap-2 px-6 py-2.5 text-sm transition-all duration-200 hover:opacity-80"
+ style={{
+ fontFamily: "var(--font-mono)",
+ color: "var(--landing-text)",
+ border: "1px solid var(--landing-text)",
+ letterSpacing: "0.05em",
+ }}
+ >
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
+ <path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4" />
+ <polyline points="10 17 15 12 10 7" />
+ <line x1="15" y1="12" x2="3" y2="12" />
+ </svg>
+ GET STARTED
+ </a>
)}
</div>
</div>
diff --git a/src/web/src/env.d.ts b/src/web/src/env.d.ts
index be824b7fd..9208f2c21 100644
--- a/src/web/src/env.d.ts
+++ b/src/web/src/env.d.ts
@@ -16,6 +16,7 @@ declare namespace Cloudflare {
RATE_LIMIT_KV: KVNamespace
AUTH_OTP_RATE_LIMIT_MAX?: string
AUTH_OTP_RATE_LIMIT_WINDOW_SEC?: string
+ RUNTIME_MODEL_OPTIONS?: string
}
}
diff --git a/src/web/src/lib/api.ts b/src/web/src/lib/api.ts
index 02d732ccc..fca281eb0 100644
--- a/src/web/src/lib/api.ts
+++ b/src/web/src/lib/api.ts
@@ -97,6 +97,10 @@ function wsQuery(workspaceId: string, extra?: Record<string, string>): string {
return `?${params.toString()}`;
}
+// Config
+export const fetchModelOptions = () =>
+ apiFetch<Record<string, string[]>>("/api/config/model-options");
+
// Agents
export const listAgents = (workspaceId: string) =>
apiFetch<Agent[]>(`/api/agents${wsQuery(workspaceId)}`);
diff --git a/src/web/src/test/e2e/agent-crud.test.ts b/src/web/src/test/e2e/agent-crud.test.ts
index dd6ecda42..6f21f72cc 100644
--- a/src/web/src/test/e2e/agent-crud.test.ts
+++ b/src/web/src/test/e2e/agent-crud.test.ts
@@ -77,6 +77,27 @@ describe("agent CRUD", () => {
expect(data.description).toBe("Updated")
})
+ it("PATCH /api/agents/:id persists runtime_config.model", async () => {
+ const patchRes = await tokenRequest(
+ `/api/agents/${createdAgentId}?workspace_id=${seed.workspaceId}`,
+ seed.machineToken,
+ {
+ method: "PATCH",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ runtime_config: { model: "test-model" } }),
+ },
+ )
+ expect(patchRes.status).toBe(200)
+
+ const getRes = await tokenRequest(
+ `/api/agents/${createdAgentId}?workspace_id=${seed.workspaceId}`,
+ seed.machineToken,
+ )
+ expect(getRes.status).toBe(200)
+ const data = await getRes.json() as Record<string, unknown>
+ expect((data.runtime_config as Record<string, unknown>)?.model).toBe("test-model")
+ })
+
it("DELETE /api/agents/:id deletes agent", async () => {
const res = await tokenRequest(
`/api/agents/${createdAgentId}?workspace_id=${seed.workspaceId}`,
diff --git a/src/web/wrangler.toml b/src/web/wrangler.toml
index 159363089..896ebd077 100644
--- a/src/web/wrangler.toml
+++ b/src/web/wrangler.toml
@@ -65,3 +65,5 @@ service = "alook-email-worker"
binding = "RATE_LIMIT_KV"
id = "a3d035bea7bc49d99377b82ec21ce4c1"
+[vars]
+RUNTIME_MODEL_OPTIONS = '{"claude":["claude-opus-4-6","claude-sonnet-4-6","claude-haiku-4-5"],"codex":["gpt-5.4","gpt-5.3-codex"]}'