API Reference
RunGoalOptions
Defined in: goal/goal.types.ts:99
Inputs for a single runGoal run. Provide the agent one of two mutually exclusive ways:
base— shared per-round runAgent config (optionally withrunoverriding how rounds execute). ThesessionIdlives insidebase.agent+sessionId— one self-contained Agent value that closes over its own config;runGoalcalls it each round with the round's prompt and thissessionId.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
agent? | Agent | A self-contained agentic loop to drive each round. Mutually exclusive with base/run; requires sessionId. | goal/goal.types.ts:110 |
base? | RunGoalRunBase | Shared per-round run config (model, memory, sessionId, tools, system, …). | goal/goal.types.ts:105 |
goal | string | The objective, in natural language — handed to the grader each round. | goal/goal.types.ts:101 |
grader | Grader | Judges each round and decides done-or-continue (and the next prompt). | goal/goal.types.ts:103 |
maxRounds? | number | Hard cap on outer rounds (each round is one full inner run). Default 5. | goal/goal.types.ts:123 |
onRound? | (info) => void | Promise<void> | Observe each round's verdict as it settles (for logging/telemetry). | goal/goal.types.ts:133 |
prompt? | | string | Message | Message[] | The first round's prompt. Omitted → the run starts from the goal restated as the prompt. | goal/goal.types.ts:121 |
run? | RunFn | Override how each round runs (for tests). Default runAgent. | goal/goal.types.ts:125 |
sessionId? | string | The session every round runs on (so each round loads the prior rounds' history). Required with agent; ignored with base (whose own sessionId is used). | goal/goal.types.ts:116 |
signal? | AbortSignal | Cancel the whole goal loop. Forwarded to each round's inner run and re-checked at the top of each round, so an abort between rounds rejects promptly instead of starting another round. | goal/goal.types.ts:131 |