Skip to main content

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",                     # the only mode (see below)
    seed=42,                                 # determinism seed
)

Network mode: page traffic is always live

network_mode accepts exactly one value, "live" (the default). Page traffic is always fetched live from the network — loom records the manifest hash chain and per-request metadata, not page-network responses. Response bodies are never captured, so HAR exports contain request entries without bodies, and replay re-executes the recorded actions rather than serving recorded responses. Any other value ("recorded", "mixed", "replay") is rejected at Session.create() with invalid_network_mode.

License

Apache-2.0. See the main repository for details.

Metadata

Release files for mentiora-loom 0.15.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mentiora-loom 0.15.4
File Size Uploaded
mentiora_loom-0.15.4.tar.gz 36.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mentiora-loom 0.15.4
File Interpreter ABI Platform
mentiora_loom-0.15.4-py3-none-any.whl Python 3 none any Details

Total release size: 61.4 kB

Release files / mentiora_loom-0.15.4.tar.gz

Download URL mentiora_loom-0.15.4.tar.gz
Size 36.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8d87ed33bc405449ba9499efd6f146187ecf53adce8198337cb4667c7fb72063
BLAKE2b-256 checksum
How to use checksums
e2899b53d126a4d037220645f541039c3ee212d4779a204403856430a3b89f2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / mentiora_loom-0.15.4-py3-none-any.whl

Download URL mentiora_loom-0.15.4-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8af1c767815d3be1ccef90e264a2d44f49ebfbcea80a26f612607b9bac98576
BLAKE2b-256 checksum
How to use checksums
cf65c5e40b9b30a563407c411bf0b2e3abba72fc637c25602615200cb1ad1a71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.15.7

2 release files

0.15.6

2 release files

0.15.5

2 release files

This release

0.15.4 This release

2 release files

0.15.3

2 release files

0.15.2

2 release files

0.15.1

2 release files

0.15.0

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.13.4

2 release files

0.13.3

2 release files

0.13.2

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.4

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.1

2 release files

0.9.9

2 release files

0.9.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page