Skip to main content

qae-safety

Deterministic safety certification kernel for AI agents, finance, and beyond.

Built with Rust for performance, exposed to Python via PyO3.

Installation

pip install qae-safety

Quick Start

from qae_safety import SafetyCertifier, AgenticAdapter, SimpleAction, StateDelta

# Create an adapter with budget and rate constraints
adapter = AgenticAdapter(budget_limit=100.0, rate_limit=50.0)

# Create a certifier
certifier = SafetyCertifier(adapter)

# Define an action
action = SimpleAction(
    action_id="act-1",
    agent_id="my-agent",
    state_deltas=[
        StateDelta("budget_utilization", from_value=0.0, to_value=50.0),
    ],
)

# Certify the action
cert = certifier.certify(action)
print(cert.decision)  # e.g. "Certified"
print(cert.zone)      # e.g. "Safe"
print(cert.margins)   # e.g. {"budget": 0.8, "rate": 0.95}

Convenience Function

For one-off certifications without creating a SafetyCertifier:

from qae_safety import AgenticAdapter, certify_action

adapter = AgenticAdapter(budget_limit=100.0, rate_limit=50.0)
cert = certify_action(
    adapter,
    action_id="action-1",
    agent_id="my-agent",
    deltas={"budget_utilization": 0.5},
)
print(cert.decision)

Custom Domain Adapters

Extend the kernel to any domain by subclassing DomainAdapter and ConstraintChannel:

from qae_safety import DomainAdapter, ConstraintChannel, SafetyCertifier, SimpleAction

class TemperatureChannel(ConstraintChannel):
    def name(self) -> str:
        return "temperature"

    def evaluate(self, state: list[float]) -> float:
        # Return margin in [0, 1]; 1 = safe, 0 = at boundary
        temp = state[0]
        return max(0.0, 1.0 - temp / 100.0)

    def dimension_names(self) -> list[str]:
        return ["temperature"]

class RoboticsAdapter(DomainAdapter):
    def domain_name(self) -> str:
        return "robotics"

    def constraint_channels(self) -> list:
        return [TemperatureChannel()]

    def map_action_to_state(self, action) -> list[float]:
        for delta in action.state_deltas:
            if delta.dimension == "temperature":
                return [delta.to_value]
        return [0.0]

    def detect_regime_change(self, current, proposed) -> bool:
        return False

adapter = RoboticsAdapter()
certifier = SafetyCertifier(adapter)

License

BSL-1.1 (Business Source License 1.1). Converts to Apache 2.0 on 2032-01-01.

Metadata

Release files for qae-safety 0.1.2

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

Built distributions (wheels)

Table of built distributions (wheels) for qae-safety 0.1.2
File Interpreter ABI Platform Actions
qae_safety-0.1.2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details for qae_safety-0.1.2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
qae_safety-0.1.2-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for qae_safety-0.1.2-cp314-cp314-macosx_11_0_arm64.whl
qae_safety-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for qae_safety-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Total release size: 1.1 MB

Release files / qae_safety-0.1.2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qae_safety-0.1.2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 368.7 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
880dc07da8e80fc669ece1cc28235768db3df42e596d83ed601fd5240a1c6e1e
BLAKE2b-256 checksum
How to use checksums
3ea4910b50da477418670649a7f00069efb3a7d91724ff13efeec742c95b6734
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / qae_safety-0.1.2-cp314-cp314-macosx_11_0_arm64.whl

Download URL qae_safety-0.1.2-cp314-cp314-macosx_11_0_arm64.whl
Size 313.8 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
caa9930b7cd6aa3fed0a61ba930d9c738d739e9845bc70da452ff8c2dbd425d8
BLAKE2b-256 checksum
How to use checksums
582966ef1ae805b313c6f20cfd83c7e05d7115dd577bee48b93b9abd8245a215
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.12.6

Release files / qae_safety-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qae_safety-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 369.1 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f39eafa611ce7c094c19eebd793bc00563ab473bd798de2a03c0450669a11254
BLAKE2b-256 checksum
How to use checksums
5c8184566f220b97ebaef5889720853bf3a6722d64ffd68055b589c19d361820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for qae-safety 0.1.2

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

0.1.2 This release

3 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