Skip to content

Commit beac2df

Browse files
feat: browser_pools: add start_url config (KERNEL-1217 PR 2)
1 parent b98ed1a commit beac2df

15 files changed

Lines changed: 128 additions & 2 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 112
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-b51c72a040c8dfea9c0693de6631feabfffe42922d5feb60b4ac0ee5c83bb8f4.yml
3-
openapi_spec_hash: 8b671cfe4debe8d9ad7c39ba5b0eaf6d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-7d2d29d7598105d50e5118e0bc5ac654361a92cb95555705dbd1d236848e1456.yml
3+
openapi_spec_hash: 10002eae793e08f81932239bbc72b503
44
config_hash: 08d55086449943a8fec212b870061a3f

src/kernel/resources/browser_pools.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def create(
6868
name: str | Omit = omit,
6969
profile: BrowserProfile | Omit = omit,
7070
proxy_id: str | Omit = omit,
71+
start_url: str | Omit = omit,
7172
stealth: bool | Omit = omit,
7273
timeout_seconds: int | Omit = omit,
7374
viewport: BrowserViewport | Omit = omit,
@@ -109,6 +110,12 @@ def create(
109110
proxy_id: Optional proxy to associate to the browser session. Must reference a proxy
110111
belonging to the caller's org.
111112
113+
start_url: Optional URL to navigate to when a new browser is warmed into the pool.
114+
Best-effort: failures to navigate do not fail pool fill. Only applied to
115+
newly-warmed browsers — browsers reused via release/acquire keep whatever URL
116+
the previous lease left them on. Accepts any URL Chromium can resolve, including
117+
chrome:// pages.
118+
112119
stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
113120
mechanisms.
114121
@@ -149,6 +156,7 @@ def create(
149156
"name": name,
150157
"profile": profile,
151158
"proxy_id": proxy_id,
159+
"start_url": start_url,
152160
"stealth": stealth,
153161
"timeout_seconds": timeout_seconds,
154162
"viewport": viewport,
@@ -208,6 +216,7 @@ def update(
208216
name: str | Omit = omit,
209217
profile: BrowserProfile | Omit = omit,
210218
proxy_id: str | Omit = omit,
219+
start_url: str | Omit = omit,
211220
stealth: bool | Omit = omit,
212221
timeout_seconds: int | Omit = omit,
213222
viewport: BrowserViewport | Omit = omit,
@@ -252,6 +261,12 @@ def update(
252261
proxy_id: Optional proxy to associate to the browser session. Must reference a proxy
253262
belonging to the caller's org.
254263
264+
start_url: Optional URL to navigate to when a new browser is warmed into the pool.
265+
Best-effort: failures to navigate do not fail pool fill. Only applied to
266+
newly-warmed browsers — browsers reused via release/acquire keep whatever URL
267+
the previous lease left them on. Accepts any URL Chromium can resolve, including
268+
chrome:// pages.
269+
255270
stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
256271
mechanisms.
257272
@@ -295,6 +310,7 @@ def update(
295310
"name": name,
296311
"profile": profile,
297312
"proxy_id": proxy_id,
313+
"start_url": start_url,
298314
"stealth": stealth,
299315
"timeout_seconds": timeout_seconds,
300316
"viewport": viewport,
@@ -530,6 +546,7 @@ async def create(
530546
name: str | Omit = omit,
531547
profile: BrowserProfile | Omit = omit,
532548
proxy_id: str | Omit = omit,
549+
start_url: str | Omit = omit,
533550
stealth: bool | Omit = omit,
534551
timeout_seconds: int | Omit = omit,
535552
viewport: BrowserViewport | Omit = omit,
@@ -571,6 +588,12 @@ async def create(
571588
proxy_id: Optional proxy to associate to the browser session. Must reference a proxy
572589
belonging to the caller's org.
573590
591+
start_url: Optional URL to navigate to when a new browser is warmed into the pool.
592+
Best-effort: failures to navigate do not fail pool fill. Only applied to
593+
newly-warmed browsers — browsers reused via release/acquire keep whatever URL
594+
the previous lease left them on. Accepts any URL Chromium can resolve, including
595+
chrome:// pages.
596+
574597
stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
575598
mechanisms.
576599
@@ -611,6 +634,7 @@ async def create(
611634
"name": name,
612635
"profile": profile,
613636
"proxy_id": proxy_id,
637+
"start_url": start_url,
614638
"stealth": stealth,
615639
"timeout_seconds": timeout_seconds,
616640
"viewport": viewport,
@@ -670,6 +694,7 @@ async def update(
670694
name: str | Omit = omit,
671695
profile: BrowserProfile | Omit = omit,
672696
proxy_id: str | Omit = omit,
697+
start_url: str | Omit = omit,
673698
stealth: bool | Omit = omit,
674699
timeout_seconds: int | Omit = omit,
675700
viewport: BrowserViewport | Omit = omit,
@@ -714,6 +739,12 @@ async def update(
714739
proxy_id: Optional proxy to associate to the browser session. Must reference a proxy
715740
belonging to the caller's org.
716741
742+
start_url: Optional URL to navigate to when a new browser is warmed into the pool.
743+
Best-effort: failures to navigate do not fail pool fill. Only applied to
744+
newly-warmed browsers — browsers reused via release/acquire keep whatever URL
745+
the previous lease left them on. Accepts any URL Chromium can resolve, including
746+
chrome:// pages.
747+
717748
stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
718749
mechanisms.
719750
@@ -757,6 +788,7 @@ async def update(
757788
"name": name,
758789
"profile": profile,
759790
"proxy_id": proxy_id,
791+
"start_url": start_url,
760792
"stealth": stealth,
761793
"timeout_seconds": timeout_seconds,
762794
"viewport": viewport,

src/kernel/resources/browsers/browsers.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def create(
153153
persistence: BrowserPersistenceParam | Omit = omit,
154154
profile: BrowserProfile | Omit = omit,
155155
proxy_id: str | Omit = omit,
156+
start_url: str | Omit = omit,
156157
stealth: bool | Omit = omit,
157158
timeout_seconds: int | Omit = omit,
158159
viewport: BrowserViewport | Omit = omit,
@@ -189,6 +190,12 @@ def create(
189190
proxy_id: Optional proxy to associate to the browser session. Must reference a proxy
190191
belonging to the caller's org.
191192
193+
start_url: Optional URL to navigate to immediately after the browser is created.
194+
Best-effort: failures to navigate do not fail browser creation. Any pre-existing
195+
tabs are reduced to a single tab which is then navigated. Accepts any URL
196+
Chromium can resolve, including chrome:// pages. Ignored when reusing an
197+
existing persistent session.
198+
192199
stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
193200
mechanisms.
194201
@@ -231,6 +238,7 @@ def create(
231238
"persistence": persistence,
232239
"profile": profile,
233240
"proxy_id": proxy_id,
241+
"start_url": start_url,
234242
"stealth": stealth,
235243
"timeout_seconds": timeout_seconds,
236244
"viewport": viewport,
@@ -653,6 +661,7 @@ async def create(
653661
persistence: BrowserPersistenceParam | Omit = omit,
654662
profile: BrowserProfile | Omit = omit,
655663
proxy_id: str | Omit = omit,
664+
start_url: str | Omit = omit,
656665
stealth: bool | Omit = omit,
657666
timeout_seconds: int | Omit = omit,
658667
viewport: BrowserViewport | Omit = omit,
@@ -689,6 +698,12 @@ async def create(
689698
proxy_id: Optional proxy to associate to the browser session. Must reference a proxy
690699
belonging to the caller's org.
691700
701+
start_url: Optional URL to navigate to immediately after the browser is created.
702+
Best-effort: failures to navigate do not fail browser creation. Any pre-existing
703+
tabs are reduced to a single tab which is then navigated. Accepts any URL
704+
Chromium can resolve, including chrome:// pages. Ignored when reusing an
705+
existing persistent session.
706+
692707
stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
693708
mechanisms.
694709
@@ -731,6 +746,7 @@ async def create(
731746
"persistence": persistence,
732747
"profile": profile,
733748
"proxy_id": proxy_id,
749+
"start_url": start_url,
734750
"stealth": stealth,
735751
"timeout_seconds": timeout_seconds,
736752
"viewport": viewport,

src/kernel/types/browser_create_params.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ class BrowserCreateParams(TypedDict, total=False):
5757
Must reference a proxy belonging to the caller's org.
5858
"""
5959

60+
start_url: str
61+
"""Optional URL to navigate to immediately after the browser is created.
62+
63+
Best-effort: failures to navigate do not fail browser creation. Any pre-existing
64+
tabs are reduced to a single tab which is then navigated. Accepts any URL
65+
Chromium can resolve, including chrome:// pages. Ignored when reusing an
66+
existing persistent session.
67+
"""
68+
6069
stealth: bool
6170
"""
6271
If true, launches the browser in stealth mode to reduce detection by anti-bot

src/kernel/types/browser_create_response.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ class BrowserCreateResponse(BaseModel):
6868
proxy_id: Optional[str] = None
6969
"""ID of the proxy associated with this browser session, if any."""
7070

71+
start_url: Optional[str] = None
72+
"""URL the session was asked to navigate to on creation, if any.
73+
74+
Recorded for debugging — navigation is best-effort and may have failed.
75+
"""
76+
7177
usage: Optional[BrowserUsage] = None
7278
"""Session usage metrics."""
7379

src/kernel/types/browser_list_response.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ class BrowserListResponse(BaseModel):
6868
proxy_id: Optional[str] = None
6969
"""ID of the proxy associated with this browser session, if any."""
7070

71+
start_url: Optional[str] = None
72+
"""URL the session was asked to navigate to on creation, if any.
73+
74+
Recorded for debugging — navigation is best-effort and may have failed.
75+
"""
76+
7177
usage: Optional[BrowserUsage] = None
7278
"""Session usage metrics."""
7379

src/kernel/types/browser_pool.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ class BrowserPoolConfig(BaseModel):
6363
Must reference a proxy belonging to the caller's org.
6464
"""
6565

66+
start_url: Optional[str] = None
67+
"""Optional URL to navigate to when a new browser is warmed into the pool.
68+
69+
Best-effort: failures to navigate do not fail pool fill. Only applied to
70+
newly-warmed browsers — browsers reused via release/acquire keep whatever URL
71+
the previous lease left them on. Accepts any URL Chromium can resolve, including
72+
chrome:// pages.
73+
"""
74+
6675
stealth: Optional[bool] = None
6776
"""
6877
If true, launches the browser in stealth mode to reduce detection by anti-bot

src/kernel/types/browser_pool_acquire_response.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ class BrowserPoolAcquireResponse(BaseModel):
6868
proxy_id: Optional[str] = None
6969
"""ID of the proxy associated with this browser session, if any."""
7070

71+
start_url: Optional[str] = None
72+
"""URL the session was asked to navigate to on creation, if any.
73+
74+
Recorded for debugging — navigation is best-effort and may have failed.
75+
"""
76+
7177
usage: Optional[BrowserUsage] = None
7278
"""Session usage metrics."""
7379

src/kernel/types/browser_pool_create_params.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ class BrowserPoolCreateParams(TypedDict, total=False):
6262
Must reference a proxy belonging to the caller's org.
6363
"""
6464

65+
start_url: str
66+
"""Optional URL to navigate to when a new browser is warmed into the pool.
67+
68+
Best-effort: failures to navigate do not fail pool fill. Only applied to
69+
newly-warmed browsers — browsers reused via release/acquire keep whatever URL
70+
the previous lease left them on. Accepts any URL Chromium can resolve, including
71+
chrome:// pages.
72+
"""
73+
6574
stealth: bool
6675
"""
6776
If true, launches the browser in stealth mode to reduce detection by anti-bot

src/kernel/types/browser_pool_update_params.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ class BrowserPoolUpdateParams(TypedDict, total=False):
6868
Must reference a proxy belonging to the caller's org.
6969
"""
7070

71+
start_url: str
72+
"""Optional URL to navigate to when a new browser is warmed into the pool.
73+
74+
Best-effort: failures to navigate do not fail pool fill. Only applied to
75+
newly-warmed browsers — browsers reused via release/acquire keep whatever URL
76+
the previous lease left them on. Accepts any URL Chromium can resolve, including
77+
chrome:// pages.
78+
"""
79+
7180
stealth: bool
7281
"""
7382
If true, launches the browser in stealth mode to reduce detection by anti-bot

0 commit comments

Comments
 (0)