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.8

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.8
File Size Uploaded Provenance Actions
mentiora_loom-0.15.8.tar.gz 37.9 kB Without provenance Details for mentiora_loom-0.15.8.tar.gz

Built distribution (wheel)

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

Total release size: 65.3 kB

Release files / mentiora_loom-0.15.8.tar.gz

Download URL mentiora_loom-0.15.8.tar.gz
Size 37.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9e4d0b5b930b9e53922a3bf1452850896c90fd51847b60f5000f0edd812d2aa5
BLAKE2b-256 checksum
How to use checksums
fed7a60500e895b62b436fc25196c7b7b3a6fe6c28db6d88b69683ae0f2ac6ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL mentiora_loom-0.15.8-py3-none-any.whl
Size 27.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ecf11ea4e1c556d6f5ea1335d9d5e4344eba8f7363d74faadc21dc0aff19fc10
BLAKE2b-256 checksum
How to use checksums
7d877d22cb8f126d7904e647ee5e5cd5307ec714eeaa14c6a45744d3a6500144
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for mentiora-loom 0.15.8

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.

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