Skip to content

Commit e2175ce

Browse files
feat: Add executionModel serialization to api client
1 parent 033e0ba commit e2175ce

File tree

8 files changed

+127
-103
lines changed

8 files changed

+127
-103
lines changed

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release Doctor
22
on:
33
pull_request:
44
branches:
5-
- main
5+
- stainless
66
workflow_dispatch:
77

88
jobs:

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-43e6dd4ce19381de488d296e9036fea15bfea9a6f946cf8ccf4e02aecc8fb765.yml
3-
openapi_spec_hash: f736e7a8acea0d73e1031c86ea803246
4-
config_hash: b375728ccf7d33287335852f4f59c293
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-8fbb3fa8f3a37c1c7408de427fe125aadec49f705e8e30d191601a9b69c4cc41.yml
3+
openapi_spec_hash: 48b4dfac35a842d7fb0d228caf87544e
4+
config_hash: 242651c4871c2869ba3c2e3d337505b9

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</a>
2929
</p>
3030
<!-- prettier-ignore -->
31-
[![PyPI version](https://img.shields.io/pypi/v/stagehand.svg?label=pypi%20(stable))](https://pypi.org/project/stagehand/)
31+
[![PyPI version](https://img.shields.io/pypi/v/stagehand-alpha.svg?label=pypi%20(stable))](https://pypi.org/project/stagehand-alpha/)
3232

3333
<p align="center">
3434
<a href="https://trendshift.io/repositories/12122" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12122" alt="browserbase%2Fstagehand | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
@@ -606,9 +606,9 @@ session = response.parse() # get the object that `sessions.start()` would have
606606
print(session.data)
607607
```
608608

609-
These methods return an [`APIResponse`](https://github.com/browserbase/stagehand-python/tree/main/src/stagehand/_response.py) object.
609+
These methods return an [`APIResponse`](https://github.com/browserbase/stagehand-python/tree/stainless/src/stagehand/_response.py) object.
610610

611-
The async client returns an [`AsyncAPIResponse`](https://github.com/browserbase/stagehand-python/tree/main/src/stagehand/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
611+
The async client returns an [`AsyncAPIResponse`](https://github.com/browserbase/stagehand-python/tree/stainless/src/stagehand/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
612612

613613
#### `.with_streaming_response`
614614

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "stagehand"
2+
name = "stagehand-alpha"
33
version = "3.5.0"
44
description = "The official Python library for the stagehand API"
55
dynamic = ["readme"]
@@ -122,7 +122,7 @@ path = "README.md"
122122
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
123123
# replace relative links with absolute links
124124
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
125-
replacement = '[\1](https://github.com/browserbase/stagehand-python/tree/main/\g<2>)'
125+
replacement = '[\1](https://github.com/browserbase/stagehand-python/tree/stainless/\g<2>)'
126126

127127
[tool.pytest.ini_options]
128128
testpaths = ["tests"]

requirements-dev.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ annotated-types==0.7.0
66
anyio==4.12.0
77
# via
88
# httpx
9-
# stagehand
9+
# stagehand-alpha
1010
backports-asyncio-runner==1.2.0 ; python_full_version < '3.11'
1111
# via pytest-asyncio
1212
certifi==2025.11.12
@@ -17,7 +17,7 @@ colorama==0.4.6 ; sys_platform == 'win32'
1717
# via pytest
1818
dirty-equals==0.11
1919
distro==1.9.0
20-
# via stagehand
20+
# via stagehand-alpha
2121
dotenv==0.9.9
2222
exceptiongroup==1.3.1 ; python_full_version < '3.11'
2323
# via
@@ -32,7 +32,7 @@ httpcore==1.0.9
3232
httpx==0.28.1
3333
# via
3434
# respx
35-
# stagehand
35+
# stagehand-alpha
3636
idna==3.11
3737
# via
3838
# anyio
@@ -60,7 +60,7 @@ pathspec==0.12.1
6060
pluggy==1.6.0
6161
# via pytest
6262
pydantic==2.12.5
63-
# via stagehand
63+
# via stagehand-alpha
6464
pydantic-core==2.41.5
6565
# via pydantic
6666
pygments==2.19.2
@@ -89,7 +89,7 @@ ruff==0.14.7
8989
six==1.17.0 ; python_full_version < '3.10'
9090
# via python-dateutil
9191
sniffio==1.3.1
92-
# via stagehand
92+
# via stagehand-alpha
9393
time-machine==2.19.0 ; python_full_version < '3.10'
9494
time-machine==3.1.0 ; python_full_version >= '3.10'
9595
tomli==2.3.0 ; python_full_version < '3.11'
@@ -105,7 +105,7 @@ typing-extensions==4.15.0
105105
# pydantic-core
106106
# pyright
107107
# pytest-asyncio
108-
# stagehand
108+
# stagehand-alpha
109109
# typing-inspection
110110
typing-inspection==0.4.2
111111
# via pydantic

src/stagehand/_streaming.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __stream__(self) -> Iterator[_T]:
5656

5757
try:
5858
for sse in iterator:
59-
if sse.data.startswith('{"data":{"status":"finished"'):
59+
if sse.data.startswith("finished"):
6060
break
6161

6262
if sse.data.startswith("error"):
@@ -139,7 +139,7 @@ async def __stream__(self) -> AsyncIterator[_T]:
139139

140140
try:
141141
async for sse in iterator:
142-
if sse.data.startswith('{"data":{"status":"finished"'):
142+
if sse.data.startswith("finished"):
143143
break
144144

145145
if sse.data.startswith("error"):

tests/api_resources/test_sessions.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ def test_method_execute_with_all_params_overload_1(self, client: Stagehand) -> N
225225
id="c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
226226
agent_config={
227227
"cua": True,
228+
"execution_model": {
229+
"model_name": "openai/gpt-5-nano",
230+
"api_key": "sk-some-openai-api-key",
231+
"base_url": "https://api.openai.com/v1",
232+
"provider": "openai",
233+
},
228234
"mode": "cua",
229235
"model": {"model_name": "openai/gpt-5-nano"},
230236
"provider": "openai",
@@ -308,6 +314,12 @@ def test_method_execute_with_all_params_overload_2(self, client: Stagehand) -> N
308314
id="c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
309315
agent_config={
310316
"cua": True,
317+
"execution_model": {
318+
"model_name": "openai/gpt-5-nano",
319+
"api_key": "sk-some-openai-api-key",
320+
"base_url": "https://api.openai.com/v1",
321+
"provider": "openai",
322+
},
311323
"mode": "cua",
312324
"model": {"model_name": "openai/gpt-5-nano"},
313325
"provider": "openai",
@@ -1058,6 +1070,12 @@ async def test_method_execute_with_all_params_overload_1(self, async_client: Asy
10581070
id="c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
10591071
agent_config={
10601072
"cua": True,
1073+
"execution_model": {
1074+
"model_name": "openai/gpt-5-nano",
1075+
"api_key": "sk-some-openai-api-key",
1076+
"base_url": "https://api.openai.com/v1",
1077+
"provider": "openai",
1078+
},
10611079
"mode": "cua",
10621080
"model": {"model_name": "openai/gpt-5-nano"},
10631081
"provider": "openai",
@@ -1141,6 +1159,12 @@ async def test_method_execute_with_all_params_overload_2(self, async_client: Asy
11411159
id="c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
11421160
agent_config={
11431161
"cua": True,
1162+
"execution_model": {
1163+
"model_name": "openai/gpt-5-nano",
1164+
"api_key": "sk-some-openai-api-key",
1165+
"base_url": "https://api.openai.com/v1",
1166+
"provider": "openai",
1167+
},
11441168
"mode": "cua",
11451169
"model": {"model_name": "openai/gpt-5-nano"},
11461170
"provider": "openai",

0 commit comments

Comments
 (0)