An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.
TypeScript agentic-browseragentic-browsingagy-cliaiai-agentai-browser-extensionai-toolsbrave-extensionbrowser-agentbrowser-automationbrowser-extensionbrowser-usebrowserskillchrome-extensionclaude-codecodexfirefox-addonmcp-servernanobrowserweb-automation
feat(agent): pick each harness's model from the picker
Shahriar5779cea18a80
diff --git a/README.md b/README.mdindex f21d4b8..4067cf2 100644--- a/README.md+++ b/README.md@@ -7,7 +7,7 @@ Hand your real, logged-in browser to the AI agent you already run. Browsentic is## Key Capabilities- **Your Real Browser, Not a Headless One**: Drives the tab in front of you, in your own profile, with your own logins and sessions-- **Bring Your Own Agent**: Runs on the agent CLI you already pay for and are already signed in to — switch between Claude Code, Codex and Antigravity with one click+- **Bring Your Own Agent**: Runs on the agent CLI you already pay for and are already signed in to — switch between Claude Code, Codex and Antigravity with one click, and pick the model each one runs- **47 Page Capabilities**: Reading, clicking, typing, dragging, on-site search, form submission, navigation, screenshots, file upload and download, captchas, theming and accessibility, console and network diagnostics, background progress monitoring, scheduled and repeating jobs, and pointing at an element- **Voice, Text, or Demonstration**: Dictate in the side panel, type anywhere, or record yourself doing a job once and later say "do it like last time"- **Point at What You Mean (A-Eye)**: Press the lens, hover the page, click the thing — the element and its content ride along with your next message, and the agent can hand the lens back when *it* needs you to pickdiff --git a/docs/guide/agents.md b/docs/guide/agents.mdindex 0be1876..d2024b9 100644--- a/docs/guide/agents.md+++ b/docs/guide/agents.md@@ -14,6 +14,11 @@ In the extension popup, or behind the side panel's status pill. Each is listed w*ready*, *not installed*, *needs setup* — so a missing CLI is visible before you send an instructionrather than after.+Each installed agent also carries a model select. *Default* runs whatever that CLI would run on its+own; picking a model is remembered per agent and applies from the next instruction. Unlike switching+agents, changing the model keeps the conversation being held open — every CLI resumes a session+under a new model.+The same thing from a terminal:```sh@@ -78,7 +83,7 @@ In `~/.browsentic/config.json`:| --- | --- | --- || `agent` | `claude` | Which CLI the side panel runs on. The agent picker writes this. || `agents.<name>.bin` | the CLI's own command name | Absolute path to the binary. Set this when the daemon's `PATH` differs from your shell's — the usual cause of `AGENT_MISSING`. |-| `agents.<name>.model` | `claude-sonnet-5` for Claude, otherwise the CLI's own default | Passed as `--model`. |+| `agents.<name>.model` | `claude-sonnet-5` for Claude, otherwise the CLI's own default | Passed as `--model`. The picker's model select writes this. || `agents.<name>.effort` | unset | Passed as that CLI's reasoning-effort flag. A value the CLI does not accept is dropped rather than failing the run. |Changes apply to the next run — the config is re-read each time, no daemon restart needed.diff --git a/docs/guide/configuration.md b/docs/guide/configuration.mdindex fd4e56f..cb984bf 100644--- a/docs/guide/configuration.md+++ b/docs/guide/configuration.md@@ -51,7 +51,7 @@ Nothing here is required; this shows every key in one place.| --- | --- | --- || `agent` | `claude` | Which CLI the side panel runs on: `claude`, `codex` or `antigravity` || `agents.<name>.bin` | the CLI's own command name | Absolute path to the binary |-| `agents.<name>.model` | `claude-sonnet-5` for Claude, else the CLI's default | Passed as `--model` |+| `agents.<name>.model` | `claude-sonnet-5` for Claude, else the CLI's default | Passed as `--model`; the agent picker's model select writes it || `agents.<name>.effort` | unset | That CLI's reasoning-effort flag; an unaccepted value is dropped |Full detail, including the Antigravity permission rule: [Choosing an agent](agents.md).diff --git a/src/daemon/agent/config.ts b/src/daemon/agent/config.tsindex ef2c925..939e528 100644--- a/src/daemon/agent/config.ts+++ b/src/daemon/agent/config.ts@@ -147,6 +147,27 @@ export function writeActiveAgent(kind: AgentKind): void {write({ ...stored, agent: kind });}+/**+ * Sets or clears one agent's model, leaving every other key in config.json untouched. Claude's+ * pre-0.2 top-level `model` spelling is removed alongside, so a cleared pick cannot resurface it.+ */+export function writeAgentModel(kind: AgentKind, model: string | null): void {+ const stored = readStored();+ const agents = { ...(stored.agents ?? {}) };+ const scoped = { ...(agents[kind] ?? {}) };+ const value = text(model);+ if (value) scoped.model = value;+ else delete scoped.model;+ if (Object.keys(scoped).length) agents[kind] = scoped;+ else delete agents[kind];++ const next = { ...stored };+ if (Object.keys(agents).length) next.agents = agents;+ else delete next.agents;+ if (kind === 'claude') delete next.model;+ write(next);+}+/*** Write one guardrail override, leaving every other key in config.json alone. `null`* removes the override rather than writing a value equal to the default — so a configdiff --git a/src/daemon/agent/runners/index.ts b/src/daemon/agent/runners/index.tsindex 1db958f..45a0f94 100644--- a/src/daemon/agent/runners/index.ts+++ b/src/daemon/agent/runners/index.ts@@ -82,6 +82,7 @@ async function probe(runner: Runner, settings: AgentSettings): Promise<RunnerStareturn {kind: runner.kind,bin: settings.bin,+ model: settings.model,ready: false,problem: {code: 'AGENT_MISSING',@@ -94,6 +95,7 @@ async function probe(runner: Runner, settings: AgentSettings): Promise<RunnerStareturn {kind: runner.kind,bin: settings.bin,+ model: settings.model,ready: false,problem: {code: 'AGENT_UNUSABLE',@@ -104,7 +106,14 @@ async function probe(runner: Runner, settings: AgentSettings): Promise<RunnerSta}const problem = (await runner.check?.(settings)) ?? null;- return { kind: runner.kind, bin: settings.bin, ready: !problem, version: found.detail, problem: problem ?? undefined };+ return {+ kind: runner.kind,+ bin: settings.bin,+ model: settings.model,+ ready: !problem,+ version: found.detail,+ problem: problem ?? undefined,+ };}function version(bin: string, args: string[]): Promise<{ ok: boolean; code?: string; detail?: string }> {diff --git a/src/daemon/daemon.ts b/src/daemon/daemon.tsindex eb9dc5a..aaed46a 100644--- a/src/daemon/daemon.ts+++ b/src/daemon/daemon.ts@@ -46,7 +46,7 @@ import { AgentSession } from './agent/service';import { summarizeFile } from './agent/analyze';import { analyzeRecording } from './agent/recording';import { nameSession } from './agent/title';-import { configPath, readAgentConfig, writeActiveAgent, writeGuardrailSetting } from './agent/config';+import { configPath, readAgentConfig, writeActiveAgent, writeAgentModel, writeGuardrailSetting } from './agent/config';import { agentSkills } from './agent/agent-skills';import { agentState, grantRunner } from './agent/runners';import { deleteSiteMap, deleteSkill, saveSkill } from './agent/skill-store';@@ -68,7 +68,7 @@ import {import { log } from './log';import { readLockfile, writeLockfile, clearLockfile, type Lockfile } from './lockfile';-type AgentFrame = Extract<SocketFrame, { t: 'agentState' | 'setAgent' | 'grantAgent' }>;+type AgentFrame = Extract<SocketFrame, { t: 'agentState' | 'setAgent' | 'setAgentModel' | 'grantAgent' }>;type GuardrailFrame = Extract<SocketFrame, { t: 'guardrails' | 'setGuardrail' }>;const IDLE_EXIT_MS = 30 * 60 * 1000;@@ -346,7 +346,12 @@ export async function startDaemon({ version, idleExit = true }: DaemonOptions):);return;}- if (request.t === 'agentState' || request.t === 'setAgent' || request.t === 'grantAgent') {+ if (+ request.t === 'agentState' ||+ request.t === 'setAgent' ||+ request.t === 'setAgentModel' ||+ request.t === 'grantAgent'+ ) {void settleAgent(request).then((state) => {source.send({ t: 'agentInfo', id: request.id, result: state });// The catalog's agent-skill half belongs to the agent that just took over.@@ -408,6 +413,12 @@ export async function startDaemon({ version, idleExit = true }: DaemonOptions):agent?.handle({ t: 'reset' });log(`agent set to ${AGENTS[request.agent].label}`);}+ if (request.t === 'setAgentModel') {+ // A model change keeps held conversations — every CLI resumes a session under a new model.+ const model = typeof request.model === 'string' ? request.model : null;+ writeAgentModel(request.agent, model);+ log(`${AGENTS[request.agent].label} model set to ${model?.trim() || 'the default'}`);+ }if (request.t === 'grantAgent') await grantRunner(request.agent);const refresh = request.t !== 'agentState' || request.refresh === true;return success(await agentState(readAgentConfig(), { refresh }));diff --git a/src/extension/components/agent-picker.tsx b/src/extension/components/agent-picker.tsxindex e8a0c00..7deb1e5 100644--- a/src/extension/components/agent-picker.tsx+++ b/src/extension/components/agent-picker.tsx@@ -12,8 +12,12 @@ import { cn } from '@/lib/utils';type Request =| { op: 'agentState'; refresh?: boolean }| { op: 'setAgent'; agent: AgentKind }+ | { op: 'setAgentModel'; agent: AgentKind; model: string | null }| { op: 'grantAgent'; agent: AgentKind };+const busyKey = (request: Request): string =>+ request.op === 'agentState' ? 'refresh' : request.op === 'setAgentModel' ? `${request.agent}:model` : request.agent;+export function AgentPicker() {const daemon = useDaemonState();const state = daemon?.agent;@@ -27,7 +31,7 @@ export function AgentPicker() {}, [connected, state]);async function ask(request: Request): Promise<void> {- setBusy(request.op === 'agentState' ? 'refresh' : request.agent);+ setBusy(busyKey(request));setError(null);const result = (await browser.runtime.sendMessage({ channel: BRIDGE_CHANNEL, ...request })@@ -65,8 +69,10 @@ export function AgentPicker() {runner={runner}active={runner.kind === active}busy={busy === runner.kind}+ modelBusy={busy === `${runner.kind}:model`}disabled={!connected || busy !== null}onSelect={() => void ask({ op: 'setAgent', agent: runner.kind })}+ onModel={(model) => void ask({ op: 'setAgentModel', agent: runner.kind, model })}/>))}</div>@@ -103,35 +109,71 @@ function AgentRow({runner,active,busy,+ modelBusy,disabled,onSelect,+ onModel,}: {runner: RunnerStatus;active: boolean;busy: boolean;+ modelBusy: boolean;disabled: boolean;onSelect: () => void;+ onModel: (model: string | null) => void;}) {const agent = AGENTS[runner.kind];+ const models =+ runner.model && !agent.models.includes(runner.model) ? [runner.model, ...agent.models] : agent.models;return (- <button- type="button"- onClick={onSelect}- disabled={disabled || active}- aria-pressed={active}+ <divclassName={cn(- 'flex items-center gap-2 rounded-lg border px-2.5 py-2 text-left transition-colors',- active- ? 'border-brand/45 bg-brand/10 text-brand'- : 'border-line text-ink-dim enabled:hover:border-line-strong enabled:hover:bg-surface/60 enabled:hover:text-ink',+ 'rounded-lg border transition-colors',+ active ? 'border-brand/45 bg-brand/10' : 'border-line',+ !active && !disabled && 'hover:border-line-strong hover:bg-surface/60',disabled && !active && 'opacity-50',)}>- <StatusDot tone={runner.ready ? 'live' : 'warn'} />- <span className="min-w-0 flex-1 truncate text-xs">{agent.label}</span>- <span className="font-mono text-[10px] tracking-wider uppercase opacity-70">{describe(runner)}</span>- {busy ? <Loader2 className="size-3 animate-spin" /> : active && <Check className="size-3" />}- </button>+ <button+ type="button"+ onClick={onSelect}+ disabled={disabled || active}+ aria-pressed={active}+ className={cn(+ 'flex w-full items-center gap-2 px-2.5 py-2 text-left transition-colors',+ active ? 'text-brand' : 'text-ink-dim enabled:hover:text-ink',+ )}+ >+ <StatusDot tone={runner.ready ? 'live' : 'warn'} />+ <span className="min-w-0 flex-1 truncate text-xs">{agent.label}</span>+ <span className="font-mono text-[10px] tracking-wider uppercase opacity-70">{describe(runner)}</span>+ {busy ? <Loader2 className="size-3 animate-spin" /> : active && <Check className="size-3" />}+ </button>+ {runner.ready && models.length > 0 && (+ <label+ className={cn(+ 'flex items-center gap-2 border-t px-2.5 py-1.5',+ active ? 'border-brand/25' : 'border-line',+ )}+ >+ <span className="font-mono text-[10px] tracking-[0.14em] text-ink-faint uppercase">Model</span>+ <select+ value={runner.model ?? ''}+ onChange={(event) => onModel(event.target.value || null)}+ disabled={disabled}+ className="min-w-0 flex-1 cursor-pointer truncate bg-transparent text-right font-mono text-[10px] text-ink-dim outline-none disabled:cursor-default"+ >+ <option value="">Default</option>+ {models.map((model) => (+ <option key={model} value={model}>+ {model}+ </option>+ ))}+ </select>+ {modelBusy && <Loader2 className="size-3 animate-spin text-ink-faint" />}+ </label>+ )}+ </div>);}diff --git a/src/extension/entrypoints/background.ts b/src/extension/entrypoints/background.tsindex ac9a67a..a28be55 100644--- a/src/extension/entrypoints/background.ts+++ b/src/extension/entrypoints/background.ts@@ -18,6 +18,7 @@ import { isAgentKind } from '@/lib/agents/catalog';import {RECONNECT_ALARM,chooseAgent,+ chooseAgentModel,connectDaemon,disconnectDaemon,onWelcome,@@ -111,6 +112,12 @@ export default defineBackground(() => {.catch((error) => sendResponse(failure('BRIDGE_ERROR', String(error))));return true;}+ if (message.op === 'setAgentModel' && isAgentKind(message.agent)) {+ chooseAgentModel(message.agent, typeof message.model === 'string' && message.model.trim() ? message.model : null)+ .then(sendResponse)+ .catch((error) => sendResponse(failure('BRIDGE_ERROR', String(error))));+ return true;+ }if (message.op === 'grantAgent' && isAgentKind(message.agent)) {setUpAgent(message.agent).then(sendResponse)@@ -151,7 +158,7 @@ export default defineBackground(() => {sendResponse(failure('INVALID_REQUEST',- 'Expected {op:"describe"|"invoke"|"analyzeFile"|"saveSkill"|"removeSkill"|"nameSession"|"recordEvents"|"recordingState"|"analyzeRecording"|"monitorSample"|"monitorState"|"listSkills"|"agentState"|"setAgent"|"grantAgent"|"guardrails"|"setGuardrail"|"pair"|"panelOpened"|"disconnect"}',+ 'Expected {op:"describe"|"invoke"|"analyzeFile"|"saveSkill"|"removeSkill"|"nameSession"|"recordEvents"|"recordingState"|"analyzeRecording"|"monitorSample"|"monitorState"|"listSkills"|"agentState"|"setAgent"|"setAgentModel"|"grantAgent"|"guardrails"|"setGuardrail"|"pair"|"panelOpened"|"disconnect"}',),);return;diff --git a/src/lib/actions/protocol.ts b/src/lib/actions/protocol.tsindex 7e62676..440d722 100644--- a/src/lib/actions/protocol.ts+++ b/src/lib/actions/protocol.ts@@ -10,7 +10,7 @@ import type { SiteMapDraft } from '@/lib/skills/site-map';export const ACTION_CHANNEL = 'browsentic/action';export const BRIDGE_CHANNEL = 'browsentic/bridge';-export const SOCKET_PROTOCOL_VERSION = 14;+export const SOCKET_PROTOCOL_VERSION = 15;export const EXTERNAL_RUN_ID = 'external';@@ -40,6 +40,7 @@ export type BridgeRequest =| { channel: typeof BRIDGE_CHANNEL; op: 'listSkills'; refresh?: boolean }| { channel: typeof BRIDGE_CHANNEL; op: 'agentState'; refresh?: boolean }| { channel: typeof BRIDGE_CHANNEL; op: 'setAgent'; agent: AgentKind }+ | { channel: typeof BRIDGE_CHANNEL; op: 'setAgentModel'; agent: AgentKind; model: string | null }| { channel: typeof BRIDGE_CHANNEL; op: 'grantAgent'; agent: AgentKind }| { channel: typeof BRIDGE_CHANNEL; op: 'guardrails' }| { channel: typeof BRIDGE_CHANNEL; op: 'setGuardrail'; setting: string; value: GuardrailValue };@@ -189,6 +190,7 @@ export type SocketFrame =| { t: 'recordingWorkflow'; id: string; result: ActionResult<RecordingAnalysis> }| { t: 'agentState'; id: string; refresh?: boolean }| { t: 'setAgent'; id: string; agent: AgentKind }+ | { t: 'setAgentModel'; id: string; agent: AgentKind; model: string | null }| { t: 'grantAgent'; id: string; agent: AgentKind }| { t: 'agentInfo'; id: string; result: ActionResult<AgentState> }| { t: 'listSkills'; id: string; refresh?: boolean }@@ -223,6 +225,7 @@ export const EXTENSION_REQUEST_FRAMES = ['analyzeRecording','agentState','setAgent',+ 'setAgentModel','grantAgent','listSkills','guardrails',diff --git a/src/lib/agents/catalog.ts b/src/lib/agents/catalog.tsindex ab4607d..e61d79a 100644--- a/src/lib/agents/catalog.ts+++ b/src/lib/agents/catalog.ts@@ -11,6 +11,8 @@ export interface AgentDescriptor {bin: string;install: string;docs: string;+ /** Model ids the picker offers, strongest first. Curated, not queried — the CLIs have no list command. */+ models: string[];}export const AGENTS: Record<AgentKind, AgentDescriptor> = {@@ -21,6 +23,7 @@ export const AGENTS: Record<AgentKind, AgentDescriptor> = {bin: 'claude',install: 'npm i -g @anthropic-ai/claude-code',docs: 'https://claude.com/claude-code',+ models: ['claude-fable-5', 'claude-opus-5', 'claude-sonnet-5', 'claude-haiku-4-5'],},codex: {kind: 'codex',@@ -29,6 +32,7 @@ export const AGENTS: Record<AgentKind, AgentDescriptor> = {bin: 'codex',install: 'npm i -g @openai/codex',docs: 'https://developers.openai.com/codex/cli',+ models: ['gpt-5.6-terra', 'gpt-5.1-codex-max', 'gpt-5.1-codex', 'gpt-5.1-codex-mini'],},antigravity: {kind: 'antigravity',@@ -37,6 +41,7 @@ export const AGENTS: Record<AgentKind, AgentDescriptor> = {bin: 'agy',install: 'https://antigravity.google/docs/cli/install',docs: 'https://antigravity.google/docs/cli',+ models: ['gemini-3-pro', 'gemini-3-flash'],},};@@ -60,6 +65,8 @@ export interface RunnerStatus {bin: string;ready: boolean;version?: string;+ /** The model this runner will be spawned with; unset means the CLI's own default. */+ model?: string;problem?: AgentProblem;}diff --git a/src/lib/bridge/socket.ts b/src/lib/bridge/socket.tsindex 4dca179..4f86e83 100644--- a/src/lib/bridge/socket.ts+++ b/src/lib/bridge/socket.ts@@ -227,12 +227,16 @@ export function chooseAgent(agent: AgentKind): Promise<ActionResult<AgentState>>return agentOp({ t: 'setAgent', id: crypto.randomUUID(), agent });}+export function chooseAgentModel(agent: AgentKind, model: string | null): Promise<ActionResult<AgentState>> {+ return agentOp({ t: 'setAgentModel', id: crypto.randomUUID(), agent, model });+}+export function setUpAgent(agent: AgentKind): Promise<ActionResult<AgentState>> {return agentOp({ t: 'grantAgent', id: crypto.randomUUID(), agent });}function agentOp(- frame: Extract<SocketFrame, { t: 'agentState' | 'setAgent' | 'grantAgent' }>,+ frame: Extract<SocketFrame, { t: 'agentState' | 'setAgent' | 'setAgentModel' | 'grantAgent' }>,): Promise<ActionResult<AgentState>> {if (!post(frame)) {return Promise.resolve(failure('EXTENSION_OFFLINE', 'No Browsentic daemon is attached — pair the browser first.'));