Skip to main content

Loop-aware router and tracing for coding agents (Claude Code, Codex). Routes workflow steps by phase and evidence and records hash-only cost/cache/verification/outcome receipts.

Project description

InferRouter

Tests License: Apache-2.0 Python

Loop-aware router and tracing for coding agents (Claude Code, Codex).

InferRouter wraps a coding-agent loop, routes each workflow step by phase and evidence, and records hash-only receipts for cost, cache, verification, and outcome. Real agent work is a loop that plans, retrieves context, calls tools, reads logs, generates output, verifies, retries, and stops when a condition is met. InferRouter measures the whole loop and keeps the outcome + cost evidence.

Status: alpha, Apache-2.0. The command, package, and import are all inferrouter. InferGuard is a separate, original diagnostics tool and is not this repo.

Install

# From a checkout of this repo (works today)
uv tool install .
# or
pip install .

# From PyPI (after first publish)
uv tool install inferrouter

This installs the inferrouter command (plus inferrouter-routerd).

Quickstart

Wrap any command as a goal loop with a verifier. The loop stops when the verifier passes or max-turns is reached, and writes receipts under .touchdown/:

inferrouter loop goal \
  --loop-id fix_auth_tests \
  --goal "auth tests pass" \
  --verify "python -m pytest tests/auth -q" \
  --max-turns 5 --agent codex \
  -- codex exec "fix the failing auth tests"

Receipts written (hash-only, never raw prompts/output/secrets):

.touchdown/loops/loop_runs.jsonl       # one LoopRunReceipt per run: status, turns, stop reason, cost
.touchdown/loops/verifications.jsonl   # one VerificationEvent per turn: pass/fail, output hash
.touchdown/session.json                # connector_session_id, workspace hash

Other commands:

inferrouter loop turn    --agent generic -- <command>     # single exploratory step
inferrouter loop every   --loop-id L --interval 0 --max-iterations 1 -- <command>
inferrouter loop report  [--loop-id L]                    # turns, task ids, verifier results, cost
inferrouter loop usage   [--by loop|task|phase|provider|model]
inferrouter --help

Architecture

The loop layer sits above a correlated task graph:

loop_id -> loop_run_id -> task_id -> step_id
  route -> capture -> provider-call -> verification -> outcome   (all hash-only receipts)

See docs/ARCHITECTURE.md for the full loop-aware architecture and the router doctrine (route by phase and evidence, not a static complexity score). Integration notes: docs/agent-install.md, docs/319-claude-code-loop-integration.md, docs/320-codex-loop-replication.md.

Safety defaults

  • No network and no live provider calls by default. Live provider calls are gated behind explicit configuration plus a key.
  • Receipts and ledgers store hashes only. Raw prompts, raw output, API keys, and secrets are never written to any receipt, ledger, report, or log. Ledgers actively reject unsafe keys.

Development

python -m pytest -q             # test suite
uv build                        # build wheel + sdist into dist/
bash scripts/package_smoke.sh   # build + clean-venv install + console-script smoke

The import package, dist name, and CLI command are all inferrouter.

Contributing

Contributions are welcome. See CONTRIBUTING.md, our Code of Conduct, and the security policy.

License

Apache License 2.0. See LICENSE and NOTICE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inferrouter-0.1.1.tar.gz (339.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inferrouter-0.1.1-py3-none-any.whl (349.4 kB view details)

Uploaded Python 3

File details

Details for the file inferrouter-0.1.1.tar.gz.

File metadata

  • Download URL: inferrouter-0.1.1.tar.gz
  • Upload date:
  • Size: 339.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for inferrouter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5821cfd65c40ce8bc045dd6ef72a8bfe9e4c701e0e40824af870f0ef640f0d8d
MD5 c21ae527d08d161e0aa7a78514779cdb
BLAKE2b-256 85fa7564c92044812bba0f44e343d1d079201cc883206ae54c80531e803e7035

See more details on using hashes here.

Provenance

The following attestation bundles were made for inferrouter-0.1.1.tar.gz:

Publisher: publish.yml on OCWC22/inferrouter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inferrouter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: inferrouter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 349.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for inferrouter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a228adeced6d9fdf55e8003b55ec7144604d6e4662dc389ebab1ea3a897ad7e
MD5 6c75d368dd8b4671d884be996946bd25
BLAKE2b-256 56279ca3991bd4906d149220901a64852232ddb0d621e8fd649d64de0f29027d

See more details on using hashes here.

Provenance

The following attestation bundles were made for inferrouter-0.1.1-py3-none-any.whl:

Publisher: publish.yml on OCWC22/inferrouter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page