Skip to content

Commit 36d2bd7

Browse files
feat: x-stainless-any fix, optional frame id, ModelConfigString fix
1 parent 5e8aea0 commit 36d2bd7

4 files changed

Lines changed: 16 additions & 65 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-991d1530002115ecec027f98cad357d39ca1ece6784f62d48e6740b8830e1104.yml
3-
openapi_spec_hash: 303329893ced56b2c129fb9fd666144e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-07032b695bc66ecd76328d936b41e01cfad508a870928c09c185f5faa5ea66ab.yml
3+
openapi_spec_hash: fca4b895ce36ad547fb015c3dd38821f
44
config_hash: d4df55e4b30aac2d8d0982be97f837c4

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ stagehand sessions act \
3535
--id 00000000-your-session-id-000000000000 \
3636
--input 'click the first link on the page' \
3737
--frame-id frameId \
38-
--options '{model: openai/gpt-5-nano, timeout: 30000, variables: {username: john_doe}}' \
38+
--options '{model: openai/gpt-4o, timeout: 30000, variables: {username: john_doe}}' \
3939
--stream-response false \
40-
--x-sent-at 2025-01-15T10:30:00Z \
4140
--x-stream-response true
4241
```
4342

pkg/cmd/session.go

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ var sessionsAct = requestflag.WithInnerFlags(cli.Command{
4545
Usage: "Whether to stream the response via SSE",
4646
BodyPath: "streamResponse",
4747
},
48-
&requestflag.Flag[any]{
49-
Name: "x-sent-at",
50-
Usage: "ISO timestamp when request was sent",
51-
HeaderPath: "x-sent-at",
52-
},
5348
&requestflag.Flag[string]{
5449
Name: "x-stream-response",
5550
Usage: "Whether to stream the response via SSE",
@@ -62,7 +57,7 @@ var sessionsAct = requestflag.WithInnerFlags(cli.Command{
6257
"options": {
6358
&requestflag.InnerFlag[any]{
6459
Name: "options.model",
65-
Usage: "Model name string with provider prefix (e.g., 'openai/gpt-5-nano', 'anthropic/claude-4.5-opus')",
60+
Usage: "Model name string with provider prefix. Always use the format 'provider/model-name' (e.g., 'openai/gpt-4o', 'anthropic/claude-sonnet-4-5-20250929', 'google/gemini-2.0-flash')",
6661
InnerField: "model",
6762
},
6863
&requestflag.InnerFlag[float64]{
@@ -92,11 +87,6 @@ var sessionsEnd = cli.Command{
9287
Name: "-force-body",
9388
BodyPath: "_forceBody",
9489
},
95-
&requestflag.Flag[any]{
96-
Name: "x-sent-at",
97-
Usage: "ISO timestamp when request was sent",
98-
HeaderPath: "x-sent-at",
99-
},
10090
&requestflag.Flag[string]{
10191
Name: "x-stream-response",
10292
Usage: "Whether to stream the response via SSE",
@@ -137,11 +127,6 @@ var sessionsExecute = requestflag.WithInnerFlags(cli.Command{
137127
Usage: "Whether to stream the response via SSE",
138128
BodyPath: "streamResponse",
139129
},
140-
&requestflag.Flag[any]{
141-
Name: "x-sent-at",
142-
Usage: "ISO timestamp when request was sent",
143-
HeaderPath: "x-sent-at",
144-
},
145130
&requestflag.Flag[string]{
146131
Name: "x-stream-response",
147132
Usage: "Whether to stream the response via SSE",
@@ -159,7 +144,7 @@ var sessionsExecute = requestflag.WithInnerFlags(cli.Command{
159144
},
160145
&requestflag.InnerFlag[any]{
161146
Name: "agent-config.model",
162-
Usage: "Model name string with provider prefix (e.g., 'openai/gpt-5-nano', 'anthropic/claude-4.5-opus')",
147+
Usage: "Model name string with provider prefix. Always use the format 'provider/model-name' (e.g., 'openai/gpt-4o', 'anthropic/claude-sonnet-4-5-20250929', 'google/gemini-2.0-flash')",
163148
InnerField: "model",
164149
},
165150
&requestflag.InnerFlag[string]{
@@ -226,11 +211,6 @@ var sessionsExtract = requestflag.WithInnerFlags(cli.Command{
226211
Usage: "Whether to stream the response via SSE",
227212
BodyPath: "streamResponse",
228213
},
229-
&requestflag.Flag[any]{
230-
Name: "x-sent-at",
231-
Usage: "ISO timestamp when request was sent",
232-
HeaderPath: "x-sent-at",
233-
},
234214
&requestflag.Flag[string]{
235215
Name: "x-stream-response",
236216
Usage: "Whether to stream the response via SSE",
@@ -243,7 +223,7 @@ var sessionsExtract = requestflag.WithInnerFlags(cli.Command{
243223
"options": {
244224
&requestflag.InnerFlag[any]{
245225
Name: "options.model",
246-
Usage: "Model name string with provider prefix (e.g., 'openai/gpt-5-nano', 'anthropic/claude-4.5-opus')",
226+
Usage: "Model name string with provider prefix. Always use the format 'provider/model-name' (e.g., 'openai/gpt-4o', 'anthropic/claude-sonnet-4-5-20250929', 'google/gemini-2.0-flash')",
247227
InnerField: "model",
248228
},
249229
&requestflag.InnerFlag[string]{
@@ -289,11 +269,6 @@ var sessionsNavigate = requestflag.WithInnerFlags(cli.Command{
289269
Usage: "Whether to stream the response via SSE",
290270
BodyPath: "streamResponse",
291271
},
292-
&requestflag.Flag[any]{
293-
Name: "x-sent-at",
294-
Usage: "ISO timestamp when request was sent",
295-
HeaderPath: "x-sent-at",
296-
},
297272
&requestflag.Flag[string]{
298273
Name: "x-stream-response",
299274
Usage: "Whether to stream the response via SSE",
@@ -351,11 +326,6 @@ var sessionsObserve = requestflag.WithInnerFlags(cli.Command{
351326
Usage: "Whether to stream the response via SSE",
352327
BodyPath: "streamResponse",
353328
},
354-
&requestflag.Flag[any]{
355-
Name: "x-sent-at",
356-
Usage: "ISO timestamp when request was sent",
357-
HeaderPath: "x-sent-at",
358-
},
359329
&requestflag.Flag[string]{
360330
Name: "x-stream-response",
361331
Usage: "Whether to stream the response via SSE",
@@ -368,7 +338,7 @@ var sessionsObserve = requestflag.WithInnerFlags(cli.Command{
368338
"options": {
369339
&requestflag.InnerFlag[any]{
370340
Name: "options.model",
371-
Usage: "Model name string with provider prefix (e.g., 'openai/gpt-5-nano', 'anthropic/claude-4.5-opus')",
341+
Usage: "Model name string with provider prefix. Always use the format 'provider/model-name' (e.g., 'openai/gpt-4o', 'anthropic/claude-sonnet-4-5-20250929', 'google/gemini-2.0-flash')",
372342
InnerField: "model",
373343
},
374344
&requestflag.InnerFlag[string]{
@@ -391,7 +361,7 @@ var sessionsStart = requestflag.WithInnerFlags(cli.Command{
391361
Flags: []cli.Flag{
392362
&requestflag.Flag[string]{
393363
Name: "model-name",
394-
Usage: "Model name to use for AI operations",
364+
Usage: "Model name to use for AI operations. Always use the format 'provider/model-name' (e.g., 'openai/gpt-4o', 'anthropic/claude-sonnet-4-5-20250929', 'google/gemini-2.0-flash')",
395365
Required: true,
396366
BodyPath: "modelName",
397367
},
@@ -442,11 +412,6 @@ var sessionsStart = requestflag.WithInnerFlags(cli.Command{
442412
Usage: "Wait for captcha solves (deprecated, v2 only)",
443413
BodyPath: "waitForCaptchaSolves",
444414
},
445-
&requestflag.Flag[any]{
446-
Name: "x-sent-at",
447-
Usage: "ISO timestamp when request was sent",
448-
HeaderPath: "x-sent-at",
449-
},
450415
&requestflag.Flag[string]{
451416
Name: "x-stream-response",
452417
Usage: "Whether to stream the response via SSE",

pkg/cmd/session_test.go

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ func TestSessionsAct(t *testing.T) {
1717
"--id", "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
1818
"--input", "Click the login button",
1919
"--frame-id", "frameId",
20-
"--options", "{model: openai/gpt-5-nano, timeout: 30000, variables: {username: john_doe}}",
20+
"--options", "{model: openai/gpt-4o, timeout: 30000, variables: {username: john_doe}}",
2121
"--stream-response=false",
22-
"--x-sent-at", "2025-01-15T10:30:00Z",
2322
"--x-stream-response", "true",
2423
)
2524

@@ -33,11 +32,10 @@ func TestSessionsAct(t *testing.T) {
3332
"--id", "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
3433
"--input", "Click the login button",
3534
"--frame-id", "frameId",
36-
"--options.model", "openai/gpt-5-nano",
35+
"--options.model", "openai/gpt-4o",
3736
"--options.timeout", "30000",
3837
"--options.variables", "{username: john_doe}",
3938
"--stream-response=false",
40-
"--x-sent-at", "2025-01-15T10:30:00Z",
4139
"--x-stream-response", "true",
4240
)
4341
}
@@ -49,7 +47,6 @@ func TestSessionsEnd(t *testing.T) {
4947
"sessions", "end",
5048
"--id", "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
5149
"---force-body", "{}",
52-
"--x-sent-at", "2025-01-15T10:30:00Z",
5350
"--x-stream-response", "true",
5451
)
5552
}
@@ -60,11 +57,10 @@ func TestSessionsExecute(t *testing.T) {
6057
t,
6158
"sessions", "execute",
6259
"--id", "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
63-
"--agent-config", "{cua: true, model: openai/gpt-5-nano, provider: openai, systemPrompt: systemPrompt}",
60+
"--agent-config", "{cua: true, model: openai/gpt-4o, provider: openai, systemPrompt: systemPrompt}",
6461
"--execute-options", "{instruction: 'Log in with username ''demo'' and password ''test123'', then navigate to settings', highlightCursor: true, maxSteps: 20}",
6562
"--frame-id", "frameId",
6663
"--stream-response=false",
67-
"--x-sent-at", "2025-01-15T10:30:00Z",
6864
"--x-stream-response", "true",
6965
)
7066

@@ -77,15 +73,14 @@ func TestSessionsExecute(t *testing.T) {
7773
"sessions", "execute",
7874
"--id", "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
7975
"--agent-config.cua=true",
80-
"--agent-config.model", "openai/gpt-5-nano",
76+
"--agent-config.model", "openai/gpt-4o",
8177
"--agent-config.provider", "openai",
8278
"--agent-config.systemPrompt", "systemPrompt",
8379
"--execute-options.instruction", "Log in with username 'demo' and password 'test123', then navigate to settings",
8480
"--execute-options.highlightCursor=true",
8581
"--execute-options.maxSteps", "20",
8682
"--frame-id", "frameId",
8783
"--stream-response=false",
88-
"--x-sent-at", "2025-01-15T10:30:00Z",
8984
"--x-stream-response", "true",
9085
)
9186
}
@@ -98,10 +93,9 @@ func TestSessionsExtract(t *testing.T) {
9893
"--id", "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
9994
"--frame-id", "frameId",
10095
"--instruction", "Extract all product names and prices from the page",
101-
"--options", "{model: openai/gpt-5-nano, selector: '#main-content', timeout: 30000}",
96+
"--options", "{model: openai/gpt-4o, selector: '#main-content', timeout: 30000}",
10297
"--schema", "{foo: bar}",
10398
"--stream-response=false",
104-
"--x-sent-at", "2025-01-15T10:30:00Z",
10599
"--x-stream-response", "true",
106100
)
107101

@@ -115,12 +109,11 @@ func TestSessionsExtract(t *testing.T) {
115109
"--id", "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
116110
"--frame-id", "frameId",
117111
"--instruction", "Extract all product names and prices from the page",
118-
"--options.model", "openai/gpt-5-nano",
112+
"--options.model", "openai/gpt-4o",
119113
"--options.selector", "#main-content",
120114
"--options.timeout", "30000",
121115
"--schema", "{foo: bar}",
122116
"--stream-response=false",
123-
"--x-sent-at", "2025-01-15T10:30:00Z",
124117
"--x-stream-response", "true",
125118
)
126119
}
@@ -135,7 +128,6 @@ func TestSessionsNavigate(t *testing.T) {
135128
"--frame-id", "frameId",
136129
"--options", "{referer: referer, timeout: 30000, waitUntil: networkidle}",
137130
"--stream-response=true",
138-
"--x-sent-at", "2025-01-15T10:30:00Z",
139131
"--x-stream-response", "true",
140132
)
141133

@@ -153,7 +145,6 @@ func TestSessionsNavigate(t *testing.T) {
153145
"--options.timeout", "30000",
154146
"--options.waitUntil", "networkidle",
155147
"--stream-response=true",
156-
"--x-sent-at", "2025-01-15T10:30:00Z",
157148
"--x-stream-response", "true",
158149
)
159150
}
@@ -166,9 +157,8 @@ func TestSessionsObserve(t *testing.T) {
166157
"--id", "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
167158
"--frame-id", "frameId",
168159
"--instruction", "Find all clickable navigation links",
169-
"--options", "{model: openai/gpt-5-nano, selector: nav, timeout: 30000}",
160+
"--options", "{model: openai/gpt-4o, selector: nav, timeout: 30000}",
170161
"--stream-response=false",
171-
"--x-sent-at", "2025-01-15T10:30:00Z",
172162
"--x-stream-response", "true",
173163
)
174164

@@ -182,11 +172,10 @@ func TestSessionsObserve(t *testing.T) {
182172
"--id", "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
183173
"--frame-id", "frameId",
184174
"--instruction", "Find all clickable navigation links",
185-
"--options.model", "openai/gpt-5-nano",
175+
"--options.model", "openai/gpt-4o",
186176
"--options.selector", "nav",
187177
"--options.timeout", "30000",
188178
"--stream-response=false",
189-
"--x-sent-at", "2025-01-15T10:30:00Z",
190179
"--x-stream-response", "true",
191180
)
192181
}
@@ -207,7 +196,6 @@ func TestSessionsStart(t *testing.T) {
207196
"--system-prompt", "systemPrompt",
208197
"--verbose", "1",
209198
"--wait-for-captcha-solves=true",
210-
"--x-sent-at", "2025-01-15T10:30:00Z",
211199
"--x-stream-response", "true",
212200
)
213201

@@ -238,7 +226,6 @@ func TestSessionsStart(t *testing.T) {
238226
"--system-prompt", "systemPrompt",
239227
"--verbose", "1",
240228
"--wait-for-captcha-solves=true",
241-
"--x-sent-at", "2025-01-15T10:30:00Z",
242229
"--x-stream-response", "true",
243230
)
244231
}

0 commit comments

Comments
 (0)