Sacred is an open-source Python library for ML experiment tracking that automates parameter injection, artifact logging, and environment reproducibility.
Sacred is a Python library that structures, records, and reproduces computational experiments. Its primary architectural mechanism is configuration injection, which inspects function signatures and local scopes to supply hyperparameters without configuration dictionaries. By pairing automatic git and environment tracking with modular storage observers, it turns standalone training scripts into auditable execution records.
Sacred sits between dedicated configuration managers like Hydra and full-lifecycle tracking platforms like MLflow or Weights & Biases. Unlike client-server platforms that rely on background logging daemons and frequent HTTP requests, Sacred runs entirely in-process. Metrics and metadata are captured directly inside the Python runtime with negligible CPU overhead. For training routines where database writes could stall GPU execution, an asynchronous queue observer delegates persistence to a separate worker thread to preserve training throughput.
This embedded design eliminates server management, but lacks the visual tooling of modern platforms. Sacred provides no integrated web dashboard, leaving users dependent on community-built frontends like Omniboard or Sacredboard that receive infrequent updates. Furthermore, its parameter injection inspects local function scopes at runtime. While this removes boilerplate from small scripts, it bypasses static type analysis and degrades IDE autocompletion across large multi-module repositories.
@ex.config directly into function arguments by name, removing manual dictionary parsing.QueueObserver to a background worker process, ensuring metric logging never bottlenecks GPU loops.MongoObserver do not cache writes locally if network connectivity drops, risking lost telemetry during outages.Is Sacred free for commercial use? Yes. Sacred carries the permissive MIT license, permitting organizations to embed the library into commercial training workflows without licensing fees.
How does Sacred compare to MLflow? Sacred functions as an in-process library for parameter injection and execution logging, whereas MLflow provides a broader platform with a built-in dashboard, model registry, and deployment services.
Can Sacred record experiment runs without running MongoDB?
Yes. You can attach a local FileStorageObserver or TinyDbObserver to record configurations, metrics, and artifacts directly to the filesystem without external databases.
Sacred provides developers and DevOps engineers with an efficient, zero-infrastructure experiment harness when local execution speed and dependency auditing matter more than an integrated web dashboard. Its unarchived repository remains actively maintained with updates through late 2025, while the permissive MIT license allows teams to incorporate its parameter injection and observer architecture directly into production training workflows without legal friction.
Go, gRPC and Protobuf done right, LLM agents in production, and the hard parts of shipping a first product.
Show that Sacred is listed as an open-source alternative. Paste into your README: