Briefcase Core
The core Rust library for Briefcase AI - High-performance AI observability, replay, and decision tracking.
Features
- High Performance - Zero-copy serialization and minimal memory overhead
- AI Decision Tracking - Capture inputs, outputs, and context for every AI decision
- Deterministic Replay - Reproduce AI decisions exactly with full context preservation
- Comprehensive Observability - Monitor model performance, drift, and behavior
- Enterprise Security - Built-in data sanitization and privacy controls
- Flexible Storage - SQLite, cloud storage, and custom backends
- Cross-Platform - Works on Linux, macOS, Windows, and WebAssembly
Installation
Add to your Cargo.toml:
[]
= "2.0.4"
Quick Start
use *;
use json;
async
Core Components
DecisionSnapshot
The main data structure for tracking AI decisions:
let decision = new
.with_module
.add_input
.add_output
.with_model_parameters
.with_execution_time
.add_tag;
Model Parameters
Track model configuration for reproducibility:
let params = new
.with_provider
.with_version
.with_parameter
.with_hyperparameter;
Execution Context
Capture environment for deterministic replay:
let context = new
.with_runtime_version
.with_dependency
.with_random_seed
.with_env_var;
Storage Backends
SQLite
// In-memory database
let storage = in_memory?;
// File-based database
let storage = file?;
Custom Storage
Implement the StorageBackend trait for custom storage solutions:
use StorageBackend;
use async_trait;
;
Features
Default Features
[]
= "2.0.4"
Async Support
[]
= { = "2.0.4", = ["async"] }
Storage Backends
[]
= { = "2.0.4", = ["sqlite-storage"] }
Sync Only (for WebAssembly)
[]
= { = "2.0.4", = false, = ["sync-only"] }
Advanced Usage
Data Sanitization
use Sanitizer;
let sanitizer = new;
let result = sanitizer.sanitize;
println!;
Drift Detection
use DriftCalculator;
let calculator = new;
let outputs = vec!;
let metrics = calculator.calculate_drift;
println!;
Cost Calculation
use CostCalculator;
let calculator = new;
let estimate = calculator.estimate_cost?;
println!;
Performance
- Zero-copy operations - Efficient data handling without unnecessary allocations
- Minimal overhead - Designed for high-throughput production environments
- Memory efficient - Optimized data structures and algorithms
- Concurrent processing - Thread-safe operations with async support
Platform Support
- Linux - All distributions with glibc 2.17+
- macOS - 10.12+ (Sierra and later)
- Windows - Windows 7+ (with latest updates)
- WebAssembly - Browser and Node.js environments
Language Bindings
This core library powers bindings for other languages:
- Python:
briefcase-ai- Python package - WebAssembly:
briefcase-wasm- NPM package for browsers and Node.js
Contributing
- Fork the repository
- Create a feature branch
- Make your changes in
crates/core/ - Run tests:
cargo test -p briefcase-core - Submit a pull request
Documentation
- API Documentation: docs.rs/briefcase-core
- Homepage: briefcasebrain.com
- Examples and Integration Guide: docs.briefcasebrain.com
License
GPL-3.0 License - see LICENSE file for details.
Related Crates
briefcase-wasm- WebAssembly bindingsbriefcase-python- Python FFI bindings
Briefcase AI - Making AI decisions transparent, reproducible, and observable.