agentbay-lite
Minimal cloud browser SDK for AgentBay (Alibaba Cloud Wuying) — session lifecycle management via CDP.
- Lightweight: only
httpx+pydantic, no Alibaba Cloud SDK dependency - Sync & Async:
AgentBayCloudandAsyncAgentBayCloudclients - Context manager: sessions auto-delete on exit
- Alibaba Cloud RPC: proper Bearer token auth with Timestamp/SignatureNonce
- Unified interface: same API shape as browser-use-lite, skyvern-lite, airtop-lite
Install
pip install agentbay-lite
Quick Start
from agentbay_lite import AgentBayCloud
client = AgentBayCloud(api_key="...") # or set AGENTBAY_API_KEY env var
# Create a cloud browser session (3-step RPC: CreateMcpSession -> InitBrowser -> GetCdpLink)
session = client.sessions.create()
print(session.cdp_url) # wss://...
print(session.session_id)
# Use with Playwright (or any CDP client)
from playwright.sync_api import sync_playwright
with sync_playwright() as pw:
browser = pw.chromium.connect_over_cdp(session.cdp_url)
page = browser.contexts[0].new_page()
page.goto("https://example.com")
# Cleanup
client.sessions.delete(session.session_id)
client.close()
Context Manager
with AgentBayCloud(api_key="...") as client:
with client.sessions.create() as session:
... # session auto-deleted on exit
Async
import asyncio
from agentbay_lite import AsyncAgentBayCloud
async def main():
async with AsyncAgentBayCloud(api_key="...") as client:
session = await client.sessions.create()
print(session.cdp_url)
await client.sessions.delete(session.session_id)
asyncio.run(main())
Features
| Feature | Usage |
|---|---|
| Stealth mode | create(browser_mode="stealth") |
| Custom proxy | create(proxy=ProxyConfig(server="http://...")) |
| Managed proxy | create(proxy=ManagedProxyConfig(country="US")) |
| Fingerprint | create(fingerprint=FingerprintConfig(user_agent="...")) |
| Context persistence | create(context=ContextAttach(context_id="...")) |
| Recording control | create(recording=RecordingConfig(enabled=False)) |
| Custom image | create(image_id="img-xxx") |
| Session labels | create(labels={"env": "prod"}) |
| Idle timeout | create(idle_release_timeout=300) |
Session CRUD
# Create
session = client.sessions.create()
# Get
info = client.sessions.get(session.session_id)
# List
sessions = client.sessions.list(status="RUNNING")
# Delete (idempotent)
client.sessions.delete(session.session_id)
Configuration
| Environment Variable | Description | Default |
|---|---|---|
AGENTBAY_API_KEY |
API key (required if not passed explicitly) | — |
AGENTBAY_ENDPOINT |
API endpoint hostname | wuyingai.cn-shanghai.aliyuncs.com |
Exception Hierarchy
CloudBrowserError # Base exception
├── AuthenticationError # 401/403 — invalid or expired API key
├── QuotaExceededError # 429 — rate limit (has .retry_after attribute)
├── SessionNotFoundError # 404 — session doesn't exist
├── ProviderError # 5xx — server error (has .status_code, .request_id)
├── TimeoutError # Operation timed out
└── NetworkError # Connection failure
License
MIT
Metadata
Release files for agentbay-lite 1.0.1
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 |
|---|---|---|---|---|
| agentbay_lite-1.0.1.tar.gz | 16.3 kB | Without provenance | Details for agentbay_lite-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentbay_lite-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for agentbay_lite-1.0.1-py3-none-any.whl |
Total release size: 30.4 kB
Release files / agentbay_lite-1.0.1.tar.gz
| Download URL | agentbay_lite-1.0.1.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96bfe451c48be1c1b5965d0b71bdda06cd80bbc0cc58a25fc869e9ecf9462d85
|
|
BLAKE2b-256 checksum How to use checksums |
dec74f8f7573f0f041c40954780112a33610339d2abe9c4617ecb7d4b611c932
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / agentbay_lite-1.0.1-py3-none-any.whl
| Download URL | agentbay_lite-1.0.1-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f6e8b0a99c13ef9f8d37d1e28cc232bd084926ae62df381b2ff6513fa9c3983
|
|
BLAKE2b-256 checksum How to use checksums |
6332a17b3d36f876d9b5ec77eed0af44be97859a644df8aae354cd8338d42336
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Security for agentbay-lite 1.0.1
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.