This release is a pre-release and may not be stable for production use.
Nacra is a lightweight, open-source control plane that decouples large-scale AI agent evaluation and reinforcement learning (RL) rollout generation from GPU inference and training.
Why Nacra • Architecture • Quickstart • MCP Agents • Adapters • Benchmarks • Docs • Citation
Why Nacra?
Open-source infrastructure for GPU model serving (vLLM, SGLang) and distributed RL training (verl, OpenRLHF, AReaL, slime) has matured rapidly. Yet the layer that executes interactive agent environments at scale—scheduling trials across heterogeneous compute and sandboxes, isolating infrastructure faults from model failures, catching reward hacking, versioning tasks, preventing credential leaks, and turning raw trajectories into queryable training datasets—still relies on brittle shell scripts and ad hoc log folders.
Nacra fills that gap with a single, deterministic, policy-neutral control plane:
- Deterministic state, never in an agent's context: A single control-plane daemon (
nacrad) backed by SQLite WAL and an append-only, BLAKE3 hash-chained event log owns all runs, leases, verdicts, and decisions. Idempotentop_iddeduplication and fenced leases keep execution crash-safe. - Uniform Human & AI Agent Control (CLI / HTTP / MCP): Humans operate via the
nacraCLI/HTTP API; AI coding agents (Claude Code, Codex, Gemini CLI) connect via a compact, role-filtered 22-tool MCP interface with untrusted-text wrapping and 10 human-only ratification/approval gates. - Honest Verdicts & Reward-Hacking Remediation: A six-state verdict machine (
GENUINE_PASS,GENUINE_FAIL,PENDING,VOID,INFRA,STALE) enforces in code that infrastructure faults, voided exploits, and stale runs carryreward = None(never0). Combine deterministic human-authored CEL policies with MCP-connected LLM judge agents to detect, quarantine, and patch reward hacking end to end. - Git-Subtree Task Versioning: Tasks live in a bare Git repository decomposed into logical subtrees. Editing a task's test suite automatically marks dependent historical trials
STALE, while editing reference solutions preserves valid agent evidence. - Secret-Scrubbed, Seekable Rollout Storage: Workers inject leased credentials into read-only
tmpfs, scrub spools against multi-encoding secret canaries before upload, pack rollouts into seekabletar.zst+ BLAKE3 CAS bundles over Apache OpenDAL (local FS, S3, R2, GCS, B2), and materialize a rebuildable Parquet / DuckDB catalog. - Zero-Fork Native Adapters: Ships native built-in JSON-RPC 2.0 adapters for Harbor, OpenEnv, NVIDIA NeMo Gym, and arbitrary shell commands—plus a 294-LOC zero-dependency Python SDK (
nacra.sdk) for custom harnesses.
Architecture
Domain-Agnostic Task & Reward-Hacking Auditing
Nacra separates scheduling and storage from evaluation semantics, letting teams layer human-authored CEL policies and MCP-connected LLM judge agents across Software & Coding, Science & Research, Physical Engineering (CAD), and Knowledge Work (Legal, Finance, Docs):
Quickstart
Runs locally on macOS or Linux with Python 3.11+ and git—no GPU, no container daemon, and no external API keys required for the built-in walkthrough.
1. Install
# Using uv (recommended)
uv tool install git+https://github.com/mendotaAI/nacra.git
# Or from a local clone for development
git clone https://github.com/mendotaAI/nacra.git
cd nacra
uv sync
source .venv/bin/activate
2. Initialize, Start Control Plane & Worker, and Run a Campaign
# 1. Initialize ~/.nacra and create your owner token (chmod 0600)
nacra init --token-file ~/.nacra/owner.token
cat > ~/.nacra/config.yaml <<'YAML'
client: {token_file: owner.token}
worker: {command_allow: [python3]}
YAML
# 2. Start the control plane (HTTP /v1 + MCP /mcp on 127.0.0.1:7733)
nacra serve &
# 3. Mint a worker token and start a local dial-out worker
nacra token create --role worker --token-file ~/.nacra/worker.token
nacra worker --token-file ~/.nacra/worker.token &
# 4. Copy bundled examples, import a task, load example CEL policies, and run a campaign
nacra examples ./nacra-examples
nacra task import ./nacra-examples/tasks/hello --name hello
nacra policy put ./nacra-examples/policies/*.cel
nacra campaign apply ./nacra-examples/campaign.yaml # dry-run plan
nacra campaign apply ./nacra-examples/campaign.yaml --apply # launch trials
# 5. Inspect progress and query rollouts with DuckDB SQL
nacra brief
nacra query "SELECT arm, verdict, COUNT(*) FROM trials WHERE state != 'cancelled' GROUP BY ALL"
Connect AI Coding Agents (MCP)
Always issue a least-privilege sub-token for AI agents—never pass your owner token. Agents with the controller or auditor role can plan campaigns, stream events, inspect rollouts, and propose verdicts/decisions, but cannot ratify verdicts, approve plans, mint tokens, or overwrite guarded policies.
nacra token create --role controller --agent claude --harness claude-code \
--token-file ~/.nacra/agents/claude-code.token
claude mcp add --transport http nacra http://127.0.0.1:7733/mcp \
--header "Authorization: Bearer $(cat ~/.nacra/agents/claude-code.token)"
Run nacra hookup to print ready-to-paste MCP configuration snippets for Claude Code, Codex, Gemini CLI, and stdio clients.
Native Adapters
Nacra wraps external evaluation harnesses and RL environment servers over a simple JSON-RPC 2.0 stdio protocol (describe, prepare, run, collect, classify, shutdown) without forking them:
| Adapter | Target Ecosystem | Built-in | Sandboxes / Runtime |
|---|---|---|---|
harbor |
Harbor / Terminal-Bench | Yes | Docker, Podman, EC2, Modal |
openenv |
OpenEnv (reset/step) |
Yes | OCI containers / HTTP-WS |
nemogym |
NVIDIA NeMo Gym | Yes | Microservice / shared server |
command |
Any CLI executable writing result.json |
Yes | Local / custom sandbox |
Custom (nacra.sdk) |
Your own harness (294-LOC zero-dep SDK) | Extensible | Any worker host |
Benchmarks
Empirically validated on a single nacrad control-plane process (SQLite WAL, FULL synchronous mode) and a 7-layout rollout storage suite:
| Dimension | Measured Result |
|---|---|
| Sustained Throughput | 344 commits/min (40-min soak, 6 slots, 3×1 Hz concurrent readers) |
| Memory Stability | 591 MB peak RSS (1.08 MB/min tail slope with glibc allocator tuning) |
| Rollout Compression | 5.61× smaller (tar.zst + compressed CAS: 705.9 MB → 125.9 MB) |
| RL Training Scan (Parquet/DuckDB) | 5× fewer bytes, 9× faster (7.4 MB / 47 ms vs. 37.6 MB / 432 ms) |
| Per-Token Logprob Storage | 16.4× smaller (14.7 MB → 0.90 MB via BSS float16 + zstd) |
| Security & RBAC Audit | 2,144 / 2,144 HTTP RBAC calls + 15 / 15 MCP role columns, 0 mismatches |
| Newcomer Onboarding | 15.4 s from nacra init to first GENUINE_PASS |
Documentation
- Operator Guide — Full CLI, configuration, multi-host deployment, TLS/reverse proxy, and troubleshooting reference
- Architecture — Control plane, worker lifecycle, fenced leases, and storage layout
- Design Specification — Event log, verdict state machine, CEL policy hooks, and adapter contract
- Interfaces — HTTP
/v1, MCP tool schemas, and JSON-RPC adapter protocol - Examples — Sample tasks, campaigns, CEL policies, and custom adapter templates
Development & Testing
uv sync --all-groups
uv run ruff check src tests
uv run pytest -q
Citation
If you use Nacra in your research or evaluation infrastructure, please cite:
@inproceedings{gao2027nacra,
title = {Nacra: Toward Large-Scale, Open-Source Infrastructure for Agent Evaluation and RL Environments},
author = {Gao, Yuan and Li, Junnan and Yi, Yongzhe Kindred and Sha, TianMing and Tang, Yanchuan and Li, Anhao and Liu, Ziqi and Sun, Zhaoting and Yang, Zeren},
year = {2027},
note = {Open-source software: \url{https://github.com/mendotaAI/nacra}}
}
Contributing & License
Contributions are welcome! Please see CONTRIBUTING.md and SECURITY.md.
Nacra is released under the Apache License 2.0. See LICENSE for details.
Metadata
Release files for nacra 0.1.0.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nacra-0.1.0.dev0.tar.gz | 2.4 MB | Without provenance | Details for nacra-0.1.0.dev0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nacra-0.1.0.dev0-py3-none-any.whl | Python 3 | none | any | Details for nacra-0.1.0.dev0-py3-none-any.whl |
Total release size: 3.3 MB
Release files / nacra-0.1.0.dev0.tar.gz
| Download URL | nacra-0.1.0.dev0.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4566d4a09d87cf177401da67d8c4078a6b11ba8cca742ef2fc5dc6a6453d32ce
|
|
BLAKE2b-256 checksum How to use checksums |
1479b061e55bd11f5aa6882037e11149d6430d55f9c8cafa3f3b3898d334ecd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / nacra-0.1.0.dev0-py3-none-any.whl
| Download URL | nacra-0.1.0.dev0-py3-none-any.whl |
|---|---|
| Size | 902.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6f662514bed380795c83aeedb2dea82cbf0bf0ed75e47edf16f0a0e39c5b411
|
|
BLAKE2b-256 checksum How to use checksums |
37f1f54981ff7d6633b991ddd9c37057f95d35ee1b092d67eec6e83e4b6aeb50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for nacra 0.1.0.dev0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.