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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/stagehand-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6

Expand All @@ -35,7 +35,7 @@ jobs:
run: ./scripts/lint

build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
timeout-minutes: 10
name: build
permissions:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.prism.log
.stdy.log
_dev

__pycache__
Expand Down
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.7.0"
".": "3.18.0"
}
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-975ca868b31b1e45fb00b31a53d9df1ceec8663f6c2851bf40fdaa84171afadc.yml
openapi_spec_hash: 37891379e0f47e5c69769fbaa1064dab
config_hash: 0209737a4ab2a71afececb0ff7459998
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-bc309fd00fe0507f4cbe3bc77fa27d0fbffeaa6e71998778da34de42608a67e8.yml
openapi_spec_hash: 1db1af5c1b068bba1d652102f4454668
config_hash: d6c6f623d03971bdba921650e5eb7e5f
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 3.18.0 (2026-03-25)

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

### Features

* Add explicit SSE event names for local v3 streaming ([493abf4](https://github.com/browserbase/stagehand-python/commit/493abf4ee2023c3a88701c01bdd4bfdd1f4e0b63))
* Include LLM headers in ModelConfig ([b0df6bc](https://github.com/browserbase/stagehand-python/commit/b0df6bcddaa9dbf206dee0d97ee9e303d703530b))


### Chores

* **ci:** skip lint on metadata-only changes ([4049e44](https://github.com/browserbase/stagehand-python/commit/4049e44cb7855c62d2231c34c6211532860dfdbf))
* **internal:** update gitignore ([5acaa6f](https://github.com/browserbase/stagehand-python/commit/5acaa6f97a3fd926e3406c3af3504576a86a05bb))

## 3.7.0 (2026-03-23)

Full Changelog: [v3.6.0...v3.7.0](https://github.com/browserbase/stagehand-python/compare/v3.6.0...v3.7.0)
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.7.0"
version = "3.18.0"
description = "The official Python library for the stagehand API"
dynamic = ["readme"]
license = "MIT"
Expand Down
24 changes: 14 additions & 10 deletions src/stagehand/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ def __stream__(self) -> Iterator[_T]:

try:
for sse in iterator:
if sse.data.startswith('{"data":{"status":"finished"'):
break

if sse.data.startswith("error"):
if sse.event == "error":
body = sse.data

try:
Expand All @@ -77,7 +74,12 @@ def __stream__(self) -> Iterator[_T]:
response=self.response,
)

if sse.event is None:
if (
sse.event == "starting"
or sse.event == "connected"
or sse.event == "running"
or sse.event == "finished"
):
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
finally:
# Ensure the response is closed even if the consumer doesn't read all data
Expand Down Expand Up @@ -144,10 +146,7 @@ async def __stream__(self) -> AsyncIterator[_T]:

try:
async for sse in iterator:
if sse.data.startswith('{"data":{"status":"finished"'):
break

if sse.data.startswith("error"):
if sse.event == "error":
body = sse.data

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

if sse.event is None:
if (
sse.event == "starting"
or sse.event == "connected"
or sse.event == "running"
or sse.event == "finished"
):
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
finally:
# Ensure the response is closed even if the consumer doesn't read all data
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.7.0" # x-release-please-version
__version__ = "3.18.0" # x-release-please-version
4 changes: 4 additions & 0 deletions src/stagehand/types/model_config_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from typing import Dict
from typing_extensions import Literal, Required, Annotated, TypedDict

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

headers: Dict[str, str]
"""Custom headers sent with every request to the model provider"""

provider: Literal["openai", "anthropic", "google", "microsoft", "bedrock"]
"""AI provider for the model (or provide a baseURL endpoint instead)"""
2 changes: 1 addition & 1 deletion src/stagehand/types/stream_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DataStreamEventLogDataOutput(BaseModel):
class StreamEvent(BaseModel):
"""Server-Sent Event emitted during streaming responses.

Events are sent as `data: <JSON>\n\n`. Key order: data (with status first), type, id.
Events are sent as `event: <status>\ndata: <JSON>\n\n`, where the JSON payload has the shape `{ data, type, id }`.
"""

id: str
Expand Down
Loading
Loading