Skip to main content

Raqim Python SDK (رَقِيم) — v0.2.0

Zero-secret egress airlock, pre-execution policy gate, and deterministic flight recorder for autonomous AI agents.

PyPI Python 3.10+ License: Apache-2.0


Overview

The raqim Python package provides native PyO3/Rust bindings and an async client for the Raqim Core Daemon (v0.2.0):

  1. Zero-Secret Egress Airlock (client.egress_request): Route outbound payment and LLM calls (/v1/egress/{connector}/{path}) using a short-lived rqm_v1 Ed25519 workload token while the Rust daemon injects upstream API keys (sk_live_..., OPENAI_API_KEY) and deterministic Idempotency-Key headers.
  2. Pre-Execution Policy Gate: Enforces route allowlists, strict anti-smuggling JSON parsing, RFC 6901 JSON-Pointer value caps (/amount <= 50000), and rolling 1-hour velocity budgets before any side effect leaves the host.
  3. Deterministic $0.00 Replay & Causal Forking (@client.trace): Replay recorded tool calls and streamed SSE LLM responses in milliseconds with zero upstream API cost, or automatically branch onto a phantom_ timeline when inputs diverge.
  4. Offline 9-Field BLAKE3 Merkle Verification (verify_state_proof_offline): Verify inclusion proofs offline—including records that have undergone in-place NDPA 2023 / GDPR PII crypto-shredding (payload_bytes=None).

Installation

pip install raqim

To build from source inside a virtual environment:

cd raqim-py
maturin develop --release

Quickstart

1. Zero-Secret Payment & LLM Egress Proxy

import asyncio
from raqim import RaqimClient

async def main():
    client = RaqimClient(
        alias="treasury_primary",
        tenant="fintech_prod",
        private_key_path="./ca-keys/treasury_primary.pem",
        cert_path="./ca-keys/treasury_primary.cert",
        workload_token="rqm_v1.<claims_b64>.<ed25519_sig_b64>",
        daemon_host="127.0.0.1",
        tcp_port=8080,
        http_port=8081,
    )
    await client.boot()

    # Agent holds ZERO Paystack keys; Raqim checks policy, scrubs `/bvn` pre-WAL,
    # binds an Intent UUIDv7 as `Idempotency-Key`, and injects `Bearer sk_live_...`
    resp = await client.egress_request(
        "POST",
        "paystack",
        "/transfer",
        json_body={
            "amount": 25000,
            "currency": "NGN",
            "recipient": "RCP_VENDOR_LAGOS_01",
            "bvn": "22345678901",
        },
        step_ordinal=1,
    )
    print("Status:", resp.status_code, "Sealed TxID:", resp.headers.get("x-raqim-tx-id"))

asyncio.run(main())

2. Offline Merkle Proof Verification (Pre- & Post-NDPA Redaction)

from raqim import verify_state_proof_offline

# 1. Verify full payload + 9-field execution envelope against signed Merkle root
assert verify_state_proof_offline(
    payload_bytes=raw_response_bytes,
    agent_id_str=client.agent_hex,
    proof_dict=proof,
)

# 2. After NDPA/GDPR in-place erasure (`raqim-cli redact <tx_id>`),
# pass `payload_bytes=None` to verify envelope inclusion without raw PII:
assert verify_state_proof_offline(
    payload_bytes=None,
    agent_id_str=client.agent_hex,
    proof_dict=redacted_proof,
)

Repository & Documentation

Metadata

Release files for raqim 0.2.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 raqim 0.2.0
File Size Uploaded Provenance Actions
raqim-0.2.0.tar.gz 149.9 kB Without provenance Details for raqim-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for raqim 0.2.0
File Interpreter ABI Platform Actions
raqim-0.2.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for raqim-0.2.0-cp310-abi3-win_amd64.whl
raqim-0.2.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for raqim-0.2.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
raqim-0.2.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for raqim-0.2.0-cp310-abi3-macosx_11_0_arm64.whl

Total release size: 1.2 MB

Release files / raqim-0.2.0.tar.gz

Download URL raqim-0.2.0.tar.gz
Size 149.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9e6429aac1014bd2a12df6eaf6673e2a3779696668be9ad583045e3bda530287
BLAKE2b-256 checksum
How to use checksums
e70a271e64dbd4ebdc78209247c2469bd209ca7c2c18f1962a6149ed4236ff6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / raqim-0.2.0-cp310-abi3-win_amd64.whl

Download URL raqim-0.2.0-cp310-abi3-win_amd64.whl
Size 285.4 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
66362dfbc4d272ff90817318c8c205b8a0231b74ed5e873a1d9e0acb9b9385ce
BLAKE2b-256 checksum
How to use checksums
4c4f1307bc223b543c82c140ff451aba5c87ae380369eeabc90b5f99938db620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / raqim-0.2.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL raqim-0.2.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 386.5 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
68ae83edb1bab0776d5cbcafbdfbe7469e7ce7bc9ff52b0369d437ac1e9eba14
BLAKE2b-256 checksum
How to use checksums
f730f2c041d3928e96c2b368692bb8004ea1a36de770c574eed5e711658d8977
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / raqim-0.2.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL raqim-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Size 338.7 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7e7b6d2e4bd6c96c0426b7340afada8780f51a42a47e61250872d08d3defb640
BLAKE2b-256 checksum
How to use checksums
3ac71362617c1e700394a4d2a3809037f2275fa5ef8af57e6a6469655b923ee6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for raqim 0.2.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.

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