Skip to main content

harness-lock (hlock)

Lock your agent into place.

hlock treats an agent system the way a package manager treats dependencies. You bring your domain tasks, the models you're allowed to use, and the harness you like. hlock searches the stack, measures it, and writes a harness.lock: a pinned, version-controlled, enforceable description of the agent that actually works for your domain.

Package manager hlock
pyproject.toml harness.toml — the manifest: what you allow and require
dependency resolver tuner: search over LLMs × decision models × harnesses × policies
uv.lock harness.lock — the lockfile: what was chosen, pinned, hashed, plus the evidence
CI --locked check hlock check — fail if the running stack drifts from the lock

See SPEC.md for the full design (manifest, lockfile schema, component model, task packs, search strategies, the Flyte backend, open-weights models). The (superseded) reference pure-Python implementation is preserved under python-legacy/.

Architecture

            Python API/CLI  (import harness_lock as hlock, `hlock` command)     <- PyO3 bindings
                         │
                         ▼
                  harness-lock-core (Rust)     manifest · lockfile · store ·
                                           task packs · search · tuner
                         │  │
         local (reference)│  └── devbox / cluster: Python worker
                         ▼        (harness_lock.tasks.worker)
                in-process                │  └── optional Flyte raise
                                          ▼       (flyte plugins-rs)
                                    real LLM · data · finetune
  • crates/harness-lock-core — the core library (pure Rust, no Python). It stays the orchestrator + aggregator; it never does heavy compute itself.
  • crates/harness-lock — PyO3 extension (harness_lock._harness_lock) exposing the same user-facing Python API as the reference implementation via the harness_lock package.
  • harness_lock/ — the mixed Python package: re-exports the compiled harness_lock._harness_lock, the hlock CLI, and the heavy-work Python worker (harness_lock/tasks/worker.py).
  • crates/harness-lock-core/src/worker.rs — the Rust↔Python bridge: a PythonAdapter (behind the HarnessAdapter trait) that shells trials out to the worker over a versioned JSON contract. See Backends.
  • crates/harness-lock-core/src/flyte.rs — provisional flyte-sdk-rs integration behind the flyte cargo feature (not yet validated).

The Rust vs Python split for hlock optimize: pure/deterministic logic — manifests, lockfiles, search planning, trial bookkeeping, evidence aggregation, lock construction — lives in Rust. Ecosystem- and GPU-heavy work — real LLM calls, user-trace loading (pandas/polars), synthetic data, model grading, prompt search, LoRA fine-tuning — lives in the Python worker, which runs where the Python toolchain does (devbox / flyte local / cluster) and may itself raise each body to a real Flyte task. The Rust core only ever speaks the JSON contract, so it never depends on where the work ran.

Install

From the Rust side you depend on the crate; from Python you get native bindings.

# Python bindings — pip / uv / uvx
pip install harness-lock          # or: uv add / uvx
uv pip install -e .                            # editable dev install (this repo)

# Rust crate(s)  (publish later; locally)
cargo add harness-lock --path crates/harness-lock
# core library, if you depend on it directly
cargo add harness-lock-core --path crates/harness-lock-core

A local editable build needs a Rust toolchain + a Python ≤3.13 interpreter:

python3.13 -m venv .venv && .venv/bin/pip install click pytest
maturin develop -m crates/harness-lock/Cargo.toml      # builds + installs the hlock wheel

Quickstart (local, no accounts)

hlock init --name demo --pack ./tasks   # write a starter harness.toml
hlock resolve                              # tune the search space -> harness.lock + report
hlock show                              # pretty-print the locked stack + evidence
hlock check                             # static verification (CI-friendly exit code)
hlock tree                              # component dependency graph
hlock run "solve this task"             # run the locked agent with the runtime guard
hlock backend status                    # report the active backend / Flyte config

The built-in reference provider and harness are deterministic and offline, so the whole loop runs with zero setup and no API keys.

Python API (Layer 1)

import harness_lock as hlock
from harness_lock import SearchSpace, Objective, Budget

space = SearchSpace(
    llm={"planner": ["reference:qwen-7b", "reference:qwen-32b"]},
    decision=["none", "rules:default"],
    harness=["reference"],
    tasks='{"packs": ["./tasks"], "seeds": 2}',
)
lock = harness.lock(space, backend="local", workdir=".harnesslock")
print(lock.summary())

agent = hlock.load("harness.lock")
print(agent.run("clean ./data/orders.csv"))

Backends

  • local — in-process Rust reference harness (default; deterministic, offline, CI-friendly).
  • devbox / cluster — the Rust core drives the Python worker (python -m harness_lock.tasks.worker) over a versioned JSON contract. The worker runs each heavy work item where the Python toolchain and GPUs live, and best-effort raises it to a real Flyte task via the Python flyte / flyteplugins-rs packages (~/.flyte/config.yaml). When the optional deps are absent it degrades gracefully (deterministic LLM fallback, in-process Flyte lift, availability flags).

Select the backend with --backend local|devbox|cluster (or hlock resolve --backend …), which overrides the manifest's [backend] target. The interpreter the worker runs under is taken from $HL_PYTHON (default python3) — pin it to the interpreter that has harness-lock installed.

hlock optimize --backend devbox --depth probe --max-trials 10
# real LLM calls: export HL_LLM_BASE_URL=http://… HL_LLM_MODEL=qwen-32b [HL_LLM_API_KEY=…]
hlock optimize --backend cluster --depth ft --data user:./runs   # LoRA on a GPU worker

Development

cargo test -p harness-lock-core            # Rust core + integration tests
.venv/bin/python -m pytest tests  # Python bindings tests
ruff check hlock/tests              # lint the Python layer

Release & publishing

CI/CD publishes on git tags v* (and via workflow_dispatch):

  • Python bindings → PyPI as harness-lock (.github/workflows/publish-python.yml). maturin builds an abi3 wheel (CPython ≥ 3.9) for Linux/macOS/Windows and a source dist. Publishing uses trusted publishing (OIDC) — register this GitHub repo as a PyPI publisher for the pypi environment — or set a token. For test-PyPI publishes, run the workflow with --pypi test and set TEST_PYPI_TOKEN.
  • Rust crates → crates.io as harness-lock-core (dependency) then harness-lock (.github/workflows/publish-cargo.yml). Set the CARGO_REGISTRY_TOKEN secret.

Daily CI (ci.yml) runs cargo test for the core and pytest + ruff for the bindings on Python 3.9/3.12/3.13.

git tag v0.1.0 && git push origin v0.1.0   # triggers both publishing workflows

Status

Early v0.1 (Rust core): manifest + lockfile schema v1, content-addressed store, task packs with graders, reference provider/harness, grid search + Pareto selection, a working init / lock / show / check / tree / run / backend CLI via PyO3 bindings, and installable via pip/uv (crate not yet published).

Metadata

Release files for harness-lock 0.1.2

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

Source distribution (sdist)

Source distribution for harness-lock 0.1.2
File Size Uploaded
harness_lock-0.1.2.tar.gz 70.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for harness-lock 0.1.2
File
harness_lock-0.1.2-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
harness_lock-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
harness_lock-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
harness_lock-0.1.2-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
harness_lock-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 5.1 MB

Release files / harness_lock-0.1.2.tar.gz

Download URL harness_lock-0.1.2.tar.gz
Size 70.8 kB
Tags Source
SHA-256 checksum
How to use checksums
37c3e2034866755123639d543cd3b087573501a267050b105afb1ce44cf24c58
BLAKE2b-256 checksum
How to use checksums
0cbc29c7b1fc66f3b71da0fa11765db4bf85e11b9b78eb6cda7729ad49b211a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / harness_lock-0.1.2-cp39-abi3-win_amd64.whl

Download URL harness_lock-0.1.2-cp39-abi3-win_amd64.whl
Size 943.7 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4cc6af36ba6baa500eddccc85692980a9f3445d4a7faf758046e1acafc46af87
BLAKE2b-256 checksum
How to use checksums
ddcfef72b03f29574767cc5e3c99aada5b9993b61781ade948696e442f9ae76e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / harness_lock-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL harness_lock-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
e9619d42b58309211893ed07e414c4483d54fb310a4da0ed1f9dc348f7b3890c
BLAKE2b-256 checksum
How to use checksums
3fe5d30458024cef326c07c27834f5b07d6ec53cd71b79a12347c79262f3c02a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / harness_lock-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL harness_lock-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.0 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9f8bdde47951ec4d347176c29d0d52fb337d3b72b4c9989042e0116452111a2a
BLAKE2b-256 checksum
How to use checksums
53a8aa8d9adb67e2d46163bdd8e6bdeaf80f540349058df2c490db62ec516305
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / harness_lock-0.1.2-cp39-abi3-macosx_11_0_arm64.whl

Download URL harness_lock-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
Size 956.6 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cc8055ec6ee0952c8b389c4f9ac5c6f6327553d900bad398bdf10e438cd9bf2a
BLAKE2b-256 checksum
How to use checksums
310b2fc196ceb23f24bd2ffd24baeb30ddba9d1cd684c0358cfacd032517cf6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / harness_lock-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl

Download URL harness_lock-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl
Size 1.0 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a7febc897398809d2e78511e0cf0f3345a46f3d2a3e17cc576abe6aaf0741ffb
BLAKE2b-256 checksum
How to use checksums
b9a170694633bc2077790da8d988999b4dfa68d89f9a488e9147ad189d75e915
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

6 release files

0.1.1

5 release files

0.1.0

5 release files

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