sleight
Drive any CDP browser like a human. Bezier trajectories with real hand tremor, typing rhythm modelled on keystroke-dynamics research, and exclusive leasing for browser instance pools.
Python ≥ 3.11 · one runtime dependency (websocket-client) · MIT
📖 中文文档手册 — 安装、快速开始、实战场景、CloakBrowser Manager 部署 🚀 部署与运维 CLI — 一条命令把 Manager 部署到本机或远程
pip install sleight
30 seconds
from sleight import connect, Text
with connect("http://127.0.0.1:9222") as s: # opens its own tab, closes it on exit
s.open("https://example.com", wait=Text("Example Domain"))
print(s.title(), len(s.content()))
With a browser pool that has real profiles behind it:
from sleight.providers import CloakBrowserManager
mgr = CloakBrowserManager("http://127.0.0.1:19000", token="…")
with mgr.lease() as inst: # exclusive lease, released on exit
with inst.session(human=True) as s: # every action gets a human trajectory
s.open("https://example.com")
s.click("#login")
s.type("#email", "user@example.com")
s.click("#submit", human=False) # …except this one, speed matters here
See what the page actually loaded — the library gives you structured data, you decide what to print:
with s.capture_resources(types={"Script", "Stylesheet"}) as capture:
s.open(url, wait=Load())
s.pump_events(10) # the async batch that arrives after `load`
for r in capture.snapshot():
print(r.resource_type, r.status, r.url)
Target one specific profile — by id, by name, or by tag:
with mgr.lease(instance_id="5edcc28a-…") as inst: ...
with mgr.lease(where=lambda i: i.name == "Win-US-02") as inst: ...
with mgr.lease(where=lambda i: "us" in i.tags) as inst: ...
Three providers' worth of instances, one logical pool:
from sleight import Pool
from sleight.providers import CloakBrowserManager, Plain
pool = Pool([
CloakBrowserManager("http://10.0.0.1:9000", token=T1, name="hk"),
CloakBrowserManager("http://10.0.0.2:9000", token=T2, name="sg"),
Plain("http://127.0.0.1:9222", name="local"),
])
with pool.lease(where=lambda i: "us" in i.tags) as inst:
...
Getting a fleet to drive
The hard part of running CloakBrowser is not the driving — it is the deployment, the extension rollout, and the "why does this profile behave differently" archaeology. So the same package ships a CLI for it. Local docker or a remote host over SSH is the same code path, only the runner differs:
sleight deploy --ssh deploy@10.0.0.12 --dir /srv/cloakbrowser-manager --sudo
sleight status --host hk-01
sleight ext push ./plugins/bypass-paywalls --host hk-01 # MV3 check + permissions
sleight ext apply --host hk-01 # every profile, then restart
sleight ext verify --host hk-01 # did the browser really load it
sleight ui # the same, in a browser
Deploys are idempotent, --dry-run prints the exact bytes it would write, and the
things you must not do are refused rather than documented: no latest tag, no
down -v, no silently rotating an in-use AUTH_TOKEN, no second manager on the same
/data. The engine is stdlib-only (SSH is the system ssh binary); only
sleight ui needs pip install "sleight[ui]".
Why this exists
Fingerprint-level anti-detection is a solved problem — CloakBrowser patches Chromium at the source level, Camoufox patches Firefox. They fix what the browser looks like. Nothing fixes how it moves.
- Playwright and Puppeteer teleport the mouse.
mouse.move(steps=N)interpolates a straight line at constant speed — zero jitter, zero acceleration. That is itself a signature. - The browser will not fill in the trajectory for you. Even with a humanize feature
enabled browser-side, an external CDP client produces zero
mousemoveevents between press and release. Measured, not assumed. - The good trajectory work lives in JavaScript (
ghost-cursor). Python ports are thinly maintained. - Crawlee for Python's
BrowserPooldoes not support remote browsers.
sleight fills exactly that gap: Python + remote CDP + human behaviour + instance leasing.
Relationship to Playwright
Not a replacement — a complement. sleight is a driver layer, not a framework. It deliberately does not do iframes/OOPIF, downloads, video, tracing, or a full locator DSL. When you need those, use Playwright.
The interesting part is that you can use both: sleight's human module is
sans-io — it emits (method, params, sleep_after)
tuples and never touches a socket — so it drives a Playwright CDPSession just as
happily as sleight's own transport.
What makes the motion credible
| sleight | typical automation | |
|---|---|---|
| Path shape | cubic Bezier, control points offset to one side | straight line |
| Micro-motion | WindMouse wind term (correlated tremor) | none, or white noise |
| Point count | Fitts's law — far small targets take longer | fixed steps=N |
| Landing | truncated Gaussian inside the box | dead centre |
| Coordinates | integers | floats used as "jitter" |
| Overshoot | past the target then back, distance-scaled | exact arrival |
| Typing | per-character events, interval by digraph class | one insertText |
| Scrolling | repeated small mouseWheel deltas |
one scrollTo |
Parameters are not invented. They come from the WindMouse physical model, ghost-cursor's Fitts-law point budgeting, and published keystroke-dynamics measurements (alternating-hand digraphs average 114 ms, same-hand-different-finger 131 ms, same-finger slowest and most variable).
Scope
Does: navigation and typed wait conditions · rendered-DOM reads · CSS queries · human mouse / keyboard / wheel · structured network-resource capture · instance discovery across providers · cooperative exclusive leasing with TTL renewal (in-memory, or Redis-backed across processes) · idempotent recovery · deploying and operating CloakBrowser Manager over local docker or SSH, extensions included.
Does not: data extraction · scheduling and queues · fingerprint spoofing (that is the browser's job) · iframe / OOPIF / Shadow DOM piercing · strict fencing · WebDriver BiDi · Firefox.
The deploy layer lives in its own subpackage and is never imported by import sleight,
so the driver stays a one-dependency library.
Status
0.x — alpha, the API will move. Every release documents its breaking changes.
Releases are published from a git tag by
.github/workflows/publish.yml via PyPI Trusted
Publishing — no token is stored in this repository.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sleight-0.2.0.tar.gz.
File metadata
- Download URL: sleight-0.2.0.tar.gz
- Upload date:
- Size: 263.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ed70f817bb5ff7c8753c7eb17eb70642e8182d9dff2182f315d8755f2d99023
|
|
| MD5 |
f614624fc96870a6a400879e1ccae16a
|
|
| BLAKE2b-256 |
3de4ff2a58825a386118fa32aa4f6d49e4207e9976b01d25d0065814c3471c3e
|
Provenance
The following attestation bundles were made for sleight-0.2.0.tar.gz:
Publisher:
publish.yml on yuanqimanong/sleight
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sleight-0.2.0.tar.gz -
Subject digest:
8ed70f817bb5ff7c8753c7eb17eb70642e8182d9dff2182f315d8755f2d99023 - Sigstore transparency entry: 2342904257
- Sigstore integration time:
-
Permalink:
yuanqimanong/sleight@992681cba4cd119790ca121231e81aa2920aa214 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/yuanqimanong
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@992681cba4cd119790ca121231e81aa2920aa214 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sleight-0.2.0-py3-none-any.whl.
File metadata
- Download URL: sleight-0.2.0-py3-none-any.whl
- Upload date:
- Size: 174.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
838b81d0a41dd9d796612f6b0a0fd673d755088b47e073b710ba6c977470cd68
|
|
| MD5 |
a674ef267e29a27be00f373c167926e7
|
|
| BLAKE2b-256 |
507e738cc69d8c79b611ff3b4b59068bd77f92dfad9b13960b30ce9eb6dfd7be
|
Provenance
The following attestation bundles were made for sleight-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on yuanqimanong/sleight
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sleight-0.2.0-py3-none-any.whl -
Subject digest:
838b81d0a41dd9d796612f6b0a0fd673d755088b47e073b710ba6c977470cd68 - Sigstore transparency entry: 2342904301
- Sigstore integration time:
-
Permalink:
yuanqimanong/sleight@992681cba4cd119790ca121231e81aa2920aa214 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/yuanqimanong
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@992681cba4cd119790ca121231e81aa2920aa214 -
Trigger Event:
push
-
Statement type: