Open Agent Loops
API Reference

modelGrader

@open-agent-loops/core


function modelGrader(options): Grader;

Defined in: goal/model-grader.ts:67

Build a Grader backed by a model.

Parameters

ParameterTypeDescription
optionsModelGraderOptionsThe grader model and optional prompt override.

Returns

Grader

A Grader suitable for runGoal.

Remarks

The returned grader runs one model call per round: it feeds the goal and the round's latest assistant output to the model and parses the JSON verdict it returns (tolerating markdown fences or surrounding prose). It forwards ctx.signal so a cancelled goal loop also cancels the in-flight grading call.

Throws

Error if the model returns no parseable JSON verdict.

Example

const grader = modelGrader({ model: fastModel });
await runGoal({ goal, grader, base });

See

Grader

On this page