nacra
Health Warn
- License — License: Apache-2.0
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 7 GitHub stars
Code Pass
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
Nacra: Open-Source Control Plane for Agent Evaluation and RL Environments
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. Every trial is accounted for:
![]() |
Workers fail. Trials don't.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. Idempotent op_id deduplication and fenced leases keep execution crash-safe: a killed worker's trial is requeued under a new epoch and the stale commit is refused.
|
![]() |
Secrets stay on the worker.Secret-scrubbed, seekable rollout storage. Workers inject leased credentials into read-onlytmpfs, scrub spools against multi-encoding secret canaries (raw, URL, hex, base64) before upload, pack rollouts into seekable tar.zst + BLAKE3 CAS bundles over Apache OpenDAL (local FS, S3, R2, GCS, B2), and materialize a rebuildable Parquet / DuckDB catalog.
|
![]() |
Edit one test. Only its trials go stale.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 trialsSTALE, while editing reference solutions preserves valid agent evidence.
|
![]() |
Reward hacks get voided.Honest verdicts and 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 carry reward = None (never 0). Combine deterministic human-authored CEL policies with MCP-connected LLM judge agents to detect, quarantine, and patch reward hacking end to end.
|
![]() |
Agents drive. Humans ratify.Uniform human and AI-agent control (CLI / HTTP / MCP). Humans operate via thenacra CLI/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.
|
Zero-fork native adapters. Nacra ships 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
# From PyPI (current release is a pre-release, hence --prerelease / --pre)
uv tool install --prerelease allow nacra
# or: pip install --pre nacra
# Or the latest main from GitHub
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.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found




