Skip to main content

🛡️ Anchor Core (anchor-audit)

The Deterministic Runtime Governance & Compliance Kernel for Autonomous AI Systems.

PyPI Version License

Current release: 6.1.1 · Python 3.10–3.14

Anchor is a high-performance, dual-language (Rust/Python) infrastructure library designed to enforce strict regulatory invariants, architectural boundaries, and safety safeguards around autonomous AI agents and LLM application pipelines in real-time.

By executing compiled Abstract Syntax Tree (AST) query matchers and single-pass Deterministic Finite Automaton (DFA) regex sets, Anchor operates with zero-copy memory boundaries—designed to keep per-call overhead low. See benchmarks/bench_guard.py to measure it on your hardware.


🏎️ Core Architectural Horsepower

  • Fast static scanning: Rust backend engine utilizing parallel directory walking via rayon and memory-mapped files (memmap2).
  • Zero-Copy Memory Boundaries: Leverages PyO3 zero-copy buffer bridges to consume incoming network data frames straight from host ASGI server pools (like FastAPI) with zero heap allocation overhead.
  • Asymmetric Cryptographic Identity: Every compiled audit log is bundled into an tamper-evident Decision Audit Chain (DAC) block, sealed locally using Ed25519 asymmetric keys and verified via constant-time hashing (subtle::ConstantTimeEq).
  • Active Self-Healing Interception: Moves beyond passive post-mortem dashboards. If an active consumer agent drifts into an invariant violation, Anchor's runtime layer intercepts the thread, halts execution, and injects dynamic, domain-agnostic rerouting directives on the fly.

🏛️ Comprehensive Regulatory Scope

Anchor maps rules to the provisions they relate to (a pattern match is not a legal finding). Coverage includes:

  1. EU Artificial Intelligence Act (Regulation EU 2024/1689): Complete mapping from Chapter II Article 5 Prohibited Practices (subliminal manipulation, facial scraping safeguards) to Chapter III Articles 6–27 High-Risk System obligations (6-month log retention tracking under Art 12/19, Article 14 human override levers), stretching up to Article 99 turnover penalty metrics.
  2. U.S. Securities and Exchange Commission (SEC / FINRA): Hard automated boundaries protecting algorithmic trading setups under SEC Regulation SCI (System capacity loop circuit breakers), Exchange Act Rule 15c3-5 (Pre-trade credit and risk limit validation), and Cybersecurity Form 8-K outbound data exfiltration gates.
  3. Industry Frameworks: Built-in support for FINOS OSERA AI supply-chain resiliency blueprints, OWASP Top 10 LLM security controls, NIST AI RMF, and ISO/IEC 42001 standards.

📦 High-Velocity Installation

Deploy the compiled binary kernel straight into your production cluster workspace:

pip install anchor-audit

Anchor pulls in its runtime dependencies automatically (Click, HTTPX, PyYAML, cryptography, wrapt, GitPython and the tree-sitter grammars), so the anchor command is usable straight after install.

Optional extras:

pip install "anchor-audit[providers]"   # OpenAI, Anthropic, Groq, Cohere, Ollama, ...
pip install "anchor-audit[server]"      # FastAPI/ASGI gateway (anchor.app) + uvicorn
pip install "anchor-audit[dev]"         # pytest, black, mypy

The CLI, the @guard decorator and the static scanner need none of these extras.

Initialize your local asymmetric cryptographic repository identity:

anchor init

Run a parallel static code safety audit across your local workspace:

anchor check .

anchor check exits 0 when no findings meet the threshold, 1 when there are findings, and 2 on usage errors or when ANCHOR_REQUIRE_VERIFIED_GOVERNANCE=1 is set and the bundled rules cannot be verified, so it can gate CI directly.

anchor --version
anchor check . --severity blocker      # blocker | error (default) | warning | info
anchor check . --format json           # machine-readable report on stdout (or: markdown)

anchor init prompts interactively in a terminal; with no terminal (CI, Docker) or with --no-prompt it runs non-interactively.

Building from source

Prebuilt wheels need no toolchain. Installing from source (pip install . or an sdist on a platform without a wheel) compiles the Rust kernel and needs Rust 1.78 or newer (the committed Cargo.lock is lockfile v4) and a C toolchain.


🔌 Runtime Integration

Wrap a high-privilege agent routine or LLM invocation with a decorator. @guard only protects functions you wrap; unwrapped code is not covered.

from anchor import guard

@guard(domain="finance")
def execute_algorithmic_trade(order_payload):
    # If the autonomous agent tries to route an un-vetted market order,
    # Anchor audits the call payload before the function body runs and returns a BLOCKED_BY_ANCHOR directive on a match.
    return route_order_to_exchange(order_payload)

from anchor.guard import guard is the equivalent spelling if you prefer to import the decorator directly. Both are exercised by tests/test_readme_example.py.


🌐 The AnimusLab Institution Network

Anchor Core acts as the local spoke auditing engine that feeds seamlessly into the wider, unified decentralized coordination hub ecosystem:

Maintained by AnimusLab.


Engineering case studies

⚠️ Limitations

  • @guard (Layer 2) covers only the functions you decorate. Keyword/pattern checks can be rephrased around; treat Anchor as one deterministic layer in defense-in-depth.
  • Telemetry is off by default. Set ANCHOR_TELEMETRY=on to opt in; see docs/telemetry.md for exactly what is sent.
  • Static rules are pattern/AST based. Known detection gaps are tracked as xfail tests in tests/unit/test_detection_gaps.py.

  • Gateway. anchor.app fails closed: set ANCHOR_GATEWAY_TOKEN and send Authorization: Bearer <token>. Request bodies are limited to 1 MiB (ANCHOR_GATEWAY_MAX_BODY_BYTES). Bind to 127.0.0.1 unless it runs behind a trusted proxy. For local development only, ANCHOR_GATEWAY_ALLOW_UNAUTHENTICATED=1 disables the check.
  • Remote policies. extends: accepts https:// URLs only, refuses private and local addresses, and can be restricted with ANCHOR_POLICY_URL_ALLOWLIST.
  • Sandbox runtime. Downloaded runtime files are verified against pinned SHA-256 hashes before use.
  • Not legal advice. Anchor reports automated pattern and AST findings mapped to the provisions they relate to. A finding is not a legal determination, and a clean scan is not a compliance certification. References to OWASP, NIST, FINOS, OECD and regulators identify sources only and do not imply endorsement.
  • Reporting vulnerabilities: see SECURITY.md. Third-party licenses: THIRD_PARTY_LICENSES.md.

Metadata

Release files for anchor-audit 6.1.1

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

Source distribution (sdist)

Source distribution for anchor-audit 6.1.1
File Size Uploaded Provenance Actions
anchor_audit-6.1.1.tar.gz 278.7 kB Without provenance Details for anchor_audit-6.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for anchor-audit 6.1.1
File Actions
anchor_audit-6.1.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for anchor_audit-6.1.1-cp310-abi3-win_amd64.whl
anchor_audit-6.1.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for anchor_audit-6.1.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
anchor_audit-6.1.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for anchor_audit-6.1.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
anchor_audit-6.1.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for anchor_audit-6.1.1-cp310-abi3-macosx_11_0_arm64.whl
anchor_audit-6.1.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for anchor_audit-6.1.1-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 8.2 MB

Release files / anchor_audit-6.1.1.tar.gz

Download URL anchor_audit-6.1.1.tar.gz
Size 278.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4acb3ac1c8af53a1e850b1e8c879db35e558cb4b91f1c6581160a2c42201775f
BLAKE2b-256 checksum
How to use checksums
4138ef26ff7956488a927ca6e3ad2adfe27a8d0e176c693784193d629bf623fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / anchor_audit-6.1.1-cp310-abi3-win_amd64.whl

Download URL anchor_audit-6.1.1-cp310-abi3-win_amd64.whl
Size 1.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
88cf9a3024c298f2e5affbb855121e68ba49bccec02a845da6f96f8cfd6992bf
BLAKE2b-256 checksum
How to use checksums
54d226364296f841eb6a76ae760513c23740513f50ec5562b682a5c9ee6713fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / anchor_audit-6.1.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL anchor_audit-6.1.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.7 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
8d9b76f1419db4f10f49194066e4038b6fc254c541dd6a414c905db106dfcf00
BLAKE2b-256 checksum
How to use checksums
9717c8e4e666fe3333fc4cc1121eba6a8b39fc96ea9a56ee28d0d8abfa4038a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / anchor_audit-6.1.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL anchor_audit-6.1.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.7 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
171cd9acf74a31411dae69bda0e9bdde27d71f30a3e132a1433ec44eac1f46c0
BLAKE2b-256 checksum
How to use checksums
397d68d8337ba1f417cd1f43c9f399c02684cb54d2cb4d82eb9f09736377d5e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / anchor_audit-6.1.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL anchor_audit-6.1.1-cp310-abi3-macosx_11_0_arm64.whl
Size 1.5 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
49cbecd98a0061edf8f289ecedc3b6855bf9cab3aa2c54e5ddef889c5a825df9
BLAKE2b-256 checksum
How to use checksums
4d8687165484c08aacbcfb4d1360bce1a6169550f6ebc28ca505621784b40886
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / anchor_audit-6.1.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL anchor_audit-6.1.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f7a8bddb53d624362c0437b43674d84a543b6c3ef6b8a5fee331422014709aab
BLAKE2b-256 checksum
How to use checksums
df84841f9cb4557bf4560c9909d0e68f91494661b18d4e2d331b4c33fa777714
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for anchor-audit 6.1.1

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

6.1.1 This release

6 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