Skip to main content

Crate briefcase_core

Crate briefcase_core 

Source
Expand description

§Briefcase AI Core Library

High-performance AI observability, replay, and decision tracking for Rust applications.

§Features

  • 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
  • Cost Management: Track and optimize AI model usage costs
  • Cross-Platform: Works on Linux, macOS, Windows, and WebAssembly

§Quick Start

use briefcase_core::*;
use briefcase_core::storage::StorageBackend;
use serde_json::json;

// Create a decision snapshot
let decision = DecisionSnapshot::new("ai_function")
    .add_input(Input::new("user_query", json!("Hello world"), "string"))
    .add_output(Output::new("response", json!("Hello back!"), "string").with_confidence(0.95))
    .with_execution_time(120.5);

// Save to storage (requires storage feature)
#[cfg(feature = "sqlite-storage")]
{
    let storage = storage::SqliteBackend::in_memory()?;
    let decision_id = storage.save_decision(&decision).await?;
    println!("Saved decision: {}", decision_id);
}

§Feature Flags

  • recording - Baseline decision capture pipeline (enabled by default)
  • async - Enable async/await runtime support (enabled by default)
  • storage - Enable persistent storage APIs (enabled by default)
  • sqlite-storage - SQLite storage backend (implied by storage)
  • chain - Hash-chained, append-only SQLite store with signed Merkle checkpoints (implies sqlite-storage)
  • vcs-storage - Version-control storage abstractions (implies async)
  • replay - Deterministic replay engine
  • drift - Drift monitoring utilities
  • sanitize - Built-in PII sanitization
  • otel - OpenTelemetry instrumentation helpers
  • tokens - Token counting utilities
  • networking - HTTP client support for remote services
  • compression - Reserved; currently enables nothing

Re-exports§

pub use cost::*;
pub use models::*;

Modules§

control
Control plane trait and implementations for client lookup
cost
Cost calculation and management functionality
integrity
RFC 8785 canonical JSON, Merkle proofs and Ed25519 signing (chain) Evidence primitives: RFC 8785 canonical JSON, Merkle proofs and (with the chain feature) Ed25519 signing compatible with briefcase.integrity.
models
Core data models and structures
storage
Storage backends for persisting decisions and snapshots

Enums§

BriefcaseError

Constants§

DEFAULT_API_URL
The default base URL for the Briefcase AI API.