Skip to main content
hlock logo

hlock

Make your agent harness pinnable, portable, and tunable.

Tune your agent stack against your own tasks, then pin the winner in a harness.lock.

PyPI crates.io CI Docs Python License

Documentation · Quickstart · CLI reference · Design spec


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 every candidate against your tasks, and writes a harness.lock: a pinned, version-controlled, enforceable description of the agent that actually works for your domain, along with the evidence for choosing it.

You know this from package managers In hlock
📄 pyproject.toml harness.toml, the manifest: what the resolver may try, and what "best" means
🧮 dependency resolver the resolver: search over LLMs × decision models × harnesses × policies
🔒 uv.lock / Cargo.lock harness.lock, the lockfile: what was chosen, pinned and hashed, plus the evidence
✅ CI --locked check hlock check: fail when the manifest drifts from the lock

Install

pip install hlock        # or: uv add hlock  ·  uvx hlock --help

Prebuilt wheels cover Linux (x86_64, aarch64), macOS (arm64, x86_64), and Windows (x64) for CPython 3.9+. For Rust, use cargo add hlock.

Quickstart

No accounts or API keys needed. The built-in reference provider and harness are deterministic and offline, so the whole loop runs on a laptop.

hlock init --name demo --pack ./tasks   # write a starter harness.toml
hlock resolve                           # tune the search space -> harness.lock
hlock check                             # fail if harness.toml drifted from the lock
hlock run "clean ./data/orders.csv"     # run the locked agent

An hlock session: init, resolve, check, and run

From there: hlock show prints the locked stack and its evidence, hlock tree prints the component graph, hlock upgrade plans model upgrades, and hlock optimize tunes prompts, hyperparameters, and small models into a harness.opt.lock.

Already have a harness set up?

Pin it. hlock pin captures your Claude Code, Codex, Pi, OpenCode, Hermes or Cursor setup into harness.lock: the harness version, the models and local runtimes it uses, MCP servers, skills, plugins, and config, with secrets replaced by placeholders.

hlock harness list      # the harnesses on this machine, and the one you're running inside
hlock pin               # lock your current setup into harness.lock
hlock check             # fail if your setup drifted from the pin
hlock sync              # on another machine: rehydrate it (also --prefix DIR, --docker)
hlock launch            # start a session that matches the lock (or: hlock launch opencode)
hlock localize          # an all-local equivalent: local harness + Ollama/LM Studio models

See Harnesses and Pinning your setup, Rehydrating with sync, and Launching a locked harness.

Python API
import json
import hlock
from hlock import SearchSpace, Objective, Budget

space = SearchSpace(
    llm={"planner": ["reference:qwen-7b", "reference:qwen-32b"]},
    decision=["none", "rules:default"],
    harness=["reference"],
    objective=Objective(select="min-cost", constraints={"success-rate": ">=0.5"}),
    budget=Budget(max_trials=50),
    tasks=json.dumps({"packs": ["./tasks"], "seeds": 2}),
)
lock = hlock.resolve(space, backend="local")   # writes ./harness.lock
print(lock.summary())

agent = hlock.load("harness.lock")
print(agent.run("clean ./data/orders.csv"))   # {"success": true, "model": "qwen-7b", ...}

How it works

How hlock works: harness.toml and task packs feed hlock resolve (search, evaluate, select), which writes harness.lock for hlock check and hlock run

Architecture

A Rust core does all the deterministic work. Anything that needs the Python ML ecosystem or a GPU runs in a Python worker, which can lift each piece of work to a Flyte task on a cluster.

hlock architecture: Python CLI and API over a Rust core via PyO3; local runs in process, devbox and cluster hand work to a Python worker that can lift stages to Flyte or Union tasks

Path What lives there
crates/harness-lock-core The core library (pure Rust): manifests, lockfiles, search planning, trial bookkeeping, evidence, lock construction. It orchestrates and aggregates, and never does heavy compute itself.
crates/harness-lock-py PyO3 bindings, compiled into harness_lock._harness_lock and shipped only inside the wheel.
crates/hlock, crates/harness-lock Thin crates that re-export the core (harness-lock is the alias).
harness_lock/ The Python package: the hlock CLI and the heavy-work worker (tasks/worker.py).
hlock/ A shim that re-exports harness_lock, so import hlock works.
packaging/harness-lock The harness-lock PyPI alias, which pins the matching hlock release.
docs/ The documentation site (Zensical), published to GitHub Pages.

Backends

Backend Where trials run Use it for
local (default) in-process Rust reference harness trying it out, CI, deterministic tests
devbox Python worker on this machine real LLM calls, your own traces, flyte local
cluster Python worker that lifts each stage to Flyte/Union GPUs, fan-out, durable caching, shared results
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

See Backends for setup and the HL_* environment variables.

Development

Development uses uv and a Rust toolchain.

uv sync                            # create .venv, build the Rust extension, install dev tools
uv run pytest                      # Python bindings, CLI, worker
uv run ruff check harness_lock hlock tests
cargo test -p harness-lock-core    # Rust core + integration tests

uv run --group docs zensical serve # docs at http://localhost:8000

uv run rebuilds the extension automatically when Rust sources change.

Want to help? See the contributing guide. Releases are cut from tags. See RELEASING.md.

Status

hlock is at v0.1. What works today: manifest and lockfile schema v1, a content-addressed store, task packs with graders, the reference provider and harness, grid search with Pareto selection, upgrade (plan/apply/rollback), and optimize across the local, devbox, and cluster backends. SPEC.md describes the full design, much of which is still on the roadmap.

License

Apache-2.0

Metadata

Release files for hlock 0.2.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 hlock 0.2.0
File Size Uploaded
hlock-0.2.0.tar.gz 157.0 kB Details

Built distributions (wheels)

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

Total release size: 9.6 MB

Release files / hlock-0.2.0.tar.gz

Download URL hlock-0.2.0.tar.gz
Size 157.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5acafcf05053f2c4bff7b838a4bb9a3093136f43c141dc9c6491bccca692f85d
BLAKE2b-256 checksum
How to use checksums
d7981d9994ec3f97be3832e6f5a9ee87332b625436964a8ed5a326c5d3490d06
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 / hlock-0.2.0-cp39-abi3-win_amd64.whl

Download URL hlock-0.2.0-cp39-abi3-win_amd64.whl
Size 1.9 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
517405d3c13b698a92cf6369d3ac7a4248b2210aba2ed6ce77e3505275063bd9
BLAKE2b-256 checksum
How to use checksums
57e3a68d2e8564032abea4460a04b074627c673cc1874aa24606efaae75b3037
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 / hlock-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hlock-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.0 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c5783e7b6541d14ca2a65542811e3667e98e79671a87f036f8a91f535b8ef93b
BLAKE2b-256 checksum
How to use checksums
6be78265da658e7524af6eb106df72248f0f17f57d50f47014bd9b338777a0f0
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 / hlock-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL hlock-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.9 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a6e921d2f289aabd07c30eeb9b2044ca2a37c45f0b9ceef5b5703a71c3ba6a0c
BLAKE2b-256 checksum
How to use checksums
38df9d272ebe95cd8341ba49e362a7a81b2f789715c1afce0b5a13b7150c4fcf
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 / hlock-0.2.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL hlock-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Size 1.8 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3ccff69810777392cfdd2ea3754809c56346810398a215d8c2310edc95f81907
BLAKE2b-256 checksum
How to use checksums
123e07298bd629a2b603a4ea0a137de1f2aee8b994040b7512c398e68e0ddcc9
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 / hlock-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL hlock-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 1.9 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
553dbb2ce00cb1331224a63cb929be78b92fbf66a85bb9259135d0df1f3edc23
BLAKE2b-256 checksum
How to use checksums
4d2c9d6b30987613c9057ba13a502c9ed435e8d9db9d7d731fdb32909f9e4daf
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

0.3.1

6 release files

This release

0.2.0 This release

6 release files

0.1.2

2 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