Recipes

Basic example

The smallest example: one Harbor task, a harness that asks Reef for the answer, and a report of the verifier's reward. Copy it to start a new example (How to write a new recipe or example).

The task asks for 17 * 23 in /workspace/answer.txt; the verifier writes reward 1 for 391, else 0. The harness sends the task to Reef's /v1/chat/completions in the scenario basic-arithmetic, writes the answer, and posts the reward as a report that references the receipt. The deployment is record-only (recipe.implementation: recipe): Reef records the call and the report, and trains nothing.

Run it#

You need the Reef environment of this checkout, Docker for Harbor's verifier, and a key for the provider in external-provider.yaml (gpt-4o at https://api.openai.com; edit the file for another provider).

Shell
pip install -e recipes/basic
export REEF_UPSTREAM_API_KEY=sk-...
recipes/basic/run.sh

run.sh starts reef serve with external-provider.yaml and its state in work/, waits for /healthz, and runs run.py. run.py prints rollout reward: .... The service log is work/reef.log.

reef serve -c recipes/basic/local-sglang.yaml starts the same record-only deployment on a local SGLang engine with Qwen/Qwen2.5-7B-Instruct.

Files#

Text
basic/
  harbor/                  the task: instruction.md, task.toml, environment/Dockerfile, tests/test.sh
  harness/
    __init__.py            exports HarborAgent lazily
    agent.py               HarborAgent: one model call through Reef, then the report of the verifier's reward
    report.py              post_report: the verifier's reward as a Reef report
  external-provider.yaml   a record-only deployment that proxies to an HTTP provider
  local-sglang.yaml        a record-only deployment on a local SGLang engine
  run.py                   runs the task once through reef-eval
  run.sh                   starts Reef, then runs run.py
  pyproject.toml           makes harness/ importable

The test is tests/contributing/test_example_startup.py.