API Reference
RunAgentOptions
Defined in: primitives/loop.ts:200
Inputs for a single runAgent run.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
hooks? | Hooks | Lifecycle hooks for guardrails and context shaping. | primitives/loop.ts:218 |
maxSteps? | number | Hard safety cap on model turns. Default 10. | primitives/loop.ts:214 |
memory | Memory | The history store the run loads from and appends to. | primitives/loop.ts:204 |
model | ModelClient | The LLM boundary the loop streams turns from. | primitives/loop.ts:202 |
onEvent? | EventSink | Sink for observability/streaming events emitted during the run. | primitives/loop.ts:222 |
prompt | | string | Message | Message[] | New input for this run: a string, a single message, or several. | primitives/loop.ts:208 |
sessionId | string | Session key used to load/append this conversation's history. | primitives/loop.ts:206 |
signal? | AbortSignal | Cancel the run. Remarks Aborting rejects runAgent with the signal's reason (an AbortError), checked before each turn and right after each model stream. The signal is also forwarded to the model request and every tool's execute context, so a cooperating client/tool can abort in-flight work; the loop's own checks guarantee it stops even if they don't. | primitives/loop.ts:233 |
stopWhen? | StopCondition | Optional early-stop predicate, evaluated after each turn's tools run. | primitives/loop.ts:216 |
system? | string | Optional system prompt prepended to the request. | primitives/loop.ts:210 |
toolExecution? | ExecutionMode | Force sequential tool execution regardless of per-tool mode. | primitives/loop.ts:220 |
tools? | Tool<ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>>[] | Tools the model may call this run. | primitives/loop.ts:212 |