Skip to content
providerkit
GitHub

RunOptions

Defined in: agents/src/types.ts:815

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.


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.


optional enabledTools?: EnabledTools;

Defined in: agents/src/types.ts:827

Narrows the agent’s enabled tools for this run. Resolved once, before saving.


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


optional memory?: MemoryBinding;

Defined in: agents/src/types.ts:832

Trusted binding from authentication. Never select a scope from model arguments.


optional modelSettings?: ModelSettings;

Defined in: agents/src/types.ts:819

Overrides agent settings for this run. Recorded settings cannot change on resume.


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.

Parameter Type
event AgentEvent

void | Promise<void>


optional onLifecycle?: LifecycleHook;

Defined in: agents/src/types.ts:837

Privileged observer, inherited by children. Return values and failures are ignored.


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.

Parameter Type
history AgentMessage[]

| AgentMessage[] | Promise<AgentMessage[]>


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.


optional runId?: string;

Defined in: agents/src/types.ts:816


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.


optional signal?: AbortSignal;

Defined in: agents/src/types.ts:817