Recipes

ReasoningBank

A harness evolution method after ReasoningBank (Ouyang et al.): a memory of strategies and lessons that the agent distills from its own runs, without ground truth.

What it trains#

The harness: one Agent Skill skills/rb-<slug>/SKILL.md for each memory item. Each job reads the job's runs. A run's score sets its outcome, success or failure; a judge model labels a run without a score. An extractor model then writes memory items from the run: strategies from a success, lessons from a failure. The bank of items is the method's state. The harness lists each skill's description, and the agent opens the skills that fit its task, so the description is the retrieval key. method.py describes the job and the item format.

Differences from the paper:

  • Retrieval: the paper puts the most similar items, by embedding, into the system prompt. Here the agent chooses from the skill list.
  • Labels: only a run without a score goes to the judge.
  • Consolidation: an item whose title gives the slug of a bank item replaces it, and the bank keeps at most max_items.
  • Screening: an item with a credential or an instruction override stays out of the bank.
  • The prompts are Reef's own, ask for JSON, and set no sampling temperature.
  • Memory-aware test-time scaling (MaTTS) is not part of the method.

When to use it#

  • To learn from live agent sessions, scored or not, on any adapter (every adapter renders skills).
  • When the lessons are many and each fits a situation that the agent can recognise from a description.

To keep the lessons in one file that every session reads, with helpful and harmful counts, use ACE. To improve harness text on fixed tasks with a scorer, use GEPA.

Requirements#

  • A Reef checkout (recipes/ is not in the wheel) and an OpenAI-compatible model endpoint. No GPU.
  • The pi harness for the example's clients. Reef installs its pinned pi at startup when evolution.binary is unset.

Run the example#

The example serves qwen3-8b from http://127.0.0.1:8000; edit its inference section for another model. From the repository root:

Shell
reef serve -c recipes/reasoning_bank/examples/serve.yaml

Connect pi clients as Evolve your harness describes. Every model call is a trace, so no client reports a score. Each published snapshot carries the bank as skills/rb-*.

Configuration#

The settings reference describes the recipe.config.evolution keys. A deployment sets:

  • evolution.method: recipes.reasoning_bank:ReasoningBank. Its config keys are the fields of ReasoningBankSettings in method.py: judge_model, extract_model, success_score, max_items_per_trace, max_items and max_traces_per_step.
  • evolution.models: a stronger judge or extractor, named in judge_model or extract_model. The default is the served model, as in the paper.
  • evolution.max_model_calls_per_step: allow two calls per run (judge and extractor). A job past the limit fails.
  • evolution.evaluation.policy: none in the example. With compare or floor, the bank keeps every item that it learned, also from a rejected job, and each job proposes the whole bank again.
  • pipeline.record2sample.module: reef.samples.traces:InferenceSamples: learn from every model call. Delete it when clients report a score for each run (POST /reef/report).

Results#

No measured results.

Files#

Text
reasoning_bank/
  __init__.py            exports ReasoningBank
  method.py              ReasoningBank, its settings, and the memory item
  prompts/judge.md       the judge's prompt
  prompts/extract.md     the extractor's prompt
  prompts/success.md     what the extractor looks for in a success
  prompts/failure.md     what the extractor looks for in a failure
  examples/serve.yaml    an online deployment on pi, without ground truth

The tests are in tests/recipes/reasoning_bank/.