Python cloud SDK
stealth_browser is the Python client for the platform API: hosted Agent runs, cloud browsers
driven through the observation object, and the project's resources. Standard library only,
Python ≥ 3.10, synchronous (StealthBrowser) with an asyncio facade (AsyncStealthBrowser,
below). It mirrors the JavaScript client
resource for resource; the one difference is that it does not run the platform contracts locally,
so a bad request is reported by the API rather than before sending. It is not packaged for PyPI
yet; publishing waits for the platform launch. Until then, put sdks/python on sys.path.
import os
from stealth_browser import StealthBrowser, StealthApiError
client = StealthBrowser(os.environ["STEALTH_API_KEY"], base_url="https://…")
# A hosted Agent run: create, wait, read the result; on_event streams progress.
run = client.run("Find the cheapest 14\" laptop on the fixture site and report it.", judge=True,
on_event=lambda event: print(event["type"]))
print(run["status"], run["output"], run.get("data"), run.get("judgment"), run["usage"]) # data: only with output_schema
# A cloud browser, step by step, by ref.
browser = client.browsers.create({"settings": {"locale": "en-US"}})
browser.ready()
browser.navigate("https://example.com")
state = browser.observe(boxes=True) # tree with [ref=eN], targets, tabs, dialogs, downloads
link = next((t for t in state["targets"] if t["role"] == "link"), None)
if link:
browser.click(link["ref"]) # observation frames are handled inside
text = browser.text(format="markdown")["text"]
matches = browser.find(role="button", name="sign in")["matches"]
browser.stop()
Client
StealthBrowser(api_key, base_url=..., timeout=60.0, retries=2, opener=None). The key's project
is the project. timeout bounds each request; retries applies to idempotent requests only
(GETs and creates, which carry an Idempotency-Key). Environment proxies are ignored unless you
pass your own urllib.request opener.
browser.resolve_challenge() uses the operator-configured service once per browser; the
evidenced bridge is BOSS login Yidun v5 on 2Captcha. Use a client timeout of at least 160
seconds. Only reply["result"]["status"] == "verified" establishes website acceptance.
The client drops a consumed frame when observation_invalidated is true even if the mutation
returns a result. Operator keys and validation proofs are excluded. SMS/QR identity is separate.
asyncio
AsyncStealthBrowser is the same client, awaitable: every method is a coroutine, events is
an async iterator, browsers.create / attach give an AsyncCloudBrowser. It is a facade over
the synchronous client, not a second transport — each call runs the verified synchronous
implementation in a worker thread (asyncio.to_thread), so await never blocks the event loop
and asyncio.gather runs calls concurrently, while retries, idempotency and frame handling stay
the one code path the suite pins. Standard library only.
import asyncio
from stealth_browser import AsyncStealthBrowser
async def main():
async with AsyncStealthBrowser(os.environ["STEALTH_API_KEY"], base_url="http://127.0.0.1:48633") as client:
run = await client.runs.create({"task": "Open https://example.com and report the title."})
async for event in client.runs.events(run["id"]):
print(event["type"])
browser = await client.browsers.create()
await browser.ready()
state = await browser.observe()
await browser.stop()
asyncio.run(main())
| Surface | Methods |
|---|---|
client.run(task, **fields, poll_interval=, timeout=, on_event=) |
Create and wait; fields are run fields (model_id, session_id, workspace_id, profile_id, judge, allowed_domains, …) |
client.runs |
create, get, list, cancel, wait, events (generator), message(run_id, text) (queued for the agent's next step while the run runs), withdraw_message(run_id, message_id) |
client.billing |
get (the project's payer: balance, paid credit, concurrency; the project's month to date and budget), set_budget(usd or None), statement(month) (per unit, model and basis, with the platform fee), ledger(limit), rates — USD, integer micro-USD with a string beside it. A top-up is the signed-in account's action in the console; a key cannot buy credit |
client.agent_sessions, client.models() |
list, get, rename(id, title), delete(id) (soft; a run in flight is cancelled first; idempotent), purge(id) (zero-data-retention projects); the catalog |
client.browsers |
create → CloudBrowser, attach, get, list, stop, queue (the admission line: its length and this project's places) |
client.assets |
list, get, text, content (bytes), retry |
client.profiles |
list, create, get, update, import_state, save |
client.workspaces |
list, create, get, update, sessions; files.list/upload/download/text/move/folder/delete/archive |
client.schedules |
list, get, history, preview, run_now |
client.integrations, client.proxies, client.history, client.usage, client.project |
list/get; policy/credentials; list(**query); get(days=); current |
client.request(method, path, body=, query=, ...) |
Any other route, with the same errors and retries |
verify_webhook(body, headers, secret) |
Standard Webhooks v1 check; returns the event or raises webhook_signature |
CloudBrowser: ready, navigate, observe(boxes=, attributes=), preview, snapshot,
act(name, params) plus click, type, select, press, scroll, hover, wait,
click_at, insert_text, back, forward, reload, switch_tab, close_tab, new_tab, dialog_policy,
the read-only find(**query) and text(format=, max_chars=), and events, control, network_test, assets,
stop. Frames, stale-frame retries and the read-only/page-changing distinction work as in the
JavaScript client.
Errors and streams
Every failure is a StealthApiError with status, code, request_id, details and local.
events() and on_event use the API's server-sent events when offered (and not refused with
rate_limited, the API's bound on open streams per key and project) and fall back to cursor
polling; client.diagnostics counts both.
Tests
python3 -m unittest discover -s sdks/python/tests -t sdks/python runs the suite against an
in-process fake API; the repository test runner wraps it (tests/unit/python-sdk.test.js) and
drives the client against a real platform and Camoufox in tests/e2e/python-sdk.test.js.
Metadata
Release files for stealth-browser-cloud-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stealth_browser_cloud_sdk-0.1.0.tar.gz | 19.2 kB | Without provenance | Details for stealth_browser_cloud_sdk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stealth_browser_cloud_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for stealth_browser_cloud_sdk-0.1.0-py3-none-any.whl |
Total release size: 36.6 kB
Release files / stealth_browser_cloud_sdk-0.1.0.tar.gz
| Download URL | stealth_browser_cloud_sdk-0.1.0.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea54096fc80dadb4ea533ad1c8374e93cdcc92a3c4f6c70311882fa3f15320d5
|
|
BLAKE2b-256 checksum How to use checksums |
9f8e2efdd621f1e702b19e0ca101f09d0a10487e306efaa2b2dbaba8b0944893
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.11
|
Release files / stealth_browser_cloud_sdk-0.1.0-py3-none-any.whl
| Download URL | stealth_browser_cloud_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47d4ccd8f61f092c6d757e1a725a234ff56aa704274c1f41271e7ab4ee87086b
|
|
BLAKE2b-256 checksum How to use checksums |
6ed7410dcc68aef9e3c35a6f94545682e9bc01ea6c6858b7601a5df0c99fc9e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.11
|
Security for stealth-browser-cloud-sdk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.