What it does
Rein is a multi-agent AI orchestrator that coordinates specialist agents through YAML workflows. Instead of pasting a long prompt into Claude and asking it to research, write, edit, and fact-check all at once -- getting mediocre results because one agent cannot be an expert at everything -- Rein breaks the work into steps automatically. No more manually copying outputs between chat windows, tracking what depends on what, or restarting when something fails halfway through.
Rein automates this. You describe each specialist in a Markdown file: what it does, what format it outputs, what it is good at. You wire specialists together in a YAML workflow: this step runs first, that step depends on it, these three run in parallel. Then you run a single command. Rein launches the agents, passes data between them, tracks progress in SQLite, and handles failures.
No Python code required. A specialist is a text file. A workflow is a text file. If you can edit YAML, you can orchestrate a team of AI agents. The researcher finds sources, the writer drafts the article, the editor polishes it, the fact-checker validates claims. Each one gets exactly the context it needs and hands off to the next one automatically.
Works with any LLM: Anthropic Claude, OpenAI GPT, Ollama for local/free models, OpenRouter for 100+ models. Switch providers by changing one line in the YAML. Same workflow, different model.
Results & Impact
Published on PyPI as rein-ai. Install with pip, no clone required. Version 3.3.1 with 5 progressive examples from hello-world to conditional branching with revision loops.
Used in production to orchestrate multi-agent workflows: content review pipelines, deliberation processes (3-phase debate with cross-review), code review, research synthesis. Workflows that would require manual coordination of multiple chat sessions run unattended.
The three-layer architecture (Specialists in Markdown, Teams in YAML, Workflows in YAML) means non-programmers can define and modify agent behavior. Changing a specialist's personality or adding a new step is a text edit, not a code change.
Key Features
- No Code Required. Specialists are Markdown files. Workflows are YAML. No Python classes, no framework APIs, no graph DSLs. Edit text files, run a command.
- 4+ LLM Providers. Claude, GPT, Ollama (local/free), OpenRouter (100+ models). Switch providers with one YAML line. Auto-detection from environment variables.
- Parallel Execution. Independent steps run simultaneously. Dependent steps wait. max_parallel controls concurrency. Fan-out / fan-in patterns built in.
- Conditional Branching. Route execution based on output: if quality score is high, publish; otherwise, send back for revision. if/else with expression evaluation.
- Revision Loops. Send a block back for re-evaluation with max_runs protection. Quality check -> revision -> quality check again. Automatic loop breaking.
- Crash Recovery. State tracked in SQLite. If a step fails, retry without rerunning earlier steps. The workflow picks up where it left off.
- Logic Scripts. Optional Python scripts for pre/post processing. Fetch data before the LLM runs, validate output after, or skip the LLM entirely for custom logic.
- MCP Server. Built-in MCP integration for Claude Code, Claude Desktop, and Cursor. List flows, run workflows, check task status from your AI assistant.
How it works
Rein has a 3-layer architecture, all defined in text files:
Layer 1: Specialists (Markdown). Each specialist is a file describing an AI agent's role, expertise, output format, and constraints. "You are a senior code reviewer. Output JSON with verdict and issues list." The specialist file is the system prompt.
Layer 2: Teams (YAML). A team groups specialists and adds a shared collaboration tone. "Be constructive and specific. Always output valid JSON." Teams are optional but useful for consistent voice across related specialists.
Layer 3: Workflows (YAML). A workflow defines blocks (steps), their dependencies, and execution rules. Each block references a specialist, gets a prompt with template variables for accessing previous blocks' output, and produces a result. Dependencies control execution order. Blocks without dependencies run in parallel.
At runtime, Rein reads the workflow, builds a dependency graph, launches blocks in the right order (parallel where possible), passes outputs between them via template variables, tracks state in SQLite, and saves all results to disk.
Stack: Python, available on PyPI as rein-ai. Uses provider SDKs (anthropic, openai) or HTTP (Ollama, OpenRouter). SQLite for state tracking.
Quick Start
# Install from PyPI
pip install rein-ai[anthropic]
# Set API key
export ANTHROPIC_API_KEY=sk-...
# Run the hello-world example
cd examples/01-hello-world
rein --agents-dir ./agents workflow.yaml --no-ui
# Output:
# [research] done 3.2s "Found 12 relevant sources"
# [write] done 5.1s "Draft complete: 1,847 words"
# [edit] done 2.8s "Polished to 1,923 words"
Use Cases
For content teams. Research, write, edit, fact-check in one pipeline. A researcher finds sources, a writer drafts from those sources, an editor polishes the language, a fact-checker validates claims against the original sources. Each specialist focuses on one job. The pipeline runs unattended and produces reviewed, publishable content.
For development teams. Automated code review with multiple perspectives. A security reviewer checks for vulnerabilities, a performance reviewer looks for bottlenecks, a style reviewer checks conventions. All three run in parallel on the same code, then a synthesis step consolidates their findings into actionable items.
For decision making. Multi-perspective deliberation. Three analysts examine a question independently. Each reads the others' analysis and provides feedback. A synthesis phase consolidates into a final recommendation. Four phases, ten blocks, all from one YAML file. Structured thinking that would take hours of manual coordination.
Lessons Learned
Text files beat code for AI config. Every competing framework (CrewAI, LangGraph, AutoGen) requires Python classes to define agents. Rein uses Markdown and YAML. This was a deliberate bet: AI agent definitions change frequently, non-programmers need to modify them, and version control diffs on text files are readable. The bet paid off. Iterating on a specialist's personality is a text edit, not a code review.
State persistence prevents wasted money. Without SQLite state tracking, a failure at step 8 of 10 means rerunning steps 1 through 7 and paying for all those LLM calls again. Crash recovery was not in the original design. It was added after a $15 workflow failed at the last step and had to be restarted from scratch. Now every completed block is saved and skipped on retry.
Revision loops need hard limits. Conditional branching that sends a block back for revision sounds elegant until the quality check keeps failing and the loop runs forever, burning API credits. The max_runs parameter was added after an accidental infinite loop consumed a significant portion of a monthly API budget in one run. Every loop needs a ceiling.
FAQ
What is Rein?
A workflow orchestrator for AI agents. Break complex tasks into specialist steps defined in Markdown, wire them in YAML, run with one command. No Python code required.
Why not just use one long prompt?
A single prompt that researches, writes, edits, and fact-checks produces mediocre results. Specialist steps, where each agent focuses on one thing, produce dramatically better output. Rein automates the coordination.
Do I need to write Python code?
No. Specialists are Markdown, workflows are YAML. Logic scripts in Python are optional for advanced pre/post processing.
What LLM providers are supported?
Anthropic Claude, OpenAI GPT, Ollama (local/free), and OpenRouter (100+ models). Switch providers with one YAML line.
What happens if a step fails?
State is tracked in SQLite. Failed steps can be retried without rerunning earlier steps. Conditional branching routes to revision. Max-runs prevents infinite loops.


