Architecture
Overview
Briefcase AI is a layered system: a Rust core provides high-performance snapshot management, PyO3 bindings expose it to Python, and framework integrations connect to popular AI libraries.
graph TD
A[Framework Integrations] --> B[Python Package]
B --> C[PyO3 Bindings]
C --> D[Rust Core]
D --> E[Storage Backends]
Rust Core
The Rust core handles:
DecisionSnapshotcreation and serialization- Storage backend abstraction
- Replay engine
- Drift detection algorithms
PyO3 Bindings
PyO3 bridges Rust and Python. The bindings are built with maturin and provide zero-copy access to Rust data structures where possible.
Python Package
The Python layer adds:
@capturedecorator- Extensible framework protocols (guardrails, exporters, routers, events)
- Configuration and lazy imports
Decision Flow
sequenceDiagram
participant App
participant Capture as capture decorator
participant Core as Rust Core
participant Storage
App->>Capture: call function
Capture->>Core: create DecisionSnapshot
Core->>Storage: persist snapshot
Storage-->>Core: snapshot ID
Core-->>Capture: snapshot reference
Capture-->>App: function result