Skip to content

Commit c34882c

Browse files
feat: Deprecate datacenter proxies in the API
Stainless-Generated-From: 93ad1fda4dfb667b50676addc3ff6c415d10cc06
1 parent 465ee69 commit c34882c

19 files changed

Lines changed: 130 additions & 199 deletions

‎api.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ from kernel.types import (
120120
BrowserMemory,
121121
BrowserMemoryRequest,
122122
BrowserNetworkConfig,
123+
BrowserNetworkUpdate,
123124
BrowserPoolRef,
124125
BrowserProxy,
125126
BrowserProxyConfig,

‎src/kernel/resources/browsers/browsers.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
from ...types.browser_retrieve_response import BrowserRetrieveResponse
113113
from ...types.browser_proxy_config_param import BrowserProxyConfigParam
114114
from ...types.browser_network_config_param import BrowserNetworkConfigParam
115+
from ...types.browser_network_update_param import BrowserNetworkUpdateParam
115116
from ...types.shared_params.browser_profile import BrowserProfile
116117
from ...types.shared_params.browser_viewport import BrowserViewport
117118
from ...types.shared_params.browser_extension import BrowserExtension
@@ -241,7 +242,8 @@ def create(
241242
the dashboard. Must be unique among active sessions within the project. Can be
242243
changed later via PATCH /browsers/{id_or_name}.
243244
244-
network: Network configuration for the browser session. Cannot be changed after creation.
245+
network: Network configuration for the browser session. Only allowed_hosts can be changed
246+
after creation, with PATCH /browsers/{id_or_name}.
245247
246248
profile: Profile selection for the browser session. Provide either id or name. If
247249
specified, the matching profile will be loaded into the browser session.
@@ -393,6 +395,7 @@ def update(
393395
*,
394396
disable_default_proxy: bool | Omit = omit,
395397
name: Optional[str] | Omit = omit,
398+
network: BrowserNetworkUpdateParam | Omit = omit,
396399
profile: BrowserProfile | Omit = omit,
397400
proxy: BrowserProxyConfigParam | Omit = omit,
398401
proxy_id: Optional[str] | Omit = omit,
@@ -418,6 +421,8 @@ def update(
418421
empty string to clear the name. When set, must be unique among active sessions
419422
within the project.
420423
424+
network: Network configuration changes to apply to the running browser session.
425+
421426
profile: Profile to load into the browser session. Only allowed if the session does not
422427
already have a profile loaded.
423428
@@ -464,6 +469,7 @@ def update(
464469
{
465470
"disable_default_proxy": disable_default_proxy,
466471
"name": name,
472+
"network": network,
467473
"profile": profile,
468474
"proxy": proxy,
469475
"proxy_id": proxy_id,
@@ -945,7 +951,8 @@ async def create(
945951
the dashboard. Must be unique among active sessions within the project. Can be
946952
changed later via PATCH /browsers/{id_or_name}.
947953
948-
network: Network configuration for the browser session. Cannot be changed after creation.
954+
network: Network configuration for the browser session. Only allowed_hosts can be changed
955+
after creation, with PATCH /browsers/{id_or_name}.
949956
950957
profile: Profile selection for the browser session. Provide either id or name. If
951958
specified, the matching profile will be loaded into the browser session.
@@ -1097,6 +1104,7 @@ async def update(
10971104
*,
10981105
disable_default_proxy: bool | Omit = omit,
10991106
name: Optional[str] | Omit = omit,
1107+
network: BrowserNetworkUpdateParam | Omit = omit,
11001108
profile: BrowserProfile | Omit = omit,
11011109
proxy: BrowserProxyConfigParam | Omit = omit,
11021110
proxy_id: Optional[str] | Omit = omit,
@@ -1122,6 +1130,8 @@ async def update(
11221130
empty string to clear the name. When set, must be unique among active sessions
11231131
within the project.
11241132
1133+
network: Network configuration changes to apply to the running browser session.
1134+
11251135
profile: Profile to load into the browser session. Only allowed if the session does not
11261136
already have a profile loaded.
11271137
@@ -1168,6 +1178,7 @@ async def update(
11681178
{
11691179
"disable_default_proxy": disable_default_proxy,
11701180
"name": name,
1181+
"network": network,
11711182
"profile": profile,
11721183
"proxy": proxy,
11731184
"proxy_id": proxy_id,

‎src/kernel/resources/proxies.py‎

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def with_streaming_response(self) -> ProxiesResourceWithStreamingResponse:
5353
def create(
5454
self,
5555
*,
56-
type: Literal["datacenter", "isp", "residential", "mobile", "custom"],
56+
type: Literal["isp", "residential", "mobile", "custom"],
5757
bypass_hosts: SequenceNotStr[str] | Omit = omit,
5858
config: proxy_create_params.Config | Omit = omit,
5959
name: str | Omit = omit,
@@ -69,12 +69,9 @@ def create(
6969
Create a new proxy configuration in the resolved project.
7070
7171
Args:
72-
type: Proxy type to use. In terms of quality for avoiding bot-detection, from best to
73-
worst: `mobile` > `residential` > `isp` > `datacenter`.
74-
7572
bypass_hosts: Hostnames that should bypass the parent proxy and connect directly.
7673
77-
config: Configuration specific to the selected proxy `type`.
74+
config: Configuration for an ISP proxy.
7875
7976
name: Readable name of the proxy.
8077
@@ -292,25 +289,25 @@ def check(
292289
"""Run a health check on the proxy to verify it's working.
293290
294291
Optionally specify a URL
295-
to test reachability against a specific target. For ISP and datacenter proxies,
296-
this reliably tests whether the target site is reachable from the proxy's stable
297-
exit IP. For residential and mobile proxies, the exit node varies between
298-
requests, so this validates proxy configuration and connectivity rather than
299-
guaranteeing site-specific reachability.
292+
to test reachability against a specific target. For ISP proxies, this reliably
293+
tests whether the target site is reachable from the proxy's stable exit IP. For
294+
residential and mobile proxies, the exit node varies between requests, so this
295+
validates proxy configuration and connectivity rather than guaranteeing
296+
site-specific reachability.
300297
301298
Args:
302299
url: An optional URL to test reachability against. If provided, the proxy check will
303300
test connectivity to this URL instead of the default test URLs. Only HTTP and
304301
HTTPS schemes are allowed, and the URL must resolve to a public IP address. For
305-
ISP and datacenter proxies, the exit IP is stable, so a successful check
306-
reliably indicates that subsequent browser sessions will reach the target site
307-
with the same IP. For residential and mobile proxies, the exit node changes
308-
between requests, so a successful check validates proxy configuration but does
309-
not guarantee that a subsequent browser session will use the same exit IP or
310-
reach the same site — it is useful for verifying credentials and connectivity,
311-
not for predicting site-specific behavior. When provided, the check result does
312-
not update the proxy's health status, since a failure may indicate a problem
313-
with the target site rather than the proxy itself.
302+
ISP proxies, the exit IP is stable, so a successful check reliably indicates
303+
that subsequent browser sessions will reach the target site with the same IP.
304+
For residential and mobile proxies, the exit node changes between requests, so a
305+
successful check validates proxy configuration but does not guarantee that a
306+
subsequent browser session will use the same exit IP or reach the same site — it
307+
is useful for verifying credentials and connectivity, not for predicting
308+
site-specific behavior. When provided, the check result does not update the
309+
proxy's health status, since a failure may indicate a problem with the target
310+
site rather than the proxy itself.
314311
315312
extra_headers: Send extra headers
316313
@@ -357,7 +354,7 @@ def with_streaming_response(self) -> AsyncProxiesResourceWithStreamingResponse:
357354
async def create(
358355
self,
359356
*,
360-
type: Literal["datacenter", "isp", "residential", "mobile", "custom"],
357+
type: Literal["isp", "residential", "mobile", "custom"],
361358
bypass_hosts: SequenceNotStr[str] | Omit = omit,
362359
config: proxy_create_params.Config | Omit = omit,
363360
name: str | Omit = omit,
@@ -373,12 +370,9 @@ async def create(
373370
Create a new proxy configuration in the resolved project.
374371
375372
Args:
376-
type: Proxy type to use. In terms of quality for avoiding bot-detection, from best to
377-
worst: `mobile` > `residential` > `isp` > `datacenter`.
378-
379373
bypass_hosts: Hostnames that should bypass the parent proxy and connect directly.
380374
381-
config: Configuration specific to the selected proxy `type`.
375+
config: Configuration for an ISP proxy.
382376
383377
name: Readable name of the proxy.
384378
@@ -596,25 +590,25 @@ async def check(
596590
"""Run a health check on the proxy to verify it's working.
597591
598592
Optionally specify a URL
599-
to test reachability against a specific target. For ISP and datacenter proxies,
600-
this reliably tests whether the target site is reachable from the proxy's stable
601-
exit IP. For residential and mobile proxies, the exit node varies between
602-
requests, so this validates proxy configuration and connectivity rather than
603-
guaranteeing site-specific reachability.
593+
to test reachability against a specific target. For ISP proxies, this reliably
594+
tests whether the target site is reachable from the proxy's stable exit IP. For
595+
residential and mobile proxies, the exit node varies between requests, so this
596+
validates proxy configuration and connectivity rather than guaranteeing
597+
site-specific reachability.
604598
605599
Args:
606600
url: An optional URL to test reachability against. If provided, the proxy check will
607601
test connectivity to this URL instead of the default test URLs. Only HTTP and
608602
HTTPS schemes are allowed, and the URL must resolve to a public IP address. For
609-
ISP and datacenter proxies, the exit IP is stable, so a successful check
610-
reliably indicates that subsequent browser sessions will reach the target site
611-
with the same IP. For residential and mobile proxies, the exit node changes
612-
between requests, so a successful check validates proxy configuration but does
613-
not guarantee that a subsequent browser session will use the same exit IP or
614-
reach the same site — it is useful for verifying credentials and connectivity,
615-
not for predicting site-specific behavior. When provided, the check result does
616-
not update the proxy's health status, since a failure may indicate a problem
617-
with the target site rather than the proxy itself.
603+
ISP proxies, the exit IP is stable, so a successful check reliably indicates
604+
that subsequent browser sessions will reach the target site with the same IP.
605+
For residential and mobile proxies, the exit node changes between requests, so a
606+
successful check validates proxy configuration but does not guarantee that a
607+
subsequent browser session will use the same exit IP or reach the same site — it
608+
is useful for verifying credentials and connectivity, not for predicting
609+
site-specific behavior. When provided, the check result does not update the
610+
proxy's health status, since a failure may indicate a problem with the target
611+
site rather than the proxy itself.
618612
619613
extra_headers: Send extra headers
620614

‎src/kernel/types/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
from .browser_pool_release_params import BrowserPoolReleaseParams as BrowserPoolReleaseParams
133133
from .config_registry_list_params import ConfigRegistryListParams as ConfigRegistryListParams
134134
from .browser_network_config_param import BrowserNetworkConfigParam as BrowserNetworkConfigParam
135+
from .browser_network_update_param import BrowserNetworkUpdateParam as BrowserNetworkUpdateParam
135136
from .deployment_retrieve_response import DeploymentRetrieveResponse as DeploymentRetrieveResponse
136137
from .invocation_retrieve_response import InvocationRetrieveResponse as InvocationRetrieveResponse
137138
from .audit_log_export_chunk_params import AuditLogExportChunkParams as AuditLogExportChunkParams

‎src/kernel/types/browser_create_params.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ class BrowserCreateParams(TypedDict, total=False):
7474
network: BrowserNetworkConfigParam
7575
"""Network configuration for the browser session.
7676
77-
Cannot be changed after creation.
77+
Only allowed_hosts can be changed after creation, with PATCH
78+
/browsers/{id_or_name}.
7879
"""
7980

8081
profile: BrowserProfile

‎src/kernel/types/browser_network_config.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ class BrowserNetworkConfig(BaseModel):
5050
or reserved IP ranges are rejected, as are entries that overlap private_hosts.
5151
Enforced at Kernel's egress proxy only: destinations in private_hosts, and
5252
processes in the browser VM that do not use the browser's proxy, are not
53-
filtered, and Kernel's own control traffic is always allowed. Requires proxy v3.
54-
Not supported on browser pools.
53+
filtered, and Kernel's own control traffic is always allowed. Can be replaced or
54+
removed while the session runs with PATCH /browsers/{id_or_name}. Requires proxy
55+
v3. Not supported on browser pools.
5556
"""
5657

5758
private_hosts: Optional[List[str]] = None

‎src/kernel/types/browser_network_config_param.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ class BrowserNetworkConfigParam(TypedDict, total=False):
5353
or reserved IP ranges are rejected, as are entries that overlap private_hosts.
5454
Enforced at Kernel's egress proxy only: destinations in private_hosts, and
5555
processes in the browser VM that do not use the browser's proxy, are not
56-
filtered, and Kernel's own control traffic is always allowed. Requires proxy v3.
57-
Not supported on browser pools.
56+
filtered, and Kernel's own control traffic is always allowed. Can be replaced or
57+
removed while the session runs with PATCH /browsers/{id_or_name}. Requires proxy
58+
v3. Not supported on browser pools.
5859
"""
5960

6061
private_hosts: SequenceNotStr[str]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Optional
6+
from typing_extensions import TypedDict
7+
8+
from .._types import SequenceNotStr
9+
10+
__all__ = ["BrowserNetworkUpdateParam"]
11+
12+
13+
class BrowserNetworkUpdateParam(TypedDict, total=False):
14+
"""Network configuration changes for a running browser session.
15+
16+
Other network settings can only be set at creation.
17+
"""
18+
19+
allowed_hosts: Optional[SequenceNotStr[str]]
20+
"""
21+
Replaces the session's egress allowlist, using the same entry rules as
22+
network.allowed_hosts on create. Omit to leave the allowlist unchanged, or set
23+
to null to remove it and return to unfiltered egress; an empty list is invalid.
24+
The new list applies without restarting the browser: new requests to
25+
destinations it no longer allows are refused within a few seconds, and open
26+
connections to them are closed within about 30 seconds, or up to 10 minutes
27+
during a Kernel deploy. Connections to destinations it still allows, such as
28+
WebSockets, stay open. A start_url in the same request must be allowed by the
29+
updated list, and is loaded only after the list takes effect. Requires a browser
30+
created with proxy v3, and not supported on pooled browsers. If the request
31+
fails, retry it: the new list may already apply to some requests.
32+
"""

‎src/kernel/types/browser_update_params.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from .tags_param import TagsParam
99
from .browser_proxy_config_param import BrowserProxyConfigParam
10+
from .browser_network_update_param import BrowserNetworkUpdateParam
1011
from .shared_params.browser_profile import BrowserProfile
1112
from .shared_params.browser_viewport import BrowserViewport
1213
from .browsers.browser_telemetry_categories_config_param import BrowserTelemetryCategoriesConfigParam
@@ -36,6 +37,9 @@ class BrowserUpdateParams(TypedDict, total=False):
3637
must be unique among active sessions within the project.
3738
"""
3839

40+
network: BrowserNetworkUpdateParam
41+
"""Network configuration changes to apply to the running browser session."""
42+
3943
profile: BrowserProfile
4044
"""Profile to load into the browser session.
4145

‎src/kernel/types/proxy.py‎

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"ConfigRegistryManagedProxy",
1313
"ConfigRegistryManagedProxyCreate",
1414
"ConfigRegistryManagedProxyCreateConfig",
15-
"ConfigRegistryManagedProxyCreateConfigDatacenterProxyConfig",
1615
"ConfigRegistryManagedProxyCreateConfigIspProxyConfig",
1716
"ConfigRegistryManagedProxyCreateConfigResidentialProxyConfig",
1817
"ConfigRegistryManagedProxyCreateConfigMobileProxyConfig",
@@ -26,13 +25,6 @@ class ConfigRegistryDirectProxy(BaseModel):
2625
mode: Literal["direct"]
2726

2827

29-
class ConfigRegistryManagedProxyCreateConfigDatacenterProxyConfig(BaseModel):
30-
"""Configuration for a datacenter proxy."""
31-
32-
country: Optional[str] = None
33-
"""ISO 3166 country code. Defaults to US if not provided."""
34-
35-
3628
class ConfigRegistryManagedProxyCreateConfigIspProxyConfig(BaseModel):
3729
"""Configuration for an ISP proxy."""
3830

@@ -111,7 +103,6 @@ class ConfigRegistryManagedProxyCreateConfigCreateCustomProxyConfig(BaseModel):
111103

112104

113105
ConfigRegistryManagedProxyCreateConfig: TypeAlias = Union[
114-
ConfigRegistryManagedProxyCreateConfigDatacenterProxyConfig,
115106
ConfigRegistryManagedProxyCreateConfigIspProxyConfig,
116107
ConfigRegistryManagedProxyCreateConfigResidentialProxyConfig,
117108
ConfigRegistryManagedProxyCreateConfigMobileProxyConfig,
@@ -122,18 +113,13 @@ class ConfigRegistryManagedProxyCreateConfigCreateCustomProxyConfig(BaseModel):
122113
class ConfigRegistryManagedProxyCreate(BaseModel):
123114
"""Configuration for routing traffic through a proxy."""
124115

125-
type: Literal["datacenter", "isp", "residential", "mobile", "custom"]
126-
"""Proxy type to use.
127-
128-
In terms of quality for avoiding bot-detection, from best to worst: `mobile` >
129-
`residential` > `isp` > `datacenter`.
130-
"""
116+
type: Literal["isp", "residential", "mobile", "custom"]
131117

132118
bypass_hosts: Optional[List[str]] = None
133119
"""Hostnames that should bypass the parent proxy and connect directly."""
134120

135121
config: Optional[ConfigRegistryManagedProxyCreateConfig] = None
136-
"""Configuration specific to the selected proxy `type`."""
122+
"""Configuration for an ISP proxy."""
137123

138124
name: Optional[str] = None
139125
"""Readable name of the proxy."""

0 commit comments

Comments
 (0)