RunOptions
Defined in: agents/src/types.ts:815
Properties
Section titled “Properties”bindModelProvider?
Section titled “bindModelProvider?”optional bindModelProvider?: ModelProviderBinding;Defined in: agents/src/types.ts:840
Per-dispatch provider instrumentation. Inherited by children, never saved in checkpoints. Does not wrap tool execution or install an ambient async context manager.
context?
Section titled “context?”optional context?: ToolContext;Defined in: agents/src/types.ts:830
Passed to tools with reserved runId, attemptId, operationId, callId, signal and reportCost
supplied by the loop. reportCost(usd) adds what the call spent outside the model calls.
enabledTools?
Section titled “enabledTools?”optional enabledTools?: EnabledTools;Defined in: agents/src/types.ts:827
Narrows the agent’s enabled tools for this run. Resolved once, before saving.
historyLimit?
Section titled “historyLimit?”optional historyLimit?: number;Defined in: agents/src/types.ts:846
How many of the session’s newest messages to load. Needs session.
optional host?: AgentHost;Defined in: agents/src/types.ts:833
memory?
Section titled “memory?”optional memory?: MemoryBinding;Defined in: agents/src/types.ts:832
Trusted binding from authentication. Never select a scope from model arguments.
modelSettings?
Section titled “modelSettings?”optional modelSettings?: ModelSettings;Defined in: agents/src/types.ts:819
Overrides agent settings for this run. Recorded settings cannot change on resume.
onEvent?
Section titled “onEvent?”optional onEvent?: (event) => void | Promise<void>;Defined in: agents/src/types.ts:835
Best-effort progress from the one stream reader. Observer errors do not stop work.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event |
AgentEvent |
Returns
Section titled “Returns”void | Promise<void>
onLifecycle?
Section titled “onLifecycle?”optional onLifecycle?: LifecycleHook;Defined in: agents/src/types.ts:837
Privileged observer, inherited by children. Return values and failures are ignored.
prepareHistory?
Section titled “prepareHistory?”optional prepareHistory?: (history) => | AgentMessage[]| Promise<AgentMessage[]>;Defined in: agents/src/types.ts:849
Runs once on the loaded or supplied history, before the run is saved, to trim or summarize it. Its result is frozen in the snapshot; resume never calls it again.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
history |
AgentMessage[] |
Returns
Section titled “Returns”| AgentMessage[]
| Promise<AgentMessage[]>
providerSessionId?
Section titled “providerSessionId?”optional providerSessionId?: string;Defined in: agents/src/types.ts:825
The id this run’s model calls send as core’s sessionId, which some providers route and
cache by: OpenCode Go’s session header, the ChatGPT backend’s session-id and
prompt_cache_key on the Responses shape. Defaults to the run id, so each run is its own
session. Pass the conversation id to keep one provider session across a conversation’s
turns. Recorded when the run starts; resume keeps it. Never passed to specialists.
runId?
Section titled “runId?”optional runId?: string;Defined in: agents/src/types.ts:816
session?
Section titled “session?”optional session?: Session;Defined in: agents/src/types.ts:844
Loads the history once, before the run is saved, and appends the turn once the run
settles. The input must then be the new turn only, not { messages }. Never passed to
specialists.
signal?
Section titled “signal?”optional signal?: AbortSignal;Defined in: agents/src/types.ts:817