Skip to content
Open
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
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-a4a5ea048bb50d06460d81d6828b53b12b19e9224121ee6338dcd1f0781e22a1.yml
openapi_spec_hash: 9b81c0ae04576318d13d7a80d4ab7b5a
config_hash: d6c6f623d03971bdba921650e5eb7e5f
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 3.18.0 (2026-03-24)

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))


### Chores

* **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
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