6161 AsyncComputerResourceWithStreamingResponse ,
6262)
6363from ..._compat import cached_property
64+ from .telemetry import (
65+ TelemetryResource ,
66+ AsyncTelemetryResource ,
67+ TelemetryResourceWithRawResponse ,
68+ AsyncTelemetryResourceWithRawResponse ,
69+ TelemetryResourceWithStreamingResponse ,
70+ AsyncTelemetryResourceWithStreamingResponse ,
71+ )
6472from .playwright import (
6573 PlaywrightResource ,
6674 AsyncPlaywrightResource ,
8795from ...types .shared_params .browser_profile import BrowserProfile
8896from ...types .shared_params .browser_viewport import BrowserViewport
8997from ...types .shared_params .browser_extension import BrowserExtension
98+ from ...types .browsers .browser_telemetry_config_param import BrowserTelemetryConfigParam
9099
91100__all__ = ["BrowsersResource" , "AsyncBrowsersResource" ]
92101
93102
94103class BrowsersResource (SyncAPIResource ):
95104 """Create and manage browser sessions."""
96105
106+ @cached_property
107+ def telemetry (self ) -> TelemetryResource :
108+ """Stream live telemetry events from a browser session."""
109+ return TelemetryResource (self ._client )
110+
97111 @cached_property
98112 def replays (self ) -> ReplaysResource :
99113 """Record and manage browser session video replays."""
@@ -156,6 +170,7 @@ def create(
156170 proxy_id : str | Omit = omit ,
157171 start_url : str | Omit = omit ,
158172 stealth : bool | Omit = omit ,
173+ telemetry : Optional [BrowserTelemetryConfigParam ] | Omit = omit ,
159174 timeout_seconds : int | Omit = omit ,
160175 viewport : BrowserViewport | Omit = omit ,
161176 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -204,6 +219,10 @@ def create(
204219 stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
205220 mechanisms.
206221
222+ telemetry: Telemetry configuration for the browser session. If provided, telemetry capture
223+ starts with the specified category filter when the session is created. If
224+ omitted, no telemetry capture is started.
225+
207226 timeout_seconds: The number of seconds of inactivity before the browser session is terminated.
208227 Activity includes CDP connections and live view connections. Defaults to 60
209228 seconds. Minimum allowed is 10 seconds. Maximum allowed is 259200 (72 hours). We
@@ -246,6 +265,7 @@ def create(
246265 "proxy_id" : proxy_id ,
247266 "start_url" : start_url ,
248267 "stealth" : stealth ,
268+ "telemetry" : telemetry ,
249269 "timeout_seconds" : timeout_seconds ,
250270 "viewport" : viewport ,
251271 },
@@ -306,6 +326,7 @@ def update(
306326 disable_default_proxy : bool | Omit = omit ,
307327 profile : BrowserProfile | Omit = omit ,
308328 proxy_id : Optional [str ] | Omit = omit ,
329+ telemetry : Optional [BrowserTelemetryConfigParam ] | Omit = omit ,
309330 viewport : browser_update_params .Viewport | Omit = omit ,
310331 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
311332 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -327,6 +348,11 @@ def update(
327348 proxy_id: ID of the proxy to use. Omit to leave unchanged, set to empty string to remove
328349 proxy.
329350
351+ telemetry: Telemetry configuration. Omit, set to null, or set to an empty object ({}) to
352+ leave the existing configuration unchanged (no-op). To enable capture for all
353+ categories using VM defaults, set browser to an empty object ({"browser": {}}).
354+ To stop capture, set every category's enabled to false.
355+
330356 viewport: Viewport configuration to apply to the browser session.
331357
332358 extra_headers: Send extra headers
@@ -346,6 +372,7 @@ def update(
346372 "disable_default_proxy" : disable_default_proxy ,
347373 "profile" : profile ,
348374 "proxy_id" : proxy_id ,
375+ "telemetry" : telemetry ,
349376 "viewport" : viewport ,
350377 },
351378 browser_update_params .BrowserUpdateParams ,
@@ -608,6 +635,11 @@ def load_extensions(
608635class AsyncBrowsersResource (AsyncAPIResource ):
609636 """Create and manage browser sessions."""
610637
638+ @cached_property
639+ def telemetry (self ) -> AsyncTelemetryResource :
640+ """Stream live telemetry events from a browser session."""
641+ return AsyncTelemetryResource (self ._client )
642+
611643 @cached_property
612644 def replays (self ) -> AsyncReplaysResource :
613645 """Record and manage browser session video replays."""
@@ -670,6 +702,7 @@ async def create(
670702 proxy_id : str | Omit = omit ,
671703 start_url : str | Omit = omit ,
672704 stealth : bool | Omit = omit ,
705+ telemetry : Optional [BrowserTelemetryConfigParam ] | Omit = omit ,
673706 timeout_seconds : int | Omit = omit ,
674707 viewport : BrowserViewport | Omit = omit ,
675708 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -718,6 +751,10 @@ async def create(
718751 stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
719752 mechanisms.
720753
754+ telemetry: Telemetry configuration for the browser session. If provided, telemetry capture
755+ starts with the specified category filter when the session is created. If
756+ omitted, no telemetry capture is started.
757+
721758 timeout_seconds: The number of seconds of inactivity before the browser session is terminated.
722759 Activity includes CDP connections and live view connections. Defaults to 60
723760 seconds. Minimum allowed is 10 seconds. Maximum allowed is 259200 (72 hours). We
@@ -760,6 +797,7 @@ async def create(
760797 "proxy_id" : proxy_id ,
761798 "start_url" : start_url ,
762799 "stealth" : stealth ,
800+ "telemetry" : telemetry ,
763801 "timeout_seconds" : timeout_seconds ,
764802 "viewport" : viewport ,
765803 },
@@ -820,6 +858,7 @@ async def update(
820858 disable_default_proxy : bool | Omit = omit ,
821859 profile : BrowserProfile | Omit = omit ,
822860 proxy_id : Optional [str ] | Omit = omit ,
861+ telemetry : Optional [BrowserTelemetryConfigParam ] | Omit = omit ,
823862 viewport : browser_update_params .Viewport | Omit = omit ,
824863 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
825864 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -841,6 +880,11 @@ async def update(
841880 proxy_id: ID of the proxy to use. Omit to leave unchanged, set to empty string to remove
842881 proxy.
843882
883+ telemetry: Telemetry configuration. Omit, set to null, or set to an empty object ({}) to
884+ leave the existing configuration unchanged (no-op). To enable capture for all
885+ categories using VM defaults, set browser to an empty object ({"browser": {}}).
886+ To stop capture, set every category's enabled to false.
887+
844888 viewport: Viewport configuration to apply to the browser session.
845889
846890 extra_headers: Send extra headers
@@ -860,6 +904,7 @@ async def update(
860904 "disable_default_proxy" : disable_default_proxy ,
861905 "profile" : profile ,
862906 "proxy_id" : proxy_id ,
907+ "telemetry" : telemetry ,
863908 "viewport" : viewport ,
864909 },
865910 browser_update_params .BrowserUpdateParams ,
@@ -1152,6 +1197,11 @@ def __init__(self, browsers: BrowsersResource) -> None:
11521197 browsers .load_extensions ,
11531198 )
11541199
1200+ @cached_property
1201+ def telemetry (self ) -> TelemetryResourceWithRawResponse :
1202+ """Stream live telemetry events from a browser session."""
1203+ return TelemetryResourceWithRawResponse (self ._browsers .telemetry )
1204+
11551205 @cached_property
11561206 def replays (self ) -> ReplaysResourceWithRawResponse :
11571207 """Record and manage browser session video replays."""
@@ -1213,6 +1263,11 @@ def __init__(self, browsers: AsyncBrowsersResource) -> None:
12131263 browsers .load_extensions ,
12141264 )
12151265
1266+ @cached_property
1267+ def telemetry (self ) -> AsyncTelemetryResourceWithRawResponse :
1268+ """Stream live telemetry events from a browser session."""
1269+ return AsyncTelemetryResourceWithRawResponse (self ._browsers .telemetry )
1270+
12161271 @cached_property
12171272 def replays (self ) -> AsyncReplaysResourceWithRawResponse :
12181273 """Record and manage browser session video replays."""
@@ -1274,6 +1329,11 @@ def __init__(self, browsers: BrowsersResource) -> None:
12741329 browsers .load_extensions ,
12751330 )
12761331
1332+ @cached_property
1333+ def telemetry (self ) -> TelemetryResourceWithStreamingResponse :
1334+ """Stream live telemetry events from a browser session."""
1335+ return TelemetryResourceWithStreamingResponse (self ._browsers .telemetry )
1336+
12771337 @cached_property
12781338 def replays (self ) -> ReplaysResourceWithStreamingResponse :
12791339 """Record and manage browser session video replays."""
@@ -1335,6 +1395,11 @@ def __init__(self, browsers: AsyncBrowsersResource) -> None:
13351395 browsers .load_extensions ,
13361396 )
13371397
1398+ @cached_property
1399+ def telemetry (self ) -> AsyncTelemetryResourceWithStreamingResponse :
1400+ """Stream live telemetry events from a browser session."""
1401+ return AsyncTelemetryResourceWithStreamingResponse (self ._browsers .telemetry )
1402+
13381403 @cached_property
13391404 def replays (self ) -> AsyncReplaysResourceWithStreamingResponse :
13401405 """Record and manage browser session video replays."""
0 commit comments