Skip to main content

AiBlackBox

AiBlackBox is a universal logging and auditing system for AI and machine learning models. It acts like a “flight recorder” for AI, capturing inputs, outputs, parameters, and metadata of all monitored functions, objects, or classes. Designed for transparency, reproducibility, and debugging, it ensures that AI models are traceable, auditable, and compliant with ethical standards.

Features

Automatic logging of AI model actions Capture all inputs, outputs, parameters, and metadata in real-time.

Function, object, class, and module patching Easily patch functions or entire modules to track behavior without modifying your original code.

Flexible backends Use in-memory logging for testing or connect to persistent storage backends for long-term auditing.

Serialization-safe Handles complex objects safely with customizable serializers.

Replay and audit Inspect recorded actions to debug, audit, or verify model behavior.

Supports AI frameworks out-of-the-box Designed to work with PyTorch, TensorFlow, scikit-learn, and other AI pipelines.

Installation

Install from PyPI:

pip install aiblackbox

For testing purposes, you can use TestPyPI:

pip install --index-url https://test.pypi.org/simple/ aiblackbox

Quick Start from aiblackbox import BlackBox

Initialize the BlackBox

bb = BlackBox()

Log a simple event

bb.log('prediction', {'input': [1,2,3], 'output': 0.95})

Replay logs

for entry in bb.replay(): print(entry)

Public API

The following functions and classes are available for advanced usage:

from aiblackbox import *

Function & object patching

patch_function patch_object patch_module patch_class apply_generic_patches auto_patch_ai_functions

Logging and backends

set_log_backend get_memory_backend LogBackend MemoryBackend

Serialization & safe logging

safe_serialize register_custom_serializer set_max_depth get_and_clear_fallback_logs

Unpatching

unpatch_object unpatch_all

Example: Patching a Function from aiblackbox import BlackBox, patch_function

def my_ai_model(x): return x**2

bb = BlackBox() patched_model = patch_function(my_ai_model, bb.log)

Call patched function

result = patched_model(5)

Replay logs

for entry in bb.replay(): print(entry)

Contributing

Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.

License

Distributed under the MIT License. See LICENSE for details.

About

AI Ethics Institute — Our mission is to provide tools for AI transparency, auditability, and accountability, helping organizations build ethical AI systems.

Metadata

Release files for aiblackbox 0.1.2

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

Source distribution (sdist)

Source distribution for aiblackbox 0.1.2
File Size Uploaded Provenance
aiblackbox-0.1.2.tar.gz 20.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiblackbox 0.1.2
File Interpreter ABI Platform
aiblackbox-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 37.2 kB

Release files / aiblackbox-0.1.2.tar.gz

Download URL aiblackbox-0.1.2.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6d2affbbfd3872a677424abbb0258372407e101a9488ff14eec01c04a63b5027
BLAKE2b-256 checksum
How to use checksums
97acbac946b3a89e7f5d89b4f7a45794ff62eb9e672e8bed3e92e93b063e2f24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / aiblackbox-0.1.2-py3-none-any.whl

Download URL aiblackbox-0.1.2-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e243583c8c7b163590fab73e0040fdef14f5025e5eb57ee9ed7271e8a77f73f5
BLAKE2b-256 checksum
How to use checksums
f3e82c643be8929615a576de34e804a57cea2b9a948233a6d68d70d8c8937bff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Security for aiblackbox 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

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