Skip to content

An open-source, faster Devin alternative

TypeScript

Per-session model override (web + SDK)

Igor Zalutski1bc97e4afa4f
diff --git a/docs/agent-sessions/sessions.mdx b/docs/agent-sessions/sessions.mdx
index 587e1337..002a9427 100644
--- a/docs/agent-sessions/sessions.mdx
+++ b/docs/agent-sessions/sessions.mdx
@@ -10,7 +10,7 @@ A **session** is an [agent](/agent-sessions/agents) run with an append-only [eve
## Session flow
-1. You create a session from an [agent](/agent-sessions/agents). It **pins the agent's active [revision](/agent-sessions/revisions)** (prompt / model / skills) for its whole life — editing the agent later never affects a running session. Pass `revision` to pin a specific one instead (e.g. to test a [staged](/agent-sessions/revisions#staging-vs-activating) revision before promoting). The model runs **Managed** (billed to your credits, no key — the default) or on a [model credential](/agent-sessions/credentials) you supply. Pass [`sources`](/agent-sessions/repos) to check repos out into `/workspace/sources/` before turn 1 — the GitHub token never enters the sandbox. The session starts immediately.
+1. You create a session from an [agent](/agent-sessions/agents). It **pins the agent's active [revision](/agent-sessions/revisions)** (prompt / model / skills) for its whole life — editing the agent later never affects a running session. Pass `revision` to pin a specific one instead (e.g. to test a [staged](/agent-sessions/revisions#staging-vs-activating) revision before promoting). Pass `model` to run this one session on a different model than the agent's — same `provider/model` form, and it must resolve to the agent's runtime's provider ([flue](/agent-sessions/flue) agents don't take an override; their model is fixed in the artifact). The model runs **Managed** (billed to your credits, no key — the default) or on a [model credential](/agent-sessions/credentials) you supply. Pass [`sources`](/agent-sessions/repos) to check repos out into `/workspace/sources/` before turn 1 — the GitHub token never enters the sandbox. The session starts immediately.
2. The [runtime](/agent-sessions/runtimes) executes the agent in a sandbox, appending [events](/agent-sessions/events) to the log as it works.
3. With nothing left to do, the session goes **idle** and the sandbox **hibernates**.
4. A [steer](/agent-sessions/messaging) message wakes it; it resumes with its prior context. Repeat.
diff --git a/sdks/typescript/package-lock.json b/sdks/typescript/package-lock.json
index df80ae95..fc041002 100644
--- a/sdks/typescript/package-lock.json
+++ b/sdks/typescript/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@opencomputer/sdk",
- "version": "0.11.2",
+ "version": "0.12.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@opencomputer/sdk",
- "version": "0.11.2",
+ "version": "0.12.0",
"license": "MIT",
"devDependencies": {
"@types/node": "^25.3.0",
diff --git a/sdks/typescript/package.json b/sdks/typescript/package.json
index ebf58bab..1a6294e5 100644
--- a/sdks/typescript/package.json
+++ b/sdks/typescript/package.json
@@ -1,6 +1,6 @@
{
"name": "@opencomputer/sdk",
- "version": "0.11.2",
+ "version": "0.12.0",
"description": "TypeScript SDK for OpenComputer - cloud sandbox platform",
"type": "module",
"main": "dist/index.js",
diff --git a/sdks/typescript/src/agents/sessions.ts b/sdks/typescript/src/agents/sessions.ts
index 989b8a5b..68d1c713 100644
--- a/sdks/typescript/src/agents/sessions.ts
+++ b/sdks/typescript/src/agents/sessions.ts
@@ -14,6 +14,13 @@ export interface CreateSessionParams {
* test a staged revision before promoting it. Defaults to the active revision.
*/
revision?: number | string;
+ /**
+ * Override the agent's model for this session — the session runs this model instead of the
+ * one pinned by the agent's revision. Same `provider/model` form as the agent's model, and
+ * must resolve to the agent's runtime's provider. Defaults to the agent's model. Not
+ * supported for `flue` agents (their model is fixed in the deployed artifact).
+ */
+ model?: string;
/** get-or-create idempotency/routing key — one session per key. */
key?: string;
webhook?: string;
diff --git a/web/src/api/client.ts b/web/src/api/client.ts
index c298e172..14b626af 100644
--- a/web/src/api/client.ts
+++ b/web/src/api/client.ts
@@ -703,6 +703,9 @@ export const createSession = (
body: {
agent: string
input: string
+ // Optional per-session model override — runs this model instead of the agent's.
+ // Omit to inherit the agent's model. Not supported for flue agents.
+ model?: string
sources?: { repo: string; ref: string; name?: string }[]
},
idempotencyKey?: string,
diff --git a/web/src/pages/Sessions.tsx b/web/src/pages/Sessions.tsx
index 6b08e506..c414adb3 100644
--- a/web/src/pages/Sessions.tsx
+++ b/web/src/pages/Sessions.tsx
@@ -18,6 +18,7 @@ import {
DialogTitle,
} from '@/components/ui/dialog'
import { Field, Label, Select } from '@/components/form'
+import { Input } from '@/components/ui/input'
import {
WorkingRepoField,
type WorkingRepo,
@@ -45,12 +46,20 @@ export default function Sessions() {
const [showStart, setShowStart] = useState(false)
const [agentId, setAgentId] = useState('')
const [message, setMessage] = useState('')
+ // Optional per-session model override — empty inherits the agent's model
+ // (cleared when the agent changes, since a model is runtime-specific).
+ const [model, setModel] = useState('')
// Optional working repo — explicitly chosen, per-agent (cleared when the agent changes).
const [workingRepo, setWorkingRepo] = useState<WorkingRepo | null>(null)
+ const selectedAgent = agents?.find((a) => a.id === agentId)
+ // flue agents pin their model in the deployed artifact — no per-session override.
+ const isFlueAgent = selectedAgent?.runtime === 'flue'
+
const openStart = () => {
setAgentId(agents?.[0]?.id ?? '')
setMessage('')
+ setModel('')
setWorkingRepo(null)
setShowStart(true)
}
@@ -61,6 +70,8 @@ export default function Sessions() {
{
agent: agentId,
input: message.trim(),
+ // Only send a model when overridden — omitting it inherits the agent's.
+ ...(model.trim() && !isFlueAgent ? { model: model.trim() } : {}),
...(workingRepo
? { sources: [{ repo: workingRepo.repo, ref: workingRepo.ref }] }
: {}),
@@ -217,6 +228,7 @@ export default function Sessions() {
value={agentId}
onValueChange={(v) => {
setAgentId(v)
+ setModel('') // a model override is per-agent (runtime-specific)
setWorkingRepo(null) // a working repo is per-agent
}}
options={(agents ?? []).map((a) => ({
@@ -243,6 +255,26 @@ export default function Sessions() {
className="min-h-24"
/>
</Field>
+ {agentId && !isFlueAgent ? (
+ <Field
+ label="Model"
+ htmlFor="start-model"
+ description={
+ selectedAgent?.model
+ ? `Optional — overrides just this session. Defaults to the agent's model (${selectedAgent.model}).`
+ : "Optional — overrides just this session. Defaults to the agent's model."
+ }
+ >
+ <Input
+ id="start-model"
+ value={model}
+ onChange={(e) => setModel(e.target.value)}
+ placeholder={selectedAgent?.model ?? 'provider/model'}
+ autoComplete="off"
+ spellCheck={false}
+ />
+ </Field>
+ ) : null}
{agentId ? (
<WorkingRepoField
value={workingRepo}