Skip to main content
Reef

Continual learning infra for self-improving agents

CI Python License

Reef is infrastructure that serves an entire continual learning backend. Reef exposes standardized http endpoints so that you can download agents just like how you download codex or opencode using curl, and so that your agent can send its model requests to Reef's inference endpoint instead of the provider's.

The only difference is that, Reef constantly evaluates your agent behavior and improves the served harness and model weights in the backend. You keep getting better and better results without having to do anything.

Get started · Join Discord

Installation

From PyPI

pip install reef-infra

The distribution name is reef-infra; the Python package and CLI remain reef.

From source

git lfs install
git clone https://github.com/Human-Agent-Society/reef.git
cd reef
pip install -e .

Use the source checkout for development and for the training examples below, which also depend on the cookbook recipes and GPU runtime.

How it works

Reef serves requests, records feedback, produces updates, and commits accepted updates to a version history.

Reef processes each learning cycle in four steps. The table also shows which modules implement each step.

Step What happens Where it lives
1 · Serve Serve agent requests and record interactions. service/ — agent requests and interaction records
runtime/ — inference and artifact updates
2 · Observe Match feedback to recorded interactions. records.py — stored interactions and feedback
train/processors/ — feedback matching and eligibility
3 · Grow Produce an update from eligible records. recipe/ — recipe integration
train/ — batches and update jobs
4 · Commit Evaluate and publish accepted updates. train/evaluation/ — candidate evaluation
artifact/ — version history
surface/ — artifact delivery

Using Reef

Reef supports two learning surfaces: model weights and agent harnesses. The recipe bound to a scenario determines which surface it updates.

1 · Serve

The following example starts the SAO (arXiv:2607.07508) example deployment. Run it from a Reef checkout in an environment that satisfies the GPU requirements in Evolve your model.

pip install -e ".[slime]" && pip install --no-deps --group runtime

export MODEL_PATH="Qwen/Qwen2.5-1.5B-Instruct"
export REEF_TOKEN="reef-local"

reef serve -c recipes/sao/examples/sao/serve.yaml \
  --reef.model_path "$MODEL_PATH" \
  --reef.port "8900"

curl -f http://127.0.0.1:8900/healthz          # ready to serve

2 · Train weights

Send inference requests through Reef and report a score for each response. The SAO recipe uses each eligible scored rollout to run a training step.

Send an inference request and report feedback

Reef's inference endpoint is OpenAI- and Anthropic-compatible: /v1/chat/completions and /v1/messages take the provider's own request body. The first request for a new scenario must include both Reef headers. Reef stores the recipe binding and rejects later attempts to change it.

The response body uses the provider's OpenAI-compatible format. Reef adds the x-reef-agent-record-id response header. Its value is the receipt that a later report uses to identify this interaction. A report can contain a numeric score, textual or structured feedback, and the receipts it evaluates. This example reports both a score and a short explanation.

import os
import httpx

reef = httpx.Client(
    base_url="http://127.0.0.1:8900",
    headers={"Authorization": f"Bearer {os.environ['REEF_TOKEN']}", "x-reef-scenario": "hello-reef"},
    timeout=300,
)

# Inference using Open-AI compatible format
response = reef.post(
    "/v1/chat/completions",
    json={
        "model": os.environ["MODEL_PATH"],
        "messages": [{"role": "user", "content": "Return exactly: reef is ready"}],
    },
)

receipt = response.headers["x-reef-agent-record-id"]
answer = response.json()["choices"][0]["message"]["content"]

# Sending report about the inference
matched = answer.strip() == "reef is ready"

reef.post(
    "/reef/report",
    json={"score": float(matched), "feedback": "matched" if matched else "wrong answer", "references": [receipt]},
).raise_for_status()

feedback carries the richer signal, plain text or a structured object, for recipes that read more than a scalar. The endpoint will validate the report schema (reef/core/reports/).

Watch it learn and grow

Once the recipe has enough feedback, it runs a training step and synchronizes the updated weights to the serving runtime. Later inference requests use the current version without restarting Reef.

3 · Evolve your harness

The harness_evolve recipe updates a harness tree that may contain rules, skills, configuration, prompts, and extensions. It builds a candidate from reported interactions, evaluates the current and candidate harnesses on the configured tasks, and publishes the candidate only when it wins that comparison. Harness scenarios do not share data or versions.

Install Reef harness that grows with you

You can install Reef harness like how you install most coding agents. The following is an example. A new scenario will be automatically created and bundled with the downloaded harness.

curl -fsS -H "Authorization: Bearer $REEF_TOKEN" \
  'http://localhost:8900/reef/harness/install?adapter=pi' | bash

reef-pi -p "fix the bug"

You can also retrieve an evolved harness by supplying its scenario in the header. For example, if you have a scenario harness-evolve-code-repair, you can install its harness via the following.

curl -fsS -H 'x-reef-scenario: harness-evolve-code-repair' \
  -H "Authorization: Bearer $REEF_TOKEN" \
  'http://localhost:8900/reef/harness/install?adapter=pi' | bash

Report a task result

reef-pi stores the receipts from a run, so its report command only needs the result you want to associate with the preceding interaction:

reef-pi -p "fix the failing test in auth.py"

# ... run your tests, grade the result ...

reef-pi report --score 0 --feedback "missed the empty-token case"
# reef-pi: reported 1 receipt(s) to harness-evolve-code-repair

Reef batches eligible reports according to the recipe configuration. When version checking is enabled, the adapter checks for a newer published version the next time it starts. Interactive sessions offer Update with … and Skip before accepting input; choosing update runs the installer directly. Headless sessions print the instruction instead. The harness evolution guide describes the proposal, evaluation, and publication process.

Cookbook recipes

Choose a recipe based on the feedback available from the workload and the artifact that should be updated. These implementations live in this repository's recipes/ cookbook; they are selected by dotted class reference and do not ship in the Reef wheel.

Workload Recipe module Updated artifact Documentation
A stream of tasks scored by tests or a verifier recipes.sao.recipe:SAORecipe Model weights Guide · Example
Agent traffic with useful next-state signals and no explicit reports recipes.openclawrl.recipe:OpenClawRLRecipe Model weights Guide · Example
Repeated, scored attempts at one problem recipes.tttd.recipe:TTTDRecipe Model weights Guide · Example
Scored code search with a trainable guidance model and a frozen executor recipes.tttd.recipe:TTTDRecipe Guidance-model weights Guide · Example
Agent feedback used to evolve its skill pool recipes.skillclaw.recipe:SkillClawRecipe Skill pool (harness tree); no GPU required Guide · Example

How is Reef different?

Reef builds the infra for AI that grows:

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)

Learn more

The documentation is organized in the following order:

  • Quickstart: install Reef, connect a client, and inspect the version history
  • HTTP API: use the HTTP API and report feedback
  • Write a recipe: configure how Reef processes data and produces updates
  • Evolve your harness: evolve a harness instead of model weights
  • Evolve your model: configure and operate a training deployment
  • Recipes: additional references on the cookbook implementations in this repository
  • Architecture: Overall architecture of Reef
  • Glossary: Explanation of the terminologies used

Community & Contributing

Working on continual self-improving agent?

If Reef looks useful to you, please give it a ⭐ — it helps the community to discover and contribute to the project.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reef_infra-0.0.1.tar.gz (4.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reef_infra-0.0.1-py3-none-any.whl (434.3 kB view details)

Uploaded Python 3

File details

Details for the file reef_infra-0.0.1.tar.gz.

File metadata

  • Download URL: reef_infra-0.0.1.tar.gz
  • Upload date:
  • Size: 4.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for reef_infra-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ec1e4d46514e4abcceca65403ae7486be879f0824a99c361fd4f7e3486fbe249
MD5 b7d467bfdd73e405994cd11dd2f62326
BLAKE2b-256 60c2e4d11568e0977421b856f4c1856d12ded3b6e519e2edf24e702037191b08

See more details on using hashes here.

Provenance

The following attestation bundles were made for reef_infra-0.0.1.tar.gz:

Publisher: release.yml on Human-Agent-Society/reef

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file reef_infra-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: reef_infra-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 434.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for reef_infra-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2acba4e72e60e555528668da2a9fb3ab43f76280a063c5df9db85159a5685261
MD5 9da913c7acf92579acae65d6e003e03f
BLAKE2b-256 786ff7c2aac97e1a5315ef06af6d2b9fd96ff0972e7a2619d7146e575f7a15e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for reef_infra-0.0.1-py3-none-any.whl:

Publisher: release.yml on Human-Agent-Society/reef

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.0.2

2 files

This release

0.0.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page