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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ONKERNEL_API_KEY=
REBROWSER_API_KEY=
STEEL_API_KEY=
DRIVER_API_KEY=
STRING_API_KEY=

# Optional: save scores and text/tool traces in your private Laminar project
# Install with: uv sync --frozen --extra laminar
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ cp .env.example .env
uv run python run_eval.py --benchmark Stealth_Bench_V1 --browser <provider>
```

Available providers: `browser-use-cloud`, `anchor`, `browserbase`, `browserless`, `hyperbrowser`, `onkernel`, `steel`, `local_headful`, `local_headless`
Available providers: `browser-use-cloud`, `anchor`, `browserbase`, `browserless`, `driver`, `hyperbrowser`, `onkernel`, `rebrowser`, `steel`, `string`, `local_headful`, `local_headless`

**Results and official data:** [`stealth_bench/`](stealth_bench/)

Expand Down
3 changes: 3 additions & 0 deletions browsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
onkernel,
rebrowser,
steel,
string,
)

PROVIDERS = [
Expand All @@ -28,6 +29,7 @@
"onkernel",
"rebrowser",
"steel",
"string",
]

BROWSERS = {
Expand All @@ -42,6 +44,7 @@
"onkernel": onkernel,
"rebrowser": rebrowser,
"steel": steel,
"string": string,
}


Expand Down
37 changes: 37 additions & 0 deletions browsers/string.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""String -- https://usestring.ai

Default (residential) proxy and captcha solving.
Requires: STRING_API_KEY env var. STRING_CDP_URL optionally overrides the endpoint.

There is no session API: connecting to the CDP WebSocket starts a fresh browser,
and closing the connection (browser.stop()) ends it. The API key is sent as an
Authorization header on the WebSocket handshake rather than in the URL.
"""

import os
from urllib.parse import parse_qsl, urlencode, urlsplit, urlunsplit

DEFAULT_CDP_URL = "wss://request.usestring.ai/v1/wss"

SETTINGS = {"solveCaptcha": "true"}


def headers() -> dict[str, str]:
return {"Authorization": f"Bearer {os.environ['STRING_API_KEY']}"}


async def connect() -> str:
parts = urlsplit(os.environ.get("STRING_CDP_URL") or DEFAULT_CDP_URL)
# Keep the override's own parameters as given, blank and repeated ones
# included, and replace only the keys this benchmark sets.
query = [
(key, value)
for key, value in parse_qsl(parts.query, keep_blank_values=True)
if key not in SETTINGS
]
query.extend(SETTINGS.items())
return urlunsplit(parts._replace(query=urlencode(query)))


async def disconnect() -> None:
pass
3 changes: 2 additions & 1 deletion frameworks/browser_use/run_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ async def execute(
try:
cdp_url = await provider.connect()
if cdp_url:
browser = Browser(cdp_url=cdp_url)
headers = getattr(provider, "headers", None)
browser = Browser(cdp_url=cdp_url, headers=headers() if headers else None)
else:
headless = getattr(provider, "HEADLESS", True)
browser = Browser(headless=headless)
Expand Down
4 changes: 3 additions & 1 deletion run_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ async def create_browser(
cdp_url = await browser_provider.connect()
if cdp_url is None:
return Browser(headless=getattr(browser_provider, "HEADLESS", True))
return Browser(cdp_url=cdp_url)
# Providers that authenticate the CDP handshake expose headers().
headers = getattr(browser_provider, "headers", None)
return Browser(cdp_url=cdp_url, headers=headers() if headers else None)


async def run_task(
Expand Down