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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/browserbase-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -44,7 +44,7 @@ jobs:
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/browserbase-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
test:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/browserbase-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
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 @@
{
".": "1.15.0"
".": "1.16.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: 38
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/browserbase-98cc68ad9afa71355baf2b31f305a5e2f3a315fd311c96659405eff96b8f2b1e.yml
openapi_spec_hash: 71dfbc1021a33dd7fc9d82844965b1b3
config_hash: 6209a285dd5980f5c418fe6575723aef
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/browserbase-99c716f954a37900a19a0dc8465d6f502b1df7a0a2a2fde1eaaadac2b749f546.yml
openapi_spec_hash: c060ef2eebd323545d2ad60dad505cf1
config_hash: 12a5eb5ac818623045ae77075ee3dd53
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 1.16.0 (2026-08-04)

Full Changelog: [v1.15.0...v1.16.0](https://github.com/browserbase/sdk-python/compare/v1.15.0...v1.16.0)

### Features

* [CORE-2365] Add optional name to create and get Context API ([b2f4057](https://github.com/browserbase/sdk-python/commit/b2f4057417297ea0f6626e72b51d8a6c435960f6))
* [STG-2717] Pass-thru `proxy` config for session creation in `/v1/agents/runs` ([37ac241](https://github.com/browserbase/sdk-python/commit/37ac24172e12a3a6417714d12afa7984217dde06))
* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([c9098bb](https://github.com/browserbase/sdk-python/commit/c9098bb75d7ad2a4a84e55c0f0b0c65a5a61078b))

## 1.15.0 (2026-07-14)

Full Changelog: [v1.14.0...v1.15.0](https://github.com/browserbase/sdk-python/compare/v1.14.0...v1.15.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 = "browserbase"
version = "1.15.0"
version = "1.16.0"
description = "The official Python library for the Browserbase API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/browserbase/_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__ = "browserbase"
__version__ = "1.15.0" # x-release-please-version
__version__ = "1.16.0" # x-release-please-version
34 changes: 28 additions & 6 deletions src/browserbase/resources/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def with_streaming_response(self) -> ContextsResourceWithStreamingResponse:
def create(
self,
*,
name: str | Omit = omit,
project_id: str | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -57,9 +58,13 @@ def create(
"""Create a Context

Args:
project_id: The Project ID.
name: Optional user-defined name for the Context.

Can be found in
Leading and trailing whitespace is
trimmed before storage. Names are unique within the project among active
Contexts, compared case-insensitively.

project_id: The Project ID. Can be found in
[Settings](https://www.browserbase.com/settings). Optional - if not provided,
the project will be inferred from the API key.

Expand All @@ -73,7 +78,13 @@ def create(
"""
return self._post(
"/v1/contexts",
body=maybe_transform({"project_id": project_id}, context_create_params.ContextCreateParams),
body=maybe_transform(
{
"name": name,
"project_id": project_id,
},
context_create_params.ContextCreateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -204,6 +215,7 @@ def with_streaming_response(self) -> AsyncContextsResourceWithStreamingResponse:
async def create(
self,
*,
name: str | Omit = omit,
project_id: str | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -215,9 +227,13 @@ async def create(
"""Create a Context

Args:
project_id: The Project ID.
name: Optional user-defined name for the Context.

Can be found in
Leading and trailing whitespace is
trimmed before storage. Names are unique within the project among active
Contexts, compared case-insensitively.

project_id: The Project ID. Can be found in
[Settings](https://www.browserbase.com/settings). Optional - if not provided,
the project will be inferred from the API key.

Expand All @@ -231,7 +247,13 @@ async def create(
"""
return await self._post(
"/v1/contexts",
body=await async_maybe_transform({"project_id": project_id}, context_create_params.ContextCreateParams),
body=await async_maybe_transform(
{
"name": name,
"project_id": project_id,
},
context_create_params.ContextCreateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down
91 changes: 86 additions & 5 deletions src/browserbase/types/agents/run_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@

from __future__ import annotations

from typing import Dict
from typing_extensions import Required, Annotated, TypedDict
from typing import Dict, Union, Iterable
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict

from ..._utils import PropertyInfo

__all__ = ["RunCreateParams", "BrowserSettings", "BrowserSettingsContext", "Variables"]
__all__ = [
"RunCreateParams",
"BrowserSettings",
"BrowserSettingsContext",
"BrowserSettingsProxiesUnionMember0",
"BrowserSettingsProxiesUnionMember0BrowserbaseProxyConfig",
"BrowserSettingsProxiesUnionMember0BrowserbaseProxyConfigGeolocation",
"BrowserSettingsProxiesUnionMember0ExternalProxyConfig",
"BrowserSettingsProxiesUnionMember0NoneProxyConfig",
"Variables",
]


class RunCreateParams(TypedDict, total=False):
Expand Down Expand Up @@ -52,6 +62,74 @@ class BrowserSettingsContext(TypedDict, total=False):
"""Whether to persist the context after browsing. Defaults to false."""


class BrowserSettingsProxiesUnionMember0BrowserbaseProxyConfigGeolocation(TypedDict, total=False):
"""Geographic location for the proxy. Optional."""

country: Required[str]
"""Country code in ISO 3166-1 alpha-2 format"""

city: str
"""Name of the city. Use spaces for multi-word city names. Optional."""

state: str
"""US state code (2 characters). Must also specify US as the country. Optional."""


class BrowserSettingsProxiesUnionMember0BrowserbaseProxyConfig(TypedDict, total=False):
type: Required[Literal["browserbase"]]
"""Type of proxy.

Always use 'browserbase' for the Browserbase managed proxy network.
"""

domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")]
"""Domain pattern for which this proxy should be used.

If omitted, defaults to all domains. Optional.
"""

geolocation: BrowserSettingsProxiesUnionMember0BrowserbaseProxyConfigGeolocation
"""Geographic location for the proxy. Optional."""


class BrowserSettingsProxiesUnionMember0ExternalProxyConfig(TypedDict, total=False):
server: Required[str]
"""Server URL for external proxy. Required."""

type: Required[Literal["external"]]
"""Type of proxy. Always 'external' for this config."""

domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")]
"""Domain pattern for which this proxy should be used.

If omitted, defaults to all domains. Optional.
"""

password: str
"""Password for external proxy authentication. Optional."""

username: str
"""Username for external proxy authentication. Optional."""


class BrowserSettingsProxiesUnionMember0NoneProxyConfig(TypedDict, total=False):
type: Required[Literal["none"]]
"""Type of proxy. Always 'none' for this config."""

domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")]
"""Domain pattern for which this proxy should be used.

If omitted, defaults to all domains. Optional.
"""


BrowserSettingsProxiesUnionMember0: TypeAlias = Union[
BrowserSettingsProxiesUnionMember0BrowserbaseProxyConfig,
BrowserSettingsProxiesUnionMember0ExternalProxyConfig,
BrowserSettingsProxiesUnionMember0NoneProxyConfig,
]


class BrowserSettings(TypedDict, total=False):
"""Browser configuration for the agent's session.

Expand All @@ -60,8 +138,11 @@ class BrowserSettings(TypedDict, total=False):

context: BrowserSettingsContext

proxies: bool
"""Set true to route the agent's browser session through the default proxy."""
proxies: Union[Iterable[BrowserSettingsProxiesUnionMember0], bool]
"""Proxy configuration.

Can be true for default proxy, or an array of proxy configurations.
"""

verified: bool
"""Set true to enable Browserbase Verified for the session."""
Expand Down
8 changes: 8 additions & 0 deletions src/browserbase/types/context.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from datetime import datetime

from pydantic import Field as FieldInfo
Expand All @@ -18,3 +19,10 @@ class Context(BaseModel):
"""The Project ID linked to the uploaded Context."""

updated_at: datetime = FieldInfo(alias="updatedAt")

name: Optional[str] = None
"""Optional user-defined name for the Context.

Leading and trailing whitespace is trimmed before storage. Names are unique
within the project among active Contexts, compared case-insensitively.
"""
7 changes: 7 additions & 0 deletions src/browserbase/types/context_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@


class ContextCreateParams(TypedDict, total=False):
name: str
"""Optional user-defined name for the Context.

Leading and trailing whitespace is trimmed before storage. Names are unique
within the project among active Contexts, compared case-insensitively.
"""

project_id: Annotated[str, PropertyInfo(alias="projectId")]
"""The Project ID.

Expand Down
24 changes: 22 additions & 2 deletions tests/api_resources/agents/test_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,17 @@ def test_method_create_with_all_params(self, client: Browserbase) -> None:
"id": "id",
"persist": True,
},
"proxies": True,
"proxies": [
{
"type": "browserbase",
"domain_pattern": "domainPattern",
"geolocation": {
"country": "xx",
"city": "city",
"state": "xx",
},
}
],
"verified": True,
},
result_schema={"foo": "bar"},
Expand Down Expand Up @@ -223,7 +233,17 @@ async def test_method_create_with_all_params(self, async_client: AsyncBrowserbas
"id": "id",
"persist": True,
},
"proxies": True,
"proxies": [
{
"type": "browserbase",
"domain_pattern": "domainPattern",
"geolocation": {
"country": "xx",
"city": "city",
"state": "xx",
},
}
],
"verified": True,
},
result_schema={"foo": "bar"},
Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/test_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def test_method_create(self, client: Browserbase) -> None:
@parametrize
def test_method_create_with_all_params(self, client: Browserbase) -> None:
context = client.contexts.create(
name="x",
project_id="projectId",
)
assert_matches_type(ContextCreateResponse, context, path=["response"])
Expand Down Expand Up @@ -177,6 +178,7 @@ async def test_method_create(self, async_client: AsyncBrowserbase) -> None:
@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncBrowserbase) -> None:
context = await async_client.contexts.create(
name="x",
project_id="projectId",
)
assert_matches_type(ContextCreateResponse, context, path=["response"])
Expand Down