Commit 2be87b0
feat: runtime overrides — model, temperature, baseUrl on ComputerAgent
Three first-class fields callers can pass to override what the GAP repo
specifies, without forking the agent definition:
new ComputerAgent({
source: "...", harness: "...", runtime: ...,
model: "claude-haiku-4-5-20251001", // overrides agent.yaml model.preferred
temperature: 0.2, // overrides constraints.temperature
baseUrl: "https://my-proxy.example.com", // routes LLM calls through a proxy
});
## Cost source — no price table
Same principle as #5: we don't compute or hardcode anything. `baseUrl`
becomes the `ANTHROPIC_BASE_URL` env var, which the Anthropic SDK reads
natively. `model` flows through the existing `mergeEngineOptions` chain.
`temperature` is an engine-dependent passthrough — gitagent honors it
(folds into gitclaw's `constraints` object), claude-agent-sdk warns once
per process (Claude SDK v0.2.x doesn't expose temperature on its public
Options type yet — fix lands when upstream adds it).
## What changed (additive — no breaking changes)
packages/sdk/src/types.ts:
+ ComputerAgentOptions.model?: string
+ ComputerAgentOptions.temperature?: number
+ ComputerAgentOptions.baseUrl?: string
packages/sdk/src/computer-agent.ts:
Constructor computes `effectiveEnvs` (baseUrl injected as
ANTHROPIC_BASE_URL when caller hasn't set that key explicitly) and
`effectiveOptions` (model + temperature merged in). Both are memoized
and used by both substrate boot and createSession so they stay
consistent across multiple chats. Bad baseUrl throws at construction
via `new URL(...)` parse — fail fast.
packages/identity-gitagentprotocol/src/manifest.ts:
+ Typed `model.constraints.temperature` (was passthrough-only).
packages/identity-gitagentprotocol/src/adapters/{claude-agent-sdk,gitagent}.ts:
Map manifest.model.constraints.temperature → flat opts.temperature.
Caller-supplied overrides still win via mergeEngineOptions on the
harness side.
packages/engine-gitagent/src/engine.ts:
Fold flat ctx.options.temperature into gitclaw's nested
`constraints.temperature` (gitclaw's actual interface). Strip the
flat field before spread so it doesn't leak as an unknown top-level
option.
packages/engine-claude-agent-sdk/src/engine.ts:
Strip flat temperature before spread (SDK doesn't accept it). Warn
once per process via console.warn when temperature is set —
explicitly tells the user to switch to gitagent if it matters,
doesn't silently swallow.
## Tests added
10 new (314 → 324 total, all green):
- sdk: 6 — model fold, model vs options precedence, temperature
fold, baseUrl injection, baseUrl doesn't clobber explicit
ANTHROPIC_BASE_URL, invalid baseUrl throws at construction
- identity-gitagentprotocol/adapters: 4 — temperature mapped from
constraints on both adapters, absent when not declared
- engine-gitagent: 1 — flat temperature folds into constraints,
pre-existing constraints field preserved, flat field stripped
from the QueryOptions root
## Live-validated
bun run examples/hello.ts # baseline still works
bun run examples/_override-smoke.ts (now removed) # all 3 overrides applied
→ Response: "Hello there friend." (model=haiku honored)
→ 428 tokens • $0.0115
bad-url test (now removed):
→ ComputerAgent: invalid baseUrl "not a real url" — must be a
valid URL (e.g. "https://api.anthropic.com").
## Wire schema unchanged
`CreateSessionBody.options` is already `Record<string, unknown>` —
opaque passthrough. No zod schema change needed. Engine and adapter
type augments are purely TS-side.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 07bca6a commit 2be87b0
15 files changed
Lines changed: 594 additions & 24 deletions
File tree
- examples
- packages
- engine-claude-agent-sdk/src
- engine-gitagent/src
- identity-gitagentprotocol/src
- adapters
- runtime-e2b/assets
- runtime-local/assets
- runtime-vzvm/assets
- sdk/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
77 | 85 | | |
78 | | - | |
| 86 | + | |
79 | 87 | | |
80 | 88 | | |
81 | 89 | | |
| |||
175 | 183 | | |
176 | 184 | | |
177 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
33 | 82 | | |
34 | 83 | | |
35 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
117 | 129 | | |
118 | 130 | | |
119 | 131 | | |
120 | 132 | | |
121 | 133 | | |
122 | 134 | | |
123 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
124 | 139 | | |
125 | 140 | | |
126 | 141 | | |
| |||
220 | 235 | | |
221 | 236 | | |
222 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
223 | 251 | | |
224 | 252 | | |
225 | 253 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
19 | 37 | | |
20 | 38 | | |
21 | 39 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
31 | 51 | | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
21 | 33 | | |
22 | 34 | | |
23 | 35 | | |
| |||
0 commit comments