Skip to main content

Active Python Binding — WASM-first (CHECKLIST 1.004-1.006, PROPOSAL §2.1, §2.3)

Zero native compilation. The binding drives the zero-import active_wasm.wasm module through wasmtime (pip-installable, no compiler needed) and exposes the agent-loop surface with opaque handles, an ABI major gate, and Allocator Model A (the module's active_free frees everything the module allocated).

Decision (DERIVED, owner authority)

WASM-first instead of cffi/PyO3: no per-platform wheels, no compiler on the user machine, identical semantics to every other embedding by construction. A native extension remains an option if profiling ever justifies it; nothing in this layout precludes adding one later behind the same API.

API

from active import Module

with Module() as m:                      # or Module(path_to_wasm)
    diags = m.check(source)              # [Diagnostic(code, message)]
    value = m.eval(source)               # redacted dict, raises on refusal

Module instances are confined to the creating thread. check returns [] when clean. eval raises ActiveError on refusal with the diagnostics text. Secrets always render ***SECRET***.

Tests

test_active.py drives the shipped module: ABI gate, eval value, units refusal with stable code T001, secret redaction with no raw leak (including refusal paths), closed-module fail-closed behavior on every entry point, double-eval determinism, structured spans on diagnostics, validate/check agreement, and .pyi stub fidelity to the runtime API (9 tests green). Run from the repo root:

python bindings/python/test_active.py

Requires wasmtime (pip install wasmtime) and a built module (cargo build -p active-wasm --target wasm32-unknown-unknown --release).

Ownership and lifetime (normative for this binding)

  • Opaque handles: a Module owns exactly one wasmtime instance. One Module per thread; never share a module across threads, with or without locking. The underlying engine state (including the module's live-buffer registry) is thread-confined by construction, so sharing would corrupt frees even under a lock.
  • Allocator Model A: every allocation the module makes is freed inside the module through the official active_free export. The host never frees module memory with any other function, and module memory is never exposed as writable host buffers beyond the single input copy per call.
  • ABI gate: Module() construction reads active_abi_version and raises ActiveError unless the major version is 1. A stale or foreign .wasm cannot be used silently.
  • Error mapping: evaluation refusal surfaces as ActiveError (never a bare None or an empty dict); a missing module or envelope-shape mismatch also raises ActiveError, so misuse fails loudly instead of returning plausible-looking data.
  • Close discipline: use the module as a context manager or call close() explicitly. Using a closed module raises ActiveError.
  • Budgets: the module runs the hermetic engine with shipped hard budgets (fail-closed on exhaustion). validate() is the explicit validation step of the agent loop and shares check()'s verdict path; the reference loops additionally enforce an iteration budget (max_iters) with stuck-loop detection. Hosts that need custom per-call budgets drive the C ABI surface (active_check with ActiveBudget), which is the same core with a budget pointer.

Metadata

Release files for active-lang 1.4.0

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

Source distribution (sdist)

Source distribution for active-lang 1.4.0
File Size Uploaded Provenance
active_lang-1.4.0.tar.gz 11.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for active-lang 1.4.0
File Interpreter ABI Platform
active_lang-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / active_lang-1.4.0.tar.gz

Download URL active_lang-1.4.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fd4c25e729b5c7192c2bf6e8c5b2dddc0c5ae148429be7602b56b82494ceeb62
BLAKE2b-256 checksum
How to use checksums
d37806bfed0d71613a877d7d0411d0f1a9ef50ffee4105ac9a2eb3bd117434d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / active_lang-1.4.0-py3-none-any.whl

Download URL active_lang-1.4.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0802a363cb08651d61cbb0a24d979e0ab56f50fea44e503710b7da93e5b7e32a
BLAKE2b-256 checksum
How to use checksums
7f1b3312e1107e91ded5a2717d7071094ce73de128413f2511167b92c16cfc2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for active-lang 1.4.0

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.

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 release files No provenance

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