Python client library for the loom browser-automation daemon
Project description
loom (Python SDK)
Python client library for the loom browser-automation daemon.
Prerequisites
The SDK talks to a running loom-daemon over a Unix socket. Install
loom (CLI + daemon + chromium pin) first via Homebrew, cargo install,
or the install script — see the
main README. Then start
the daemon:
loom serve
Install
pip install mentiora-loom
The distribution is named mentiora-loom; it still imports as loom
(import loom). Requires Python ≥ 3.11.
Quick start (sync)
import loom
with loom.Session.create() as session:
receipt = session.navigate("https://example.com")
print(receipt.action_hash)
Quick start (async)
import asyncio
import loom
async def main():
async with await loom.AsyncSession.create() as session:
receipt = await session.navigate("https://example.com")
print(receipt.action_hash)
asyncio.run(main())
What the SDK exposes
Session/AsyncSession— session lifecycle (create / close / abort / kill / replay / inspect / validate / export).Session.{navigate, click, type_text, select, hover, scroll, wait, evaluate, screenshot, snapshot}— every web action surface.- Admin RPCs:
kill_session(session_id, ...)(force-terminate without a handle),daemon_health(deep=...)(operational snapshot). - Receipt + summary types in
loom.types—Receipt,SessionInfo,SessionInspection,DiffReport,ExportInfo,ValidationResult,GrantInfo,SchemaRegistry,LoomErrorCode. - Typed errors:
LoomError,LoomRPCError,LoomConnectionError,LoomTokenError.
Cancellation (async only)
AsyncSession supports transparent cancellation via standard asyncio
primitives. Wrap a call in asyncio.wait_for or cancel its enclosing
task and the SDK fires a request.cancel envelope at the daemon, then
re-raises asyncio.CancelledError so TaskGroup / asyncio.timeout
keep working:
import asyncio
import loom
async with await loom.AsyncSession.create() as s:
try:
await asyncio.wait_for(s.navigate("https://example.com"), timeout=5.0)
except asyncio.TimeoutError:
# SDK already sent request.cancel before the timeout re-raised.
...
Sync Session is single-in-flight by design — there is no cancellation
hook. For cancellable work, reach for AsyncSession.
Connection details
Session.create() defaults work when a single user runs the daemon on
their own machine. Override per-call if needed:
session = loom.Session.create(
socket_path="/var/run/loom/loom.sock", # custom daemon socket
token="...", # explicit HELLO-token
profile="standard", # or "safe", "full"
network_mode="live", # or "replay"
seed=42, # determinism seed
)
License
Apache-2.0. See the main repository for details.
Project details
Release history Release notifications | RSS feed
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 mentiora_loom-0.9.9.tar.gz.
File metadata
- Download URL: mentiora_loom-0.9.9.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03a113699827b2a0fc6dedaad2e697c92671e1070a670f62a64fd9c4d49e975e
|
|
| MD5 |
211124177eb29b0d8f896800712c9a38
|
|
| BLAKE2b-256 |
1f0d0daa0ae5220fe33077913639cddca12cf623e972fc55aea3a5b24f41cafa
|
File details
Details for the file mentiora_loom-0.9.9-py3-none-any.whl.
File metadata
- Download URL: mentiora_loom-0.9.9-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8284cd24d559ee494651a085aa3fe9c341b2a1b8b89536f9f34753d7c2a6e2b
|
|
| MD5 |
c8ce1477b07dc7bc65ad0dc0adc8654d
|
|
| BLAKE2b-256 |
8648cf857c4b3b3b0cbdc25110e0cda00d79fb67566590163b9a2ab0ad487a56
|