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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.111.0"
".": "0.112.0"
}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [0.112.0](https://github.com/kernel/kernel-python-sdk/compare/v0.111.0...v0.112.0) (2026-09-23)


### Features

* Add profiles to browser pool acquire ([f5c540c](https://github.com/kernel/kernel-python-sdk/commit/f5c540cdd1b0cee422cf47825dbc2212a5b6532f))
* Correct monitor_disconnected description on computed state ([2b637f5](https://github.com/kernel/kernel-python-sdk/commit/2b637f562b34ad0963b8ba4d0ecca73fa1dd6349))
* Filter archived telemetry events by type ([1fdfce2](https://github.com/kernel/kernel-python-sdk/commit/1fdfce2a3b05c5af330c93cd8e37a217f4d0f99b))
* Publish iframe and worker browser target types ([848805a](https://github.com/kernel/kernel-python-sdk/commit/848805abcfa585e4299742cd8f7a3ff0306febfe))

## [0.111.0](https://github.com/kernel/kernel-python-sdk/compare/v0.110.0...v0.111.0) (2026-09-22)


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 = "kernel"
version = "0.111.0"
version = "0.112.0"
description = "The official Python library for the kernel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/_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__ = "kernel"
__version__ = "0.111.0" # x-release-please-version
__version__ = "0.112.0" # x-release-please-version
19 changes: 17 additions & 2 deletions src/kernel/resources/browser_pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from ..types.browser_pool import BrowserPool
from ..types.browser_network_config_param import BrowserNetworkConfigParam
from ..types.browser_pool_acquire_response import BrowserPoolAcquireResponse
from ..types.shared_params.browser_profile import BrowserProfile
from ..types.shared_params.browser_viewport import BrowserViewport
from ..types.shared_params.browser_extension import BrowserExtension

Expand Down Expand Up @@ -509,6 +510,7 @@ def acquire(
*,
acquire_timeout_seconds: int | Omit = omit,
name: str | Omit = omit,
profile: BrowserProfile | Omit = omit,
start_url: str | Omit = omit,
tags: TagsParam | Omit = omit,
telemetry: Optional[browser_pool_acquire_params.Telemetry] | Omit = omit,
Expand Down Expand Up @@ -536,6 +538,10 @@ def acquire(
project. Applies to this lease only and is cleared when the browser is released
back to the pool.

profile: Profile selection for the browser session. Provide either id or name. If
specified, the matching profile will be loaded into the browser session.
Profiles must be created beforehand.

start_url: Optional URL to navigate the acquired browser to. Overrides the pool's start_url
for this acquire only. Best-effort: failures to navigate do not fail the
acquire.
Expand Down Expand Up @@ -569,6 +575,7 @@ def acquire(
{
"acquire_timeout_seconds": acquire_timeout_seconds,
"name": name,
"profile": profile,
"start_url": start_url,
"tags": tags,
"telemetry": telemetry,
Expand Down Expand Up @@ -638,7 +645,8 @@ def release(
Defaults to true. A reused browser keeps the configuration it was created with,
so it does not pick up pool configuration changes made while it was in use.
Release with `reuse: false`, or flush the pool afterward, to rebuild it with the
current configuration.
current configuration. Browsers loaded with an acquire-time profile are always
destroyed and replaced, even when reuse is true.

extra_headers: Send extra headers

Expand Down Expand Up @@ -1139,6 +1147,7 @@ async def acquire(
*,
acquire_timeout_seconds: int | Omit = omit,
name: str | Omit = omit,
profile: BrowserProfile | Omit = omit,
start_url: str | Omit = omit,
tags: TagsParam | Omit = omit,
telemetry: Optional[browser_pool_acquire_params.Telemetry] | Omit = omit,
Expand Down Expand Up @@ -1166,6 +1175,10 @@ async def acquire(
project. Applies to this lease only and is cleared when the browser is released
back to the pool.

profile: Profile selection for the browser session. Provide either id or name. If
specified, the matching profile will be loaded into the browser session.
Profiles must be created beforehand.

start_url: Optional URL to navigate the acquired browser to. Overrides the pool's start_url
for this acquire only. Best-effort: failures to navigate do not fail the
acquire.
Expand Down Expand Up @@ -1199,6 +1212,7 @@ async def acquire(
{
"acquire_timeout_seconds": acquire_timeout_seconds,
"name": name,
"profile": profile,
"start_url": start_url,
"tags": tags,
"telemetry": telemetry,
Expand Down Expand Up @@ -1268,7 +1282,8 @@ async def release(
Defaults to true. A reused browser keeps the configuration it was created with,
so it does not pick up pool configuration changes made while it was in use.
Release with `reuse: false`, or flush the pool afterward, to rebuild it with the
current configuration.
current configuration. Browsers loaded with an acquire-time profile are always
destroyed and replaced, even when reuse is true.

extra_headers: Send extra headers

Expand Down
32 changes: 21 additions & 11 deletions src/kernel/resources/browsers/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import httpx

from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ..._utils import path_template, maybe_transform, strip_not_given, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
Expand Down Expand Up @@ -75,6 +75,7 @@ def events(
offset: int | Omit = omit,
order: str | Omit = omit,
since: str | Omit = omit,
type: SequenceNotStr[str] | Omit = omit,
until: 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 @@ -87,8 +88,9 @@ def events(

To page through
results, pass the X-Next-Offset value from the previous response as offset and
repeat while X-Has-More is true. Returns an empty list when telemetry data is
unavailable.
repeat while X-Has-More is true. The category and type filters apply within each
page, so a filtered page may be empty while X-Has-More is true. Returns an empty
list when telemetry data is unavailable.

Args:
category: Restrict results to these event categories. Repeat the parameter for multiple
Expand All @@ -104,13 +106,15 @@ def events(
order: Read direction. asc (default) reads oldest first, starting from since or the
offset cursor. desc reads newest first: each request returns one page of up to
limit records ending at the offset cursor (or until, or the newest archived
event); combining desc with since is rejected with a 400. In either direction
the category filter applies within the page, so a filtered page may be empty
while X-Has-More is true.
event); combining desc with since is rejected with a 400.

since: Start of the window: an RFC-3339 timestamp, or a duration like 5m meaning that
long ago. Defaults to 5m. Ignored when offset is set.

type: Restrict results to these event types, such as page_crashed or
captcha_challenge_result. Repeat the parameter for multiple values. Combines
with category: when both are set an event must match both.

until: End of the window (exclusive): an RFC-3339 timestamp, or a duration like 5m
meaning that long ago.

Expand Down Expand Up @@ -139,6 +143,7 @@ def events(
"offset": offset,
"order": order,
"since": since,
"type": type,
"until": until,
},
telemetry_events_params.TelemetryEventsParams,
Expand Down Expand Up @@ -252,6 +257,7 @@ def events(
offset: int | Omit = omit,
order: str | Omit = omit,
since: str | Omit = omit,
type: SequenceNotStr[str] | Omit = omit,
until: 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 @@ -264,8 +270,9 @@ def events(

To page through
results, pass the X-Next-Offset value from the previous response as offset and
repeat while X-Has-More is true. Returns an empty list when telemetry data is
unavailable.
repeat while X-Has-More is true. The category and type filters apply within each
page, so a filtered page may be empty while X-Has-More is true. Returns an empty
list when telemetry data is unavailable.

Args:
category: Restrict results to these event categories. Repeat the parameter for multiple
Expand All @@ -281,13 +288,15 @@ def events(
order: Read direction. asc (default) reads oldest first, starting from since or the
offset cursor. desc reads newest first: each request returns one page of up to
limit records ending at the offset cursor (or until, or the newest archived
event); combining desc with since is rejected with a 400. In either direction
the category filter applies within the page, so a filtered page may be empty
while X-Has-More is true.
event); combining desc with since is rejected with a 400.

since: Start of the window: an RFC-3339 timestamp, or a duration like 5m meaning that
long ago. Defaults to 5m. Ignored when offset is set.

type: Restrict results to these event types, such as page_crashed or
captcha_challenge_result. Repeat the parameter for multiple values. Combines
with category: when both are set an event must match both.

until: End of the window (exclusive): an RFC-3339 timestamp, or a duration like 5m
meaning that long ago.

Expand Down Expand Up @@ -316,6 +325,7 @@ def events(
"offset": offset,
"order": order,
"since": since,
"type": type,
"until": until,
},
telemetry_events_params.TelemetryEventsParams,
Expand Down
8 changes: 8 additions & 0 deletions src/kernel/types/browser_pool_acquire_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing_extensions import TypedDict

from .tags_param import TagsParam
from .shared_params.browser_profile import BrowserProfile
from .browsers.browser_telemetry_categories_config_param import BrowserTelemetryCategoriesConfigParam

__all__ = [
Expand Down Expand Up @@ -33,6 +34,13 @@ class BrowserPoolAcquireParams(TypedDict, total=False):
back to the pool.
"""

profile: BrowserProfile
"""Profile selection for the browser session.

Provide either id or name. If specified, the matching profile will be loaded
into the browser session. Profiles must be created beforehand.
"""

start_url: str
"""Optional URL to navigate the acquired browser to.

Expand Down
3 changes: 2 additions & 1 deletion src/kernel/types/browser_pool_release_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ class BrowserPoolReleaseParams(TypedDict, total=False):
Defaults to true. A reused browser keeps the configuration it was created with,
so it does not pick up pool configuration changes made while it was in use.
Release with `reuse: false`, or flush the pool afterward, to rebuild it with the
current configuration.
current configuration. Browsers loaded with an acquire-time profile are always
destroyed and replaced, even when reuse is true.
"""
4 changes: 3 additions & 1 deletion src/kernel/types/browsers/browser_event_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class BrowserEventContext(BaseModel):
target_id: Optional[str] = None
"""Browser target identifier (stable across navigations within a tab)."""

target_type: Optional[Literal["page", "background_page", "service_worker", "shared_worker", "other"]] = None
target_type: Optional[
Literal["page", "iframe", "worker", "background_page", "service_worker", "shared_worker", "other"]
] = None
"""CDP target type of the page that produced the event."""

url: Optional[str] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Data(BaseModel):
class BrowserMonitorDisconnectedEvent(BaseModel):
"""The CDP connection to Chrome was lost.

Telemetry events may be dropped until monitor_reconnected arrives. Treat any in-progress computed state (network_idle, page_layout_settled) as unreliable until then.
Telemetry events may be dropped until monitor_reconnected arrives. In-progress computed state is discarded rather than paused, so computed events still pending for the current navigation (network_idle, page_layout_settled, page_navigation_settled) never fire. monitor_reconnected does not restore them. After reattachment a fresh state machine starts, so computed events can resume before the next navigation and carry empty navigation context until one occurs.
"""

category: Literal["monitor"]
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/types/browsers/browser_page_crashed_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Data(BaseModel):
target_id: str
"""CDP target identifier of the crashed page."""

target_type: Literal["page", "background_page", "service_worker", "shared_worker", "other"]
target_type: Literal["page", "iframe", "worker", "background_page", "service_worker", "shared_worker", "other"]
"""CDP target type of the page that produced the event."""

url: str
Expand Down
4 changes: 3 additions & 1 deletion src/kernel/types/browsers/browser_page_navigation_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ class Data(BaseModel):
target_id: Optional[str] = None
"""Browser target identifier."""

target_type: Optional[Literal["page", "background_page", "service_worker", "shared_worker", "other"]] = None
target_type: Optional[
Literal["page", "iframe", "worker", "background_page", "service_worker", "shared_worker", "other"]
] = None
"""CDP target type of the page that produced the event."""

url: Optional[str] = None
Expand Down
4 changes: 3 additions & 1 deletion src/kernel/types/browsers/browser_page_tab_opened_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ class Data(BaseModel):
target_id: Optional[str] = None
"""CDP target identifier for the newly opened tab."""

target_type: Optional[Literal["page", "background_page", "service_worker", "shared_worker", "other"]] = None
target_type: Optional[
Literal["page", "iframe", "worker", "background_page", "service_worker", "shared_worker", "other"]
] = None
"""CDP target type of the page that produced the event."""

title: Optional[str] = None
Expand Down
13 changes: 10 additions & 3 deletions src/kernel/types/browsers/telemetry_events_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from typing import List
from typing_extensions import Literal, TypedDict

from ..._types import SequenceNotStr

__all__ = ["TelemetryEventsParams"]


Expand Down Expand Up @@ -46,9 +48,7 @@ class TelemetryEventsParams(TypedDict, total=False):
asc (default) reads oldest first, starting from since or the offset cursor. desc
reads newest first: each request returns one page of up to limit records ending
at the offset cursor (or until, or the newest archived event); combining desc
with since is rejected with a 400. In either direction the category filter
applies within the page, so a filtered page may be empty while X-Has-More is
true.
with since is rejected with a 400.
"""

since: str
Expand All @@ -57,6 +57,13 @@ class TelemetryEventsParams(TypedDict, total=False):
long ago. Defaults to 5m. Ignored when offset is set.
"""

type: SequenceNotStr[str]
"""
Restrict results to these event types, such as page_crashed or
captcha_challenge_result. Repeat the parameter for multiple values. Combines
with category: when both are set an event must match both.
"""

until: str
"""
End of the window (exclusive): an RFC-3339 timestamp, or a duration like 5m
Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/browsers/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def test_method_events_with_all_params(self, client: Kernel) -> None:
offset=0,
order="order",
since="since",
type=["string"],
until="until",
)
assert_matches_type(SyncOffsetPagination[TelemetryEventsResponse], telemetry, path=["response"])
Expand Down Expand Up @@ -149,6 +150,7 @@ async def test_method_events_with_all_params(self, async_client: AsyncKernel) ->
offset=0,
order="order",
since="since",
type=["string"],
until="until",
)
assert_matches_type(AsyncOffsetPagination[TelemetryEventsResponse], telemetry, path=["response"])
Expand Down
10 changes: 10 additions & 0 deletions tests/api_resources/test_browser_pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,11 @@ def test_method_acquire_with_all_params(self, client: Kernel) -> None:
id_or_name="id_or_name",
acquire_timeout_seconds=0,
name="checkout-flow-1",
profile={
"id": "id",
"name": "name",
"save_changes": True,
},
start_url="https://example.com",
tags={
"team": "backend",
Expand Down Expand Up @@ -892,6 +897,11 @@ async def test_method_acquire_with_all_params(self, async_client: AsyncKernel) -
id_or_name="id_or_name",
acquire_timeout_seconds=0,
name="checkout-flow-1",
profile={
"id": "id",
"name": "name",
"save_changes": True,
},
start_url="https://example.com",
tags={
"team": "backend",
Expand Down
Loading