Skip to content

Python SDK

Install

Terminal window
pip install briefcase-ai

Import Paths

from briefcase import DecisionSnapshot, Snapshot, init
from briefcase.decorators import capture
from briefcase.replay import ReplayEngine
from briefcase.drift import DriftCalculator, DriftMetrics
from briefcase.cost import CostCalculator, CostEstimate
from briefcase.sanitize import Sanitizer
from briefcase.storage import SqliteBackend, BufferedBackend
from briefcase.validation import PromptValidationEngine
from briefcase.guardrails import GuardrailEnv, GuardrailRegistry
from briefcase.rag import VersionedEmbeddingPipeline
from briefcase.correlation import BriefcaseWorkflowContext
from briefcase.external_data import ExternalDataTracker
from briefcase.routing import BaseRouter, RoutingDecision
from briefcase.events import BriefcaseEvent, emit
from briefcase.exporters import BaseExporter

The @capture Decorator

from briefcase import capture
@capture()
def my_llm_call(prompt: str) -> str:
return client.chat(prompt)

Every call to my_llm_call creates a DecisionSnapshot containing inputs, outputs, model parameters, and execution context.

Configuration

from briefcase import configure
configure(
storage_backend="sqlite",
database_path="./decisions.db",
enable_otel=True,
)

Extras

Install only what you need. See Installation for the full extras table.

Lazy Imports

Extras use lazy imports. If you try to use a feature without its extra installed, you get a clear error:

ImportError: briefcase.replay requires the 'replay' extra.
Install it with: pip install briefcase-ai[replay]