Skip to main content

harness-proxy

A model server that stands in for a provider to agent harnesses: OpenAI Chat Completions and Anthropic Messages, streaming or not, sampled from Tinker or from a Together post-training session. The run opens each trial on it, and closing the trial hands back every call the trial made as token ids and sampler logprobs, so a trainer can train on exactly what was sampled.

flowchart LR
    run["the run, through client"] -->|"open: lane, renderer, weights or follow"| trial["trial: budget, records, bridge index"]
    run -->|"serve: a lane's new weights"| trial
    harness["harness"] -->|"OpenAI or Anthropic call, with the trial's token"| dialect["dialects"]
    dialect --> rendering["rendering: complete the call"]
    rendering -->|render| bridge["bridge"]
    rendering -->|sample| trial
    trial --> backend["backends: tinker, together"]
    run -->|"close: its records"| trial

On each call it renders with the model's cookbook renderer, images, PDFs and mid-conversation system messages included, encoding each message once per trial; builds the prompt from its own tokens when the history quotes one of its replies; answers an SDK retry with the first reply; returns thinking in the API's own format; and keeps slow streams alive.

Run it

harness-proxy --model Qwen/Qwen3-8B --advertise host.docker.internal

It serves the model in one lane, named agent unless --lane names another, prints serving <lanes> at http://<host>:<port> and serves until SIGTERM. Its control token, which opens and closes trials, comes from HARNESS_PROXY_CONTROL_TOKEN, or is generated and printed.

Route Token What
POST /trials control {"trial": "<name>", "lane": ..., "renderer": ..., "weights": "tinker://..." | null, "follow": false} opens a trial and answers {"token": ...}; each but trial may be left out: the only lane, its first renderer, its base model. With "follow": true, each call takes the weights the lane published last as it starts, instead of weights. The same opening asked again answers the same token
POST /lanes/<lane>/serve control {"weights": "tinker://..." | null, "version": ...} publishes the lane's new weights: each call of a trial that follows the lane takes them from then on. version, for a backend that serves only the weights published last, is the one it gave them
POST /v1/chat/completions, /v1/messages the trial's the model of the trial's lane, at its weights or the ones the lane published last, rendered with its renderer, recorded under the weights that answered it
POST /trials/<trial>/close control closes the trial and answers its records, each prompt as a delta of the record it extends; a close asked again within 30 minutes answers the same
GET /healthz none each lane: its model, the per-trial budget, and its renderers

A call whose token no open trial holds is turned away with a 401, as is a call of a trial that closed. A trial opened on weights keeps them until it closes, so trials on several versions of a lane's model run side by side. A trial that follows its lane takes the weights published last at each call, and a call in flight keeps the ones it started with.

By hand, with the control token it printed:

token=$(curl -s -H "Authorization: Bearer $HARNESS_PROXY_CONTROL_TOKEN" \
  -d '{"trial": "t-0"}' http://localhost:8000/trials | jq -r .token)
OPENAI_BASE_URL=http://localhost:8000/v1 OPENAI_API_KEY=$token my-harness
curl -s -X POST -H "Authorization: Bearer $HARNESS_PROXY_CONTROL_TOKEN" \
  http://localhost:8000/trials/t-0/close

From Python

from harness_proxy.client import Proxy

settings = {"lanes": [{"name": "agent", "model": "Qwen/Qwen3-8B"}]}
proxy = await Proxy.local(settings, host="host.docker.internal")  # or .tunnelled, or .remote
lanes = await proxy.ready()  # each lane's Served, as /healthz reports it
await proxy.serve("agent", "tinker://.../sampler_weights/000010")
token = await proxy.open("trial-0", lane="agent", follow=True)  # or weights="tinker://..."
# the harness dials proxy.address (proxy.local_address from this machine) with `token`
await proxy.serve("agent", "tinker://.../sampler_weights/000011")  # its next call takes them
records = await proxy.close("trial-0")  # harness_proxy.wire.Record, in request order
proxy.stop()
  • Lanes: a proxy serves one or more models, each in a lane of its own, which a trial is opened on. A run lists them in --settings as one document, {"lanes": [...]}, each lane whole: a name, a model, and any of its own renderer, temperature, top_p, top_k, max_tokens, max_context, fill_context, metadata, backend, session, base_url and api_key_env. The proxy fills nothing in. A lane needs its model's context length, for the budget and the context fit: its backend reports it, and a lane whose backend cannot must give its own max_context, or the proxy refuses to start. --model and --renderer are shorthand for a document of one lane.
  • Trials: each samples the weights it was opened on, or, following its lane, the weights the lane published last as each call starts, through a client its lane holds while a trial or a call uses them; each record names the weights that answered it. A trial keeps its own records, budget and bridge index until it closes. The run opens and closes trials with the control token; a sandbox holds only its own trial's token.
  • Renderers: a lane's renderer, a list, builds each, such as two reasoning efforts; a trial opened with one is rendered with it.
  • Tunnels: Proxy.tunnelled puts a Cloudflare quick tunnel in front, for sandboxes with no route back (Modal, Daytona). A proxy the run starts stops once the run is gone, leaving no process, port, session or tunnel.
  • Together: a lane's backend = "together" samples the generator of the run's session (session): the weights published last, whatever a trial names, each record naming them by the version that wrote it, text only, stopping on strings or at the end of sequence. It needs harness-proxy[together] and TOGETHER_API_KEY.

Develop

cd packages/harness-proxy && pytest

The tests run on fake samplers and renderers (tests/proxies.py); one that needs a real tokenizer skips when it is not cached.

Metadata

Release files for harness-proxy 0.1.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 harness-proxy 0.1.0
File Size Uploaded Provenance Actions
harness_proxy-0.1.0.tar.gz 108.4 kB With provenance Details for harness_proxy-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for harness-proxy 0.1.0
File Interpreter ABI Platform Actions
harness_proxy-0.1.0-py3-none-any.whl Python 3 none any Details for harness_proxy-0.1.0-py3-none-any.whl

Total release size: 175.1 kB

Release files / harness_proxy-0.1.0.tar.gz

Download URL harness_proxy-0.1.0.tar.gz
Size 108.4 kB
Tags Source
SHA-256 checksum
How to use checksums
11107f84b409ecdd1473873a939eea7d0bd4dedf1f0b8e5fe9148c03defdddb9
BLAKE2b-256 checksum
How to use checksums
37289173844e45029e96ba1433d4d3d56b2e2d02a62dcd650d99b16cd050e8f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / harness_proxy-0.1.0-py3-none-any.whl

Download URL harness_proxy-0.1.0-py3-none-any.whl
Size 66.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b209a19525215499667739a925b1fa4d5bc84bdfdbe8c749776f1afeb96fb582
BLAKE2b-256 checksum
How to use checksums
09abf2345a2f8ac017eae79feaf0ec07126e05bf00a47bf5516bc13ce1020550
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Security for harness-proxy 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for harness_proxy-0.1.0.tar.gz

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 Nov 24, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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