English | 中文
Reef sits between your agent and its model. It records each model call and the feedback on it, such as a test result, a grader score or a user rating.
From that feedback it trains a new version of the model weights or of the agent's harness (its prompts, rules and skills), and serves the version you choose while the agent keeps running.
Who it is for: people who build or study agents and want them to improve from their own use. Train weights on your GPUs with Slime and SGLang or on Tinker, or evolve a harness with only a model API.
🚀 Get started | 🗺️ Roadmap | 🗓️ Office Hours | 📣 Launch post | 💬 Join Discord | 📱 Join WeChat Group
You need uv (it downloads Python 3.12 if needed), git-lfs (brew install git-lfs
or apt install git-lfs), and an OpenAI API key or Ollama (--model ollama/<model>, no key).
No GPU. Start Reef in front of the model:
git lfs install
git clone https://github.com/Human-Agent-Society/reef.git && cd reef
uv venv --python 3.12 && source .venv/bin/activate && uv pip install -e .
export REEF_TOKEN=reef-local REEF_UPSTREAM_API_KEY=sk-... # your OpenAI key
reef serve --model openai/gpt-4o-miniIn a second terminal, with the same REEF_TOKEN, create a scenario and wait until it serves:
H="Authorization: Bearer $REEF_TOKEN"
curl http://127.0.0.1:8900/reef/scenarios -H "$H" -H "content-type: application/json" -d '{"name": "hello"}'
until curl -fsS http://127.0.0.1:8900/reef/scenarios/hello/inference/status -H "$H" | grep -q '"state": "ready"'
do sleep 1; doneIf the wait does not end, run the status request alone: with "state": "failed", error says why.
Call the model through Reef. The command shows the response and keeps its header x-reef-agent-record-id, the
receipt of the call, in RECEIPT:
RECEIPT=$(curl -sS -i http://127.0.0.1:8900/v1/chat/completions -H "$H" -H "x-reef-scenario: hello" \
-H "content-type: application/json" -d '{"model": "active", "messages": [{"role": "user", "content": "Hi"}]}' \
| tee /dev/stderr | awk 'tolower($1) == "x-reef-agent-record-id:" {print $2}' | tr -d '\r')Report on the call with its receipt, and read what Reef recorded:
curl http://127.0.0.1:8900/reef/report -H "$H" -H "x-reef-scenario: hello" \
-H "content-type: application/json" -d "{\"score\": 1.0, \"references\": [\"$RECEIPT\"]}"
curl http://127.0.0.1:8900/reef/scenarios/hello/records -H "$H"You see two records: the call, and your report linked to it by the receipt. The scenario mounts no recipe, so Reef trains nothing yet. Quickstart explains each step; to train, continue with Use Reef.
- 2026-11: We are refactoring Reef to a control plane + workers architecture. Some recipes and examples can fail on
mainuntil the refactor is complete. If a recipe fails, please open an issue. - 2026-11: A scenario can split its traffic across its served artifacts #1227, also through Semantic Router #859. The new
pythonharness adapter evolves a Python program #1242. - 2026-10: Tinker runs as a training component #901. Episodes and agents can run in Modal Sandboxes #942. The artifact repository can live on Hugging Face #1003. New recipe: OPD #683.
- 2026-09:
reef-infrav0.1.0 is on PyPI. New recipes: GEPA, SDFT, SDPO and Meta-Harness. Reef serves the OpenAI Responses API at/v1/responses#528. - 2026-08: Reef is open source. Read the launch post.
Use Reef when you want your agent to keep improving from the way people use it.
| Your goal | Learning path | What you need |
|---|---|---|
| A model that keeps getting better at your work | Model weight training | A trainable model, a supported GPU stack or Tinker, and feedback your recipe can use |
| A harness that improves itself | Harness optimization | A model endpoint, representative tasks and an evaluator; no training GPUs |
| Scientific discovery | Test-time training | An execution environment, a correctness checker and a measurable objective |
| Ability | Inference engine (vLLM, SGLang, …) | RL training framework (Slime, veRL, AReaL, …) | Reef |
|---|---|---|---|
| Serves live traffic | ✅ | ❌ | ✅ |
| Trains weights | ❌ | ✅ | ✅ |
| Version management | ❌ | ❌ | ✅ |
| Stays live through updates | ❌ | ❌ | ✅ |
| Evolves beyond weights (skills, harness) | ❌ | ❌ | ✅ |
Each learning cycle has four steps:
| Step | What happens | Where it lives |
|---|---|---|
| 1 · Inference | Serve agent requests and record each call and its feedback. | api/ — agent requests and interaction recordsinference/ — inference and artifact updates |
| 2 · Sample | Turn reports and the calls they reference into training samples. | storage/scenario/records.py — stored interactions and feedbacksamples/ — feedback matching, eligibility, and samples |
| 3 · Train | Train new weights or a new harness from the samples. | recipe/ — recipe integrationtrain/ — the training pipeline, job data, and training jobs |
| 4 · Evaluate | Decide whether the new version serves, and keep every version. | evaluation/ — candidate evaluationartifact/ — version history and snapshot components |
💡 Note
Reef's artifacts and checkpoints need the
git-lfssystem package. Reef initializes Git LFS for its artifact repositories.
We recommend uv. The commands below use it.
Install Reef from a checkout. The docs and the examples below run the recipes of the checkout. uv downloads Python
3.12 if the host does not have it.
git lfs install
git clone https://github.com/Human-Agent-Society/reef.git
cd reef
uv venv --python 3.12 && source .venv/bin/activate
uv pip install -e .
python3 -c "import reef; print(reef.__version__)"Activate the environment (source .venv/bin/activate) in each new terminal that runs reef or python. To train
weights with Slime, use the
Reef GPU image.
The PyPI release predates these docs, and has no recipes or examples.
uv venv --python 3.12 && source .venv/bin/activate
uv pip install reef-infra
python3 -c "import reef; print(reef.__version__)"To train, Reef reads two more files. The deployment file (serve.yaml) says what Reef runs: the model, the training
backend and the storage. The recipe file (recipe.yaml) says how one scenario learns, and you mount it on a scenario
while Reef runs. How Reef works explains these ideas in five minutes.
The smallest example is the minimal recipe, in
recipes/minimal/examples/slime/serve.yaml and
recipe.yaml. On two GPUs, in the
Reef GPU image, start the
deployment. REEF_MINIMAL_STATE_DIR is the directory of its state, logs and checkpoints:
export REEF_TOKEN=reef-local
export REEF_MINIMAL_STATE_DIR="$PWD/work/minimal"
reef serve -c recipes/minimal/examples/slime/serve.yamlIn a second terminal, when /healthz answers, mount the recipe on the scenario demo:
export REEF_TOKEN=reef-local
curl -f http://127.0.0.1:8900/healthz # the Reef server is up
reef scenario mount demo recipes/minimal/examples/slime/recipe.yamlUse Reef runs this example through the whole loop, on two GPUs or with a Tinker key: start Reef, mount the recipe, call the model, report on each run, and see a new version serve.
To improve a coding agent's skills and rules with a model API and no GPU, use a harness recipe. It keeps the harness as a tree of text files.
Each step edits a copy of the tree from the step's runs, and runs the real agent on tasks to evaluate the candidate. A candidate that wins becomes a version that any client can pull.
Evolve a harness explains the GEPA recipe. Its example evolves the system prompt of a pi agent on AIME problems, and needs the pi harness and an OpenAI API key:
cd recipes/gepa/examples/aime
uv pip install -e .
REEF_PI_BINARY=/path/to/pi ./run.sh --dry-run
export OPENAI_API_KEY=...
REEF_PI_BINARY=/path/to/pi ./run.shThe dry run checks the pi version and the pinned AIME splits, and makes no model calls. The example's README describes the run and its output.
GET /reef/harness serves the published tree for the deployment's adapter. The files hold no endpoint, key or model: a
client writes them where the agent reads them, and points the agent's model at Reef (Connect an
agent).
Write the tree outside the agent's project: a session can write files in its project, so a tree there could change what the next session runs.
Pick a recipe by the task type of your workload and by what it evolves: model weights or the agent harness. Weight recipes need the GPU training stack. Harness recipes need only a model endpoint.
- SFT ships with
reef-infra. It trains on demonstrations or imported examples, for every task type. - The other recipes are in the
recipes/cookbook of this repository, and do not ship in the wheel. The recipe catalog gives the code and example of each. - To write your own, start from
recipes/minimal/and read Write a recipe.
| Task type | Task shape | Evolves the model | Evolves the harness | Standard benchmarks |
|---|---|---|---|---|
| Open-ended discovery | Repeated attempts at one hard problem with a measurable objective and no known answer | TTT-Discover, Guidance-TTT | None yet | Measured: TriMul, circle packing, Erdős minimum overlap. |
| Offline tasks with a known answer | Independent tasks from a fixed set, each with a reference answer | SAO, SDFT, SDPO, OPD | GEPA, Meta-Harness | Measured: IMOAnswerBench, AIME 2024, AIME 2025, SciKnowEval, ToolAlpaca, Terminal-Bench. |
| Online learning from usage | Sessions with a user, where the interaction itself is the signal | OpenClaw-RL | ACE, ReasoningBank | Measured: GSM8K with a simulated student user. |
recipes/basic/ is the record-only starting stack, outside the catalog. Each results page gives
its task, evaluation setup, measurements and limits.
Read How Reef works first. Then six guides cover Reef from the first call to production:
- Use Reef: one workload through the whole loop, from a model call to a trained version that serves.
- Write a recipe: define your own training method as four classes, each with a base class that says what to implement.
- Evolve a model: the four classes of a weight recipe, with SDFT.
- Evolve a harness: the four classes of a harness recipe, with GEPA.
- Connect an agent: any OpenAI-compatible client, the Python client, or a coding agent such as Claude Code, Codex, OpenCode or pi.
- Run Reef in production: PostgreSQL, your GPUs or Tinker, sandboxes on E2B or Modal, and the interfaces that you can replace.
To look something up, use the recipes, the services, the HTTP API, the configuration and the glossary.
Working on continually self-improving agents?
- Join Discord to share your recipes, ask implementation questions, and discuss new features.
- Join the WeChat group: the group is full, so add the assistant and it will invite you.
- Join the GitHub Discussions to ask questions, share ideas, and connect with the community.
- Start contributing with the contribution guide.
- Propose designs through an RFC issue.
- Report suspected vulnerabilities privately by following the security policy.
If Reef looks useful to you, please give it a ⭐ — it helps the community to discover and contribute to the project.
If you use Reef in your research, please cite:
@misc{reef2026,
title = {Reef: Infrastructure for Continually Self-Improving Agents},
author = {{Reef Contributors}},
year = {2026},
url = {https://github.com/Human-Agent-Society/reef}
}Citation metadata is also available in CITATION.cff.
Reef brings together people exploring how agents can learn from experience and improve over time. The people below help turn that idea into working infrastructure.
This list is non-exhaustive, with team members listed alphabetically by last name:
Wenhao Chai, Shuangrui Ding, Shiyi Zoe Du, Hao He, Haoze He, Chonghe Jiang, Nan Jiang, Xuan Jiang, Xiaochen Li, Paul Liang, Bo Liu, Boyuan Long, Qiuyang Mang, Zhenting Qi, Ao Qu, Mingruo Qu, Yihong Tang, Zhaokai Wang, Xuezhi Yan, Hanfei Yu, Haofei Yu, Simon Yu, Han Zheng, Kaichen Zhou, Zijian Zhou, Jiacheng Zhu, Dingyi Zhuang, Xinkai Zou.
We are particularly grateful to these projects which power important parts of Reef: