rein-openweights/README.md

2.3 KiB

rein-openweights

An agentic tool-use harness that drives current open-weight models via OpenRouter, as an alternative to the frontier-model-vendor harnesses (Claude Code, Grok CLI, Codex/GPT CLI).

Part of the glas-harness "rein" family — see glas-harness ADR-001, ADR-002 (credential ownership), and this repo's workplans/REIN-OW-WP-0001.

Uses its own minimal OpenRouter client (src/rein_openweights/openrouter_client.py), not llm-connect's OpenRouterAdapter — that adapter's execute_prompt(prompt: str, config) takes a single prompt string and never surfaces message.tool_calls, so it can't drive a multi-turn tool-calling loop without a breaking change to llm-connect's frozen Core ABC. llm-connect stays an optional dependency (see pyproject.toml), not load-bearing for the base loop.

Not yet pushed to Forgejo — local scaffold only.

Usage

python3 -m venv .venv && source .venv/bin/activate
pip install -e .

# Credential: either export OPENROUTER_API_KEY directly, or set
# OpenBao-based acquisition defaults to role_id/secret_id under
# ~/.local/rein-openweights/approle and KV path reins/rein-openweights/openrouter.
# REIN_OPENWEIGHTS_APPROLE_DIR / REIN_OPENWEIGHTS_OPENROUTER_KV_PATH override them.
export OPENROUTER_API_KEY=sk-...

rein-openweights run \
  --task-file examples/task-hello-sandbox.json \
  --model qwen/qwen-2.5-72b-instruct \
  --tool-profile green-commit-only \
  --budget-tokens 60000 \
  --max-turns 20 \
  --no-hub

green-commit-only is currently the sole supported tool profile. Unknown tool profiles fail before credential lookup. In governed use these flags are supplied by a versioned glas-harness profile; workforce/activity consumers should reference Glas rather than this CLI directly.

An explicitly exported OPENROUTER_API_KEY has highest precedence for local development. Unset or refresh it when validating the OpenBao/AppRole lane; an old inherited value will otherwise mask a newly rotated workload key.

Tests: python3 -m pytest tests/ -q (27 tests, no network/OpenBao calls — everything mocked at the httpx/bao subprocess boundary).