Skip to content

Commit dfc4a7a

Browse files
release: 3.18.0 (#322)
* chore(internal): update gitignore * feat: Add explicit SSE event names for local v3 streaming * feat: Include LLM headers in ModelConfig * chore(ci): skip lint on metadata-only changes Note that we still want to run tests, as these depend on the metadata. * release: 3.18.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 7f7a3aa commit dfc4a7a

File tree

11 files changed

+135
-39
lines changed

11 files changed

+135
-39
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
timeout-minutes: 10
2020
name: lint
2121
runs-on: ${{ github.repository == 'stainless-sdks/stagehand-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
22-
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
22+
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
2323
steps:
2424
- uses: actions/checkout@v6
2525

@@ -35,7 +35,7 @@ jobs:
3535
run: ./scripts/lint
3636

3737
build:
38-
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
38+
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
3939
timeout-minutes: 10
4040
name: build
4141
permissions:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.prism.log
2+
.stdy.log
23
_dev
34

45
__pycache__

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "3.7.0"
2+
".": "3.18.0"
33
}

.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-975ca868b31b1e45fb00b31a53d9df1ceec8663f6c2851bf40fdaa84171afadc.yml
3-
openapi_spec_hash: 37891379e0f47e5c69769fbaa1064dab
4-
config_hash: 0209737a4ab2a71afececb0ff7459998
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-bc309fd00fe0507f4cbe3bc77fa27d0fbffeaa6e71998778da34de42608a67e8.yml
3+
openapi_spec_hash: 1db1af5c1b068bba1d652102f4454668
4+
config_hash: d6c6f623d03971bdba921650e5eb7e5f

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## 3.18.0 (2026-03-25)
4+
5+
Full Changelog: [v3.7.0...v3.18.0](https://github.com/browserbase/stagehand-python/compare/v3.7.0...v3.18.0)
6+
7+
### Features
8+
9+
* Add explicit SSE event names for local v3 streaming ([493abf4](https://github.com/browserbase/stagehand-python/commit/493abf4ee2023c3a88701c01bdd4bfdd1f4e0b63))
10+
* Include LLM headers in ModelConfig ([b0df6bc](https://github.com/browserbase/stagehand-python/commit/b0df6bcddaa9dbf206dee0d97ee9e303d703530b))
11+
12+
13+
### Chores
14+
15+
* **ci:** skip lint on metadata-only changes ([4049e44](https://github.com/browserbase/stagehand-python/commit/4049e44cb7855c62d2231c34c6211532860dfdbf))
16+
* **internal:** update gitignore ([5acaa6f](https://github.com/browserbase/stagehand-python/commit/5acaa6f97a3fd926e3406c3af3504576a86a05bb))
17+
318
## 3.7.0 (2026-03-23)
419

520
Full Changelog: [v3.6.0...v3.7.0](https://github.com/browserbase/stagehand-python/compare/v3.6.0...v3.7.0)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "stagehand"
3-
version = "3.7.0"
3+
version = "3.18.0"
44
description = "The official Python library for the stagehand API"
55
dynamic = ["readme"]
66
license = "MIT"

src/stagehand/_streaming.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ def __stream__(self) -> Iterator[_T]:
5959

6060
try:
6161
for sse in iterator:
62-
if sse.data.startswith('{"data":{"status":"finished"'):
63-
break
64-
65-
if sse.data.startswith("error"):
62+
if sse.event == "error":
6663
body = sse.data
6764

6865
try:
@@ -77,7 +74,12 @@ def __stream__(self) -> Iterator[_T]:
7774
response=self.response,
7875
)
7976

80-
if sse.event is None:
77+
if (
78+
sse.event == "starting"
79+
or sse.event == "connected"
80+
or sse.event == "running"
81+
or sse.event == "finished"
82+
):
8183
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
8284
finally:
8385
# Ensure the response is closed even if the consumer doesn't read all data
@@ -144,10 +146,7 @@ async def __stream__(self) -> AsyncIterator[_T]:
144146

145147
try:
146148
async for sse in iterator:
147-
if sse.data.startswith('{"data":{"status":"finished"'):
148-
break
149-
150-
if sse.data.startswith("error"):
149+
if sse.event == "error":
151150
body = sse.data
152151

153152
try:
@@ -162,7 +161,12 @@ async def __stream__(self) -> AsyncIterator[_T]:
162161
response=self.response,
163162
)
164163

165-
if sse.event is None:
164+
if (
165+
sse.event == "starting"
166+
or sse.event == "connected"
167+
or sse.event == "running"
168+
or sse.event == "finished"
169+
):
166170
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
167171
finally:
168172
# Ensure the response is closed even if the consumer doesn't read all data

src/stagehand/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "stagehand"
4-
__version__ = "3.7.0" # x-release-please-version
4+
__version__ = "3.18.0" # x-release-please-version

src/stagehand/types/model_config_param.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
from typing import Dict
56
from typing_extensions import Literal, Required, Annotated, TypedDict
67

78
from .._utils import PropertyInfo
@@ -19,5 +20,8 @@ class ModelConfigParam(TypedDict, total=False):
1920
base_url: Annotated[str, PropertyInfo(alias="baseURL")]
2021
"""Base URL for the model provider"""
2122

23+
headers: Dict[str, str]
24+
"""Custom headers sent with every request to the model provider"""
25+
2226
provider: Literal["openai", "anthropic", "google", "microsoft", "bedrock"]
2327
"""AI provider for the model (or provide a baseURL endpoint instead)"""

src/stagehand/types/stream_event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class DataStreamEventLogDataOutput(BaseModel):
3232
class StreamEvent(BaseModel):
3333
"""Server-Sent Event emitted during streaming responses.
3434
35-
Events are sent as `data: <JSON>\n\n`. Key order: data (with status first), type, id.
35+
Events are sent as `event: <status>\ndata: <JSON>\n\n`, where the JSON payload has the shape `{ data, type, id }`.
3636
"""
3737

3838
id: str

0 commit comments

Comments
 (0)