Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

agindow (Python)

New in Beta: http_sample and compare_http_envelope compare explicit safe metadata windows through the shared guest. Python collection is caller-owned; no HTTP/framework adapter is added. These APIs are included in this Beta release. See HTTP evidence for scope and limits.

New in Beta: sdk.detection_status() returns immutable local selection, engine and latest-call diagnostics, including clean sufficient comparisons and bypass. It works independently of recent() and event-buffer capacity. active establishes sufficient comparison evidence, not complete coverage or provider correctness. Closing a selected instance makes detection unavailable. This method is included in the Beta release. See the detection reference for all states.

Beta release: Node 0.1.0-beta.1 / Python 0.1.0b1. See the SDK changelog for changes and upgrade guidance.

Dependabot for agents. At runtime.

Detect API drift as agents run. Apply verified runtime repairs for reviewed changes, and use drift evidence to prepare source patches.

Beta. Detection requires configured comparison windows. Runtime repair is opt-in. Source patches can be exported locally. Validation and draft PR creation require separately configured and authorized hosts.

Use Python 3.11+ to observe existing API calls and explicitly configure supported detection or verified repair. The embedded SDK needs no separate AGINDOW key; vendor authentication stays in your application. The statistical guest needs explicit scoped baseline/current windows, and selective repair is off by default.

Install

pip install agindow==0.1.0b1
# or: uv add agindow==0.1.0b1

The wheel includes the prebuilt WASM guest. You do not need Rust, Node, or a monorepo checkout to use the SDK.

First API call

Prepare a reviewed selection.json for orders.get following the selection guide. Set AGINDOW_SELECTION to that file as well as API_URL before running these programs. Each selected field needs complete raw JSON baseline/current windows from comparable independent calls. No automatic baseline collection occurs.

Save the complete program below as orders.py. Set API_URL to your existing read-only HTTPS JSON endpoint and run python orders.py. Keep authentication, headers and vendor credentials in your current client when adapting the function.

import json
import os
from urllib.request import urlopen
from agindow import Agindow

from typing import cast
with open(os.environ["AGINDOW_SELECTION"], encoding="utf-8") as source:
    supplied: object = json.load(source)
if not isinstance(supplied, dict):
    raise ValueError("Selection must be a JSON object")
selection = cast(dict[str, object], supplied)
if selection.get("operation") != "orders.get":
    raise ValueError("Selection must name orders.get")
sdk = Agindow(mode="observe", selection=selection)
sdk.on("drift", lambda event: print("Drift:", event.verdict))

@sdk.guard(tool="orders.get", operation="read")
def get_order() -> object:
    with urlopen(os.environ["API_URL"], timeout=10) as response:
        order: object = json.load(response)
        return order

try:
    print("API result:", get_order())
    print("AGINDOW events:", [event.type for event in sdk.recent()])
finally:
    sdk.close()

Expect the API response and recent event kinds from the selected evidence. An empty list does not prove drift-free traffic. sdk.ready is a boolean, not awaitable; sdk.load_error retains a load failure. A failed engine load preserves the original call through bypass. Upstream HTTP/network/JSON errors propagate. The finally block closes this same SDK instance.

Async and scoped configuration

Decorate an async def with @sdk.guard(...) and await it normally. The complete async Python example uses an application-owned HTTP call. Sync/async scopes use with sdk.context(mode="observe"): / async with sdk.context(mode="observe"):. See the Python API reference for complete examples, arguments and failure contracts.

Context managers scope guarded calls; they cannot intercept arbitrary Python statements. Overrides use ContextVar, nest and remain isolated across async tasks. Each call freezes configuration until completion. configure(mode="repair") changes future calls. sdk.ready is a synchronous boolean after local loading (unlike Node’s startup Promise); sdk.load_error retains a loading failure. Loading failures and retired guests preserve upstream results and emit one bypass per call. close() is safe for shutdown; subsequent calls bypass.

The wrapper preserves __name__, documentation, annotations, signatures, bound receivers and arguments. ParamSpec retains Pydantic model types without a mandatory Pydantic dependency. Model results retain their original identity; only a detached model_dump(mode="json") projection enters inspection.

Configuration and feedback

Supported fields (snake_case): mode, fail_closed, api_key, endpoint, allowed_tools ("*" or a tuple), deny_tools, buffer and on_event. Resolution: explicit keywords > environment > nearest JSON .agindowrc > defaults. Shared env vars match Node (AGINDOW_MODE, AGINDOW_KEY, AGINDOW_ENDPOINT, AGINDOW_BUFFER, AGINDOW_FAIL_CLOSED). Invalid explicit or environment values raise AgindowSetupError before a call.

Catch AgindowDriftError only for policy handling; inspect code, tool, drift_class, drift_id, hint, audit_url and the original cause as applicable. See errors and retained outcomes.

Request halts dispatch zero times. Response halts retain error.outcome and warn against blind replay. Upstream exceptions survive as error.__cause__. Missing audit IDs/URLs remain empty rather than fabricated.

on(type, handler) returns an unsubscribe callback; recent() returns an immutable tuple of retained events. buffer=0 disables retention. This is local telemetry, not hosted audit delivery.

Shared-core validation and limits

Parity fixtures run both public wrappers against the same WASM guest. The paired local agent-loop benchmark gates added p50 <100 µs on the default Unselected statistical plan only (excludes model/network/import/selected-detector work).

Python wrap currently accepts callables. Node-specific tool/client/HTTP adapters, Nango codegen, OTel spans, report CLI and guest audit draining are outside this package. No Python framework adapter or streaming qualification is claimed. Inspection is bounded to detached JSON projections.

Remote fail-open API

Local decorators stay offline. Remote execution is a separate HTTP API using stdlib HTTP transport; it never redirects or retries through AGINDOW:

Use guard_remote / guard_remote_async only with a configured execution host and your real original-call fallback. Follow the complete remote guide for a labelled local protocol exercise, options, authentication, response cleanup and fallback semantics. A fabricated fallback value is not a successful vendor result.

RemoteResponse retains the original status/headers and streaming body. Any 5xx/refusal/timeout/reset invokes the original callable once and emits one bypass. Writes/unknown operations require the same upstream idempotency key in the envelope and fallback. guard_remote_async runs the blocking API in a worker thread for a synchronous fallback callable.

Opt-in machine-identity helpers stay credential-free in embedded mode; they do not enable a hosted identity service by themselves. Sibling Node package: agindow.

Maintained detection example

The complete detect.py matches the published detection example byte for byte. Run it after installing the pinned package in your environment. The documentation publication gate executes this same source against matching built SDK artifacts.

Public documentation and coding-agent resources

Start with Quickstart and the capability matrix. For Markdown, use /docs.md, the public developer manual. /llms.txt is the compact page index; /llms-full.txt adds full documentation and coding-agent guidance. These mirrors may return 503 on the public origin until an evidence service is enabled; the browser docs remain the starting point.

The public SKILL.md and spore.md describe integration without enabling it automatically. MCP tools read evidence and simulate proposals; they never execute vendor writes. Signed /openapi.json belongs to a configured MCP origin, not an embedded SDK requirement or a managed execution endpoint.

Enable selective repair

Repair is off by default. Construct Agindow with selective_repair=SelectiveRepair(rules=(RenameRule(...),), verify=verify). RenameRule identifies tool, request/response side, top-level source and target keys, reviewed migration ID and confidence. The local synchronous verifier receives immutable RepairCheck.before, .after JSON strings and .rule; it must check intended meaning using independent authoritative data. Load that data outside calls. Start with Agindow(mode="observe", ...), then use sdk.configure(mode="repair") after evaluation; observe disables application.

The shared Rust engine prepares selective key edits. Existing statistical findings/blocks remain in force. Use a reviewed scalar rule for bounded exact conversions. Automatic discovery remains unsupported. See the runnable example and limits.

For nested or selected-array renames in the published alpha.4/a3 SDKs, add parents=('/contacts/0', '/contacts/2') to RenameRule, keeping source and target as literal keys. Supply reviewed contract, migration, provenance and expires_at (Unix milliseconds). Use a synchronous semantic verifier over independent application facts loaded outside calls. Python applies to plain dictionaries/lists; it does not provide Node's raw-body boundary. See nested repair limits and the capability matrix.

For versioned contract/expiry and value-type admission in the published alpha.4/a3 SDKs, see SDK repair facts.

Metadata

Release files for agindow 0.1.0b1

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

Source distribution (sdist)

Source distribution for agindow 0.1.0b1
File Size Uploaded Provenance Actions
agindow-0.1.0b1.tar.gz 479.5 kB Without provenance Details for agindow-0.1.0b1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agindow 0.1.0b1
File Interpreter ABI Platform Actions
agindow-0.1.0b1-py3-none-any.whl Python 3 none any Details for agindow-0.1.0b1-py3-none-any.whl

Total release size: 905.4 kB

Release files / agindow-0.1.0b1.tar.gz

Download URL agindow-0.1.0b1.tar.gz
Size 479.5 kB
Tags Source
SHA-256 checksum
How to use checksums
875e61a1042e08c41b67537122ea5171ece86d35fcf7d340b570ff335dcead3f
BLAKE2b-256 checksum
How to use checksums
566610c9d797f651ffb47909ae4786f8e867ad7aca16c0bcfec452eb15723b62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / agindow-0.1.0b1-py3-none-any.whl

Download URL agindow-0.1.0b1-py3-none-any.whl
Size 425.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2409fd0196b1b4d631b2e5a6f37163e47e6b8ac4ef09014ba39b2ffe2cb813c1
BLAKE2b-256 checksum
How to use checksums
346171b38777962c8beb13b5f9caa31e6b9c3f22d704022e9482467b2e6dee14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for agindow 0.1.0b1

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