Skip to main content

cairn

cairn

An open-source control plane for governed ModelOps.
Fine-tune, evaluate, promote, and serve models as single governed commands — cost-capped before the GPU spins up, policy-gated, and audited end to end.

Docs Website Live demo CI PyPI Python versions License

Docs · Live demo · Install · Pipeline catalog · Gates and approvals · Extensions


What is cairn?

cairn runs the work behind AI as governed commands. You declare an outcome — gate a dataset, fine-tune a model, evaluate it against a baseline, promote it, serve it — and cairn drives the tools underneath, enforces the guardrails, and records exactly what ran.

The engine is domain-neutral. Everything that knows about a domain lives in a pack; everything that touches a tool is an operator. The engine never imports a pack — that one-way dependency is what lets the same machinery run fine-tuning, dataset checks, model evaluation, or incident response, and lets any operator inherit the budget, policy gate, and audit for free.

cairn is open source (Apache 2.0) and self-hosted: your keys, your GPUs, your logs — nothing leaves your perimeter.

Extensions

Domain packs and the operators they use are separate wheels, released from cairn-extensions. Install the ones you need next to cairndev:

Package What it adds
cairn-pack-dataset-prep Pin a dataset, audit and clean it, split it by group and register train / val / test versions
cairn-pack-finetune LoRA / QLoRA fine-tuning on a GPU box over SSH, with approvals, a priced budget, base-vs-candidate evaluation and a box that starts after approval and stops on every outcome
Operator packs Dataset checks, training, lm-evaluation-harness benchmarks, IFC validation, and the contract wheels they implement
pip install cairndev cairn-pack-finetune

Walkthrough: Fine-tune a model.

Why governed?

This is what separates cairn from a bare agent loop or a black-box tool — the work runs behind deterministic guardrails you can inspect afterward:

  • Hard budget — every run accrues cost in a scope; over the cap it raises BudgetExceeded, so a fine-tune can't quietly overspend.
  • Policy + human approval — proposed actions pass declarative policy rules before any executor runs; high-risk ones (promote a model, destroy a resource) pause for a human and resume durably from a checkpoint.
  • Reproducible runs — every run stores its validated inputs, a content- addressed schema hash, and the exact operators it resolved to. Replay any run; explain any result.
  • Tamper-evident audit — with audit.sink bound, approvals and every governed pipeline step land in a hash-chained, append-only log: what ran, what it cost, who approved it. So do direct model completions and mcp/call tool calls; a template's own prompt and agent nodes don't write a row yet. The quickstart's profile, the secure profile and the Compose stack bind it; local-dev leaves it off.
  • Citation validation — for synthesized answers, every identifier the model cites is exact-string-matched against its context; unmatched citations are stripped.

Proof it works

Every number here comes from a script you can run yourself, and each result records what it was measured on: see benchmark/.

The quickstart's path on a local engine (reproduce)

Measured Result
Engine start to answering 33.7 s
Launch to a pipeline paused at its person gate 12.1 s (median of 5, after one warm-up run)
Both approvals to a finished pipeline, nobody waiting 1.4 s (median of 5, after one warm-up run)
Nothing published before the person gate held on all 6 runs
A false data gate stops the pipeline before any later step starts, and is logged held
Each decision a person made is in the audit log with the signed-in user held for all 12 decisions
Audit chain verifies at the end held (143 rows)

cairndev 0.3.1, uv.lock 43c69f31e985, Darwin x86_64 with 8 CPUs and Python 3.13.12, 2026-11-02.

Quickstart

Run a governed pipeline on your machine: it checks a dataset, stops at a gate for you, and writes a hash-chained audit trail. No API key, no spend, about ten minutes.

curl -LsSf https://docs.cairndev.sh/install.sh | CAIRN_EXTRAS=hello sh   # or: pip install 'cairndev[hello]'
mkdir cairn-quickstart && cd cairn-quickstart
curl -LsSfO https://raw.githubusercontent.com/cairndev-sh/cairn/main/examples/hello-cairn/data/sample.jsonl
curl -LsSfO https://raw.githubusercontent.com/cairndev-sh/cairn/main/examples/hello-cairn/profiles/hello.toml
export CAIRN_PROFILE=$PWD/hello.toml                        # the example's profile: audit trail on

cairn dev --engine-only --port 8471 &                       # local engine on SQLite
cairn remote login -u dev -p dev -e http://localhost:8471
cairn remote launch hello-cairn/profile-and-publish \
  -i path=$PWD/sample.jsonl --environment sandbox --watch

The pipeline profiles the file, passes its data gate (the profile must pass and count at least 10 rows), redacts and versions the file, and stops at review, a person gate:

  paused
    profile            done                 run=run-task-data--profile-1f9a14
    data-ok            done                 run=None
    redact             done                 run=run-task-redact--text-85ecfb
    engine-check       done                 run=run-flow-hello-cairn--engine-check-55b570
    stage              done                 run=run-task-storage--put-1295cd
    review             awaiting_approval    run=None
    promote            pending              run=None
    publish            pending              run=None
    audit              pending              run=None
⏸ paused — 1 step(s) waiting on a human

Approve it, then the promotion the operator itself gates, and read the record:

cairn remote advance <pipeline_id> review     # the person gate
cairn remote advance <pipeline_id> promote    # the operator's own gate
cairn remote findings <pipeline_id>           # what every leg produced
pipeline pl_3f5b6ec6a25d414d  status=done
  …
  promote  [done] run=run-task-artifact--promote-3b4d2f
    artifact_id           sha256:d2c09d27b2874cee
    tag                   hello-sample@published
  audit  [done] run=run-task-audit--store-39b32a
    hash  af362a96212cf0d5298dfe71e81b5109d08a0219f3079387550e753f2fa25466

cairn remote pipeline <pipeline_id> prints the whole record as JSON: the plan, the inputs, and every step's state and decision. The audit trail is in ./audit.jsonl: rows for the launch, each step, each decision a person made, with the signed-in user (pipeline.gate_approved), and the row the pipeline's own audit step writes. Each row is chained to the one before it by its hash, and cairn audit verify checks the file. Try -i min_rows=1000 to watch the data gate stop the pipeline before any later step starts. The full walkthrough is the Quickstart; to look around without installing, use the live demo at https://demo.cairndev.sh (a shared sandbox, so don't enter real credentials).

From source:

git clone https://github.com/cairndev-sh/cairn && cd cairn
uv sync --extra dev
CAIRN_PACK_PATH=examples/hello-cairn uv run cairn pipeline explain hello-cairn/profile-and-publish

The engine ships as the cairndev distribution (import name cairn), carrying the builtin operator packs and the core contracts; the container image is built from Dockerfile.engine and the Helm chart lives under deploy/helm/cairn. Optional extras and team setup: Install and deploy · CLI reference.

The ModelOps lifecycle

Each stage is a normal governed run; chained together they form one auditable spine — as a template's subgraphs, or as an explicit pipeline.

flowchart LR
  D[Gate dataset] --> P[Prep · scrub · split]
  P --> T[Train · local or remote GPU]
  T --> E[Evaluate · deterministic gates]
  E --> H{{Human approval}}
  H --> R[Register · MLflow]
  R --> S[Serve · vLLM]

Deterministic gates decide pass/fail; LLM judges are advisory and off by default. Promotion pauses for a human. The shipped pipelines are listed in the pipeline catalog.

One engine, many surfaces

The same governed core is driven from two places in this repository:

  • CLI — the full control surface: run, preflight, replay, approve, deploy. → CLI reference
  • HTTP + SSE API — every control-plane action is an endpoint, including live run streaming.

Documentation

Overview What cairn is and the governance thesis
Architecture Engine, packs, profiles, request lifecycle
Write a pipeline · Capabilities and operators Packs, and how operators pick up a provider
Gates and approvals · Cost and budgets Policies, HITL gates, budget, audit
Pipelines Chain governed workflows with gates and events
Install and deploy Install, Docker Compose, Helm, sign-in
Operators catalog Every shipped operator, by domain

Contributing

Start with CONTRIBUTING.md: the dev loop, where each kind of test lives, and the DCO sign-off every commit needs. Self-contained starting points are labelled good first issue.

Contributors

Status & license

cairn is in early access and under active development. The API and command surface may still change between releases; see CHANGELOG.md.

Licensed under the Apache License 2.0 — see LICENSE. Contributions are welcome: read CONTRIBUTING.md first.

Metadata

Release files for cairndev 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cairndev 0.4.0
File Size Uploaded Provenance Actions
cairndev-0.4.0.tar.gz 2.2 MB Without provenance Details for cairndev-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cairndev 0.4.0
File Interpreter ABI Platform Actions
cairndev-0.4.0-py3-none-any.whl Python 3 none any Details for cairndev-0.4.0-py3-none-any.whl

Total release size: 4.2 MB

Release files / cairndev-0.4.0.tar.gz

Download URL cairndev-0.4.0.tar.gz
Size 2.2 MB
Tags Source
SHA-256 checksum
How to use checksums
2462b5ade031f02bb6ded35d79393466d59d7fbc8f751f9b867ee954727e4742
BLAKE2b-256 checksum
How to use checksums
7f413a574bfedd4de7b92f79199a896b2807d4e9da6bf456dbdb37d39641a6b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / cairndev-0.4.0-py3-none-any.whl

Download URL cairndev-0.4.0-py3-none-any.whl
Size 2.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
f9dfc6d2c65079ee3f7fe1c7f98613d42e97be42bfdd8880331cb00dd89b4b5f
BLAKE2b-256 checksum
How to use checksums
67ed00185b0a397f9216feb72efaed26fd9455131b5463327c728e3ca096a9f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for cairndev 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page