Version 1.0 — shipped from production, not a demo

Rein in your agents
before they run.

A drop-in runtime governor for autonomous AI systems. Gates every action — trade, tool call, email, API hit — and halts the system the moment behavior degrades. Framework-agnostic. 1.7 µs overhead.

1.7 µs
gate() mean latency
500 k/s
throughput, single core
135
tests passing
12
runaway trades caught, week 1
60-second quickstart

One decorator. Every action governed.

No API keys. No hosted service. Pip-install the library, wrap the functions you care about, and decisions start flowing through Rein with microsecond overhead.

quickstart.py
# $ pip install rein-ai
from rein_ai import Rein, ReinConfig

brain = Rein(cfg=ReinConfig.from_env())
await brain.start()

# Gate every action your agent takes
@brain.governed(source="llm_agent")
async def send_email(to, body):
    ...

# Halted on drawdown, errors, anomalies, regime shifts.
# Every decision logged with a cryptographic chain.
The gap Rein closes

Content guardrails validate what an LLM says.
Nothing validates what your agent does.

Without Rein

Content-level guardrails only

Libraries like Guardrails and NeMo check the text an LLM produces. Essential, but content is validated before action. Once the agent places the trade, sends the email, or calls the paid API — there is no circuit breaker.

  • No awareness of live outcomes
  • No drawdown or error-rate halts
  • No regime-awareness (calm vs. shock)
  • No adversarial test of your policy
With Rein

Runtime action governance

Rein sits inline. Every action passes a gate. Decisions score each (source × series) with Bayesian time-decay, classify the regime, and halt the system when observed behavior degrades — not after someone notices.

  • Regime-aware Bayesian scoring
  • Drawdown, error, stale-state breakers
  • Natural-language policy compiler
  • Built-in adversarial red-team simulator
Built in, not bolted on

Three capabilities no one else ships.

Natural-language policies

Stop writing YAML. Describe a rule in English and Rein compiles it to an enforceable config. Review the expansion before deploy.

> "cap each caller at 8 rps, bursts of 16"
RateLimit(rps=8, burst=16, per="caller")

Adversarial red team

Before your policy ships, Rein attacks it. Five baseline attack classes — runaway loops, deny-storms, enumeration, portfolio-drain, cost-bombs — run in CI.

[BLOCKED] runaway_loop at iter 16
[BLOCKED] deny_storm at iter 9
catch rate: 100%

Regime-sliced scoring

A strategy that thrives in calm markets but dies in shocks is two different strategies to Rein. Every (source × action) is scored separately per regime.

normal  ●●●●○  llm_agent / send_email
stressed ●●○○○  llm_agent / send_email
shock   ●○○○○  llm_agent / send_email
Architecture

One inline gate. Six subsystems.

Every action call passes through a single decision engine that synthesizes regime, scoring, rate-limits, and anomaly signals.

01
Regime Detector
Classifies live signals into normal / stressed / shock.
02
Strategy Scorer
Bayesian posterior per (source × series), decayed over time.
03
Circuit Breaker
Halts on drawdown, error rate, or stale-state thresholds.
04
Rate Limiter
Per-caller token bucket with burst handling.
05
Anomaly Detector
Deny-storms, enumeration, runaway callers — caught live.
06
Audit Log
Tamper-evident JSONL chain. Every decision hash-linked.
Dual license

Free for builders.
Paid when it pays back.

The library is AGPL — free forever for OSS, research, and self-hosted use. Commercial teams license the AGPL waiver; Pro customers get the closed-source extensions.

Open Source

AGPL-3.0
$0
Free for OSS, research, self-hosted.
  • Full runtime governor
  • NL policy compiler
  • 5 baseline red-team attacks
  • Audit log + FastAPI router
  • Anthropic & LangChain adapters
View on GitHub

Commercial

AGPL waiver
$4,800/yr
From. Proprietary/SaaS use without copyleft.
  • Everything in OSS
  • AGPL waiver for your SaaS
  • Perpetual rights to licensed version
  • Written IP indemnification
  • Email support
Request a quote
RECOMMENDED

Pro

private + NDA
$1,500/mo
From startup tier. Trade-secret protected.
  • Everything in Commercial
  • Extended attack library (20+)
  • Calibrated detector presets
  • Trained anomaly models
  • Managed Rein Cloud
  • Priority SLA + policy library
Join Pro waitlist

Mid-market ($50–100K/yr) and Enterprise ($100–250K/yr) tiers available. Contact sales.

Rein-AI Pro

The production layer. Not for everyone.

Pro is for teams running real money, real users, or real compliance surface area. Trade-secret-protected. Access under signed NDA. If that sounds like overkill, the open-source version is production-ready on its own.

Opens your mail client. Zero tracking, zero auto-enroll. We respond within 2 business days.

Questions that come up

Why AGPL and not MIT?

Strong copyleft is the right default for a governance library. If your agent is running Rein as part of a network service, the community benefits from being able to inspect how that service is governed. Teams that can't comply with AGPL buy a Commercial License — which is how the project stays funded.

Is this only for trading?

No. Rein was extracted from a trading bot but is framework-agnostic. It works for LLM agents, scrapers, RPA, workflow orchestration, and anything else that takes actions you don't want spiraling. The gate interface doesn't know what kind of action is being gated.

Overhead in production?

1.7 µs mean, 2.7 µs p99 per gate() call on a 2021 MacBook Pro running Python 3.14. Well over 500,000 calls per second on a single core. Far smaller than the network round-trip of any real action.

How is Pro different from Commercial?

Commercial is a legal waiver for AGPL — you pay for the right to ship Rein in closed-source products. Pro is a product — closed-source extensions (extended attacks, trained detectors, managed service, priority support) that live behind an NDA. You can buy Commercial without buying Pro.

Is there a hosted version?

Rein Cloud ships as part of Pro — same governor, managed control plane, multi-tenant, with a web dashboard. The OSS library remains the reference implementation; you can always self-host.

Install it. Gate one action.
Then sleep better.

60 seconds to a first gated action. Wrap one more tomorrow. Never look at a runaway postmortem the same way again.

Read the code
pip install rein-ai