Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.19.2"
".": "3.19.3"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 8
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-bc309fd00fe0507f4cbe3bc77fa27d0fbffeaa6e71998778da34de42608a67e8.yml
openapi_spec_hash: 1db1af5c1b068bba1d652102f4454668
config_hash: d6c6f623d03971bdba921650e5eb7e5f
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-b969ce378479c79ee64c05127c0ed6c6ce2edbee017ecd037242fb618a5ebc9f.yml
openapi_spec_hash: a24aabaa5214effb679808b7f2be0ad4
config_hash: a962ae71493deb11a1c903256fb25386
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 3.19.3 (2026-04-03)

Full Changelog: [v3.19.2...v3.19.3](https://github.com/browserbase/stagehand-python/compare/v3.19.2...v3.19.3)

### Features

* Replace default model used in server-v3 api spec examples ([fb347d2](https://github.com/browserbase/stagehand-python/commit/fb347d256fea9453c9eb23d935558bd43405f934))

## 3.19.2 (2026-04-03)

Full Changelog: [v3.19.1...v3.19.2](https://github.com/browserbase/stagehand-python/compare/v3.19.1...v3.19.2)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "stagehand"
version = "3.19.2"
version = "3.19.3"
description = "The official Python library for the stagehand API"
dynamic = ["readme"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/stagehand/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "stagehand"
__version__ = "3.19.2" # x-release-please-version
__version__ = "3.19.3" # x-release-please-version
56 changes: 28 additions & 28 deletions tests/api_resources/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_method_act_with_all_params_overload_1(self, client: Stagehand) -> None:
frame_id="frameId",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -121,7 +121,7 @@ def test_method_act_with_all_params_overload_2(self, client: Stagehand) -> None:
frame_id="frameId",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -250,15 +250,15 @@ def test_method_execute_with_all_params_overload_1(self, client: Stagehand) -> N
agent_config={
"cua": True,
"execution_model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
"provider": "openai",
},
"mode": "cua",
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -348,15 +348,15 @@ def test_method_execute_with_all_params_overload_2(self, client: Stagehand) -> N
agent_config={
"cua": True,
"execution_model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
"provider": "openai",
},
"mode": "cua",
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -444,7 +444,7 @@ def test_method_extract_with_all_params_overload_1(self, client: Stagehand) -> N
instruction="Extract all product names and prices from the page",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -512,7 +512,7 @@ def test_method_extract_with_all_params_overload_2(self, client: Stagehand) -> N
instruction="Extract all product names and prices from the page",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -642,7 +642,7 @@ def test_method_observe_with_all_params_overload_1(self, client: Stagehand) -> N
instruction="Find all clickable navigation links",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -716,7 +716,7 @@ def test_method_observe_with_all_params_overload_2(self, client: Stagehand) -> N
instruction="Find all clickable navigation links",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -827,15 +827,15 @@ def test_path_params_replay(self, client: Stagehand) -> None:
@parametrize
def test_method_start(self, client: Stagehand) -> None:
session = client.sessions.start(
model_name="openai/gpt-4o",
model_name="openai/gpt-5.4-mini",
)
assert_matches_type(SessionStartResponse, session, path=["response"])

@pytest.mark.skip(reason="Mock server tests are disabled")
@parametrize
def test_method_start_with_all_params(self, client: Stagehand) -> None:
session = client.sessions.start(
model_name="openai/gpt-4o",
model_name="openai/gpt-5.4-mini",
act_timeout_ms=0,
browser={
"cdp_url": "ws://localhost:9222",
Expand Down Expand Up @@ -924,7 +924,7 @@ def test_method_start_with_all_params(self, client: Stagehand) -> None:
@parametrize
def test_raw_response_start(self, client: Stagehand) -> None:
response = client.sessions.with_raw_response.start(
model_name="openai/gpt-4o",
model_name="openai/gpt-5.4-mini",
)

assert response.is_closed is True
Expand All @@ -936,7 +936,7 @@ def test_raw_response_start(self, client: Stagehand) -> None:
@parametrize
def test_streaming_response_start(self, client: Stagehand) -> None:
with client.sessions.with_streaming_response.start(
model_name="openai/gpt-4o",
model_name="openai/gpt-5.4-mini",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down Expand Up @@ -970,7 +970,7 @@ async def test_method_act_with_all_params_overload_1(self, async_client: AsyncSt
frame_id="frameId",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -1047,7 +1047,7 @@ async def test_method_act_with_all_params_overload_2(self, async_client: AsyncSt
frame_id="frameId",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -1176,15 +1176,15 @@ async def test_method_execute_with_all_params_overload_1(self, async_client: Asy
agent_config={
"cua": True,
"execution_model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
"provider": "openai",
},
"mode": "cua",
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -1274,15 +1274,15 @@ async def test_method_execute_with_all_params_overload_2(self, async_client: Asy
agent_config={
"cua": True,
"execution_model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
"provider": "openai",
},
"mode": "cua",
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -1370,7 +1370,7 @@ async def test_method_extract_with_all_params_overload_1(self, async_client: Asy
instruction="Extract all product names and prices from the page",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -1438,7 +1438,7 @@ async def test_method_extract_with_all_params_overload_2(self, async_client: Asy
instruction="Extract all product names and prices from the page",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -1568,7 +1568,7 @@ async def test_method_observe_with_all_params_overload_1(self, async_client: Asy
instruction="Find all clickable navigation links",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -1642,7 +1642,7 @@ async def test_method_observe_with_all_params_overload_2(self, async_client: Asy
instruction="Find all clickable navigation links",
options={
"model": {
"model_name": "openai/gpt-5-nano",
"model_name": "openai/gpt-5.4-mini",
"api_key": "sk-some-openai-api-key",
"base_url": "https://api.openai.com/v1",
"headers": {"foo": "string"},
Expand Down Expand Up @@ -1753,15 +1753,15 @@ async def test_path_params_replay(self, async_client: AsyncStagehand) -> None:
@parametrize
async def test_method_start(self, async_client: AsyncStagehand) -> None:
session = await async_client.sessions.start(
model_name="openai/gpt-4o",
model_name="openai/gpt-5.4-mini",
)
assert_matches_type(SessionStartResponse, session, path=["response"])

@pytest.mark.skip(reason="Mock server tests are disabled")
@parametrize
async def test_method_start_with_all_params(self, async_client: AsyncStagehand) -> None:
session = await async_client.sessions.start(
model_name="openai/gpt-4o",
model_name="openai/gpt-5.4-mini",
act_timeout_ms=0,
browser={
"cdp_url": "ws://localhost:9222",
Expand Down Expand Up @@ -1850,7 +1850,7 @@ async def test_method_start_with_all_params(self, async_client: AsyncStagehand)
@parametrize
async def test_raw_response_start(self, async_client: AsyncStagehand) -> None:
response = await async_client.sessions.with_raw_response.start(
model_name="openai/gpt-4o",
model_name="openai/gpt-5.4-mini",
)

assert response.is_closed is True
Expand All @@ -1862,7 +1862,7 @@ async def test_raw_response_start(self, async_client: AsyncStagehand) -> None:
@parametrize
async def test_streaming_response_start(self, async_client: AsyncStagehand) -> None:
async with async_client.sessions.with_streaming_response.start(
model_name="openai/gpt-4o",
model_name="openai/gpt-5.4-mini",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down
20 changes: 10 additions & 10 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien
respx_mock.post("/v1/sessions/start").mock(side_effect=httpx.TimeoutException("Test timeout error"))

with pytest.raises(APITimeoutError):
client.sessions.with_streaming_response.start(model_name="openai/gpt-4o").__enter__()
client.sessions.with_streaming_response.start(model_name="openai/gpt-5.4-mini").__enter__()

assert _get_open_connections(client) == 0

Expand All @@ -1019,7 +1019,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client
respx_mock.post("/v1/sessions/start").mock(return_value=httpx.Response(500))

with pytest.raises(APIStatusError):
client.sessions.with_streaming_response.start(model_name="openai/gpt-4o").__enter__()
client.sessions.with_streaming_response.start(model_name="openai/gpt-5.4-mini").__enter__()
assert _get_open_connections(client) == 0

@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
Expand Down Expand Up @@ -1048,7 +1048,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:

respx_mock.post("/v1/sessions/start").mock(side_effect=retry_handler)

response = client.sessions.with_raw_response.start(model_name="openai/gpt-4o")
response = client.sessions.with_raw_response.start(model_name="openai/gpt-5.4-mini")

assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
Expand All @@ -1073,7 +1073,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/v1/sessions/start").mock(side_effect=retry_handler)

response = client.sessions.with_raw_response.start(
model_name="openai/gpt-4o", extra_headers={"x-stainless-retry-count": Omit()}
model_name="openai/gpt-5.4-mini", extra_headers={"x-stainless-retry-count": Omit()}
)

assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
Expand All @@ -1098,7 +1098,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/v1/sessions/start").mock(side_effect=retry_handler)

response = client.sessions.with_raw_response.start(
model_name="openai/gpt-4o", extra_headers={"x-stainless-retry-count": "42"}
model_name="openai/gpt-5.4-mini", extra_headers={"x-stainless-retry-count": "42"}
)

assert response.http_request.headers.get("x-stainless-retry-count") == "42"
Expand Down Expand Up @@ -2063,7 +2063,7 @@ async def test_retrying_timeout_errors_doesnt_leak(
respx_mock.post("/v1/sessions/start").mock(side_effect=httpx.TimeoutException("Test timeout error"))

with pytest.raises(APITimeoutError):
await async_client.sessions.with_streaming_response.start(model_name="openai/gpt-4o").__aenter__()
await async_client.sessions.with_streaming_response.start(model_name="openai/gpt-5.4-mini").__aenter__()

assert _get_open_connections(async_client) == 0

Expand All @@ -2075,7 +2075,7 @@ async def test_retrying_status_errors_doesnt_leak(
respx_mock.post("/v1/sessions/start").mock(return_value=httpx.Response(500))

with pytest.raises(APIStatusError):
await async_client.sessions.with_streaming_response.start(model_name="openai/gpt-4o").__aenter__()
await async_client.sessions.with_streaming_response.start(model_name="openai/gpt-5.4-mini").__aenter__()
assert _get_open_connections(async_client) == 0

@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
Expand Down Expand Up @@ -2104,7 +2104,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:

respx_mock.post("/v1/sessions/start").mock(side_effect=retry_handler)

response = await client.sessions.with_raw_response.start(model_name="openai/gpt-4o")
response = await client.sessions.with_raw_response.start(model_name="openai/gpt-5.4-mini")

assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
Expand All @@ -2129,7 +2129,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/v1/sessions/start").mock(side_effect=retry_handler)

response = await client.sessions.with_raw_response.start(
model_name="openai/gpt-4o", extra_headers={"x-stainless-retry-count": Omit()}
model_name="openai/gpt-5.4-mini", extra_headers={"x-stainless-retry-count": Omit()}
)

assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
Expand All @@ -2154,7 +2154,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/v1/sessions/start").mock(side_effect=retry_handler)

response = await client.sessions.with_raw_response.start(
model_name="openai/gpt-4o", extra_headers={"x-stainless-retry-count": "42"}
model_name="openai/gpt-5.4-mini", extra_headers={"x-stainless-retry-count": "42"}
)

assert response.http_request.headers.get("x-stainless-retry-count") == "42"
Expand Down
Loading