Skip to content

RunContext

optional abortSignal?: AbortSignal;

optional agentTools?: Record<string, AnyTool>;

Agent-scoped tools (agent.tools) for toolScope: 'open' resolution in flow nodes.


optional autoRetrieve?: AutoRetrieveProvider;

optional bargeIn?: AbortSignal;

optional baseInstructions?: Instructions;

Agent base layer, set when entering a flow. baseInstructions is composed as a prefix into every node turn’s system prompt (persona / safety / grounding floor); globalTools are safe tools made model-visible in every speaking turn.


controlModel: LanguageModel;

Control-path model (routing, decide, extraction) at temperature 0.


emit: (part) => void;
Parameter Type

part

StreamPart

void


optional flowGateJudge?:
| LanguageModel
| FlowGateJudgeProvider;

Structured judge for flow gates of kind judge. Absent at evaluation time is an execution error (always blocking).


optional fs?: FileSystem;

Agent workspace filesystem (same instance as AgentConfig.workspace).


optional globalTools?: Record<string, AnyTool>;

inputProcessors: InputProcessor[];

optional lastRetrievalCitations?: SourceRef[];

Citations from the latest gather-phase retrieval on this turn.


optional limits?: Limits;

optional memoryService?: MemoryService;

model: LanguageModel;

outOfBandControl: boolean;

When true, flow reply nodes use the out-of-band control evaluator.


outputProcessors: OutputProcessor[];

policy: Policy;

Decides allow / ask / deny per tool call. Reassigned on handoff.


refinementPolicies: RefinementCapability[];

optional retrievalCache?: RetrievalCacheAdapter;

Session retrieval cache (G6): created once per run by the KnowledgeProvider, persists across in-session agent handoffs (this RunContext survives the handoff branch). Keyed by query embedding; RAG-only, undefined without a configured knowledge provider + embedder.


runState: RunState;

runStore: RunStore;

session: Session;

optional skillActivations?: SkillActivation[];

Turn-scoped skills activated by successful load_skill with allowed-tools.


optional skillCatalog?: LiveSkillCatalog;

The live skill catalog load_skill resolves against for this run. The frozen roster in skillPrompt is the baseline; this mutates freely and changes are announced in the transcript (never by rewriting skillPrompt). Undefined when the agent has no skills.


optional skillPrompt?: string;

Level-1 skill metadata injected by SkillsCapability when AgentConfig.skills is set.


optional telemetry?: TelemetryOptions;

toolExecutor: EffectToolExecutor;

optional turnInputConsumed?: boolean;

Ephemeral, per-run-invocation flag: has the current turn’s user input been consumed yet by an input-node (collect/decide)? Input-nodes extract/decide from the turn’s fresh input; once it is consumed, later nodes in the same turn pause (present prompt, await next turn) instead of acting on stale context. Reset to false on every createRunContext (i.e. every turn).


validationPolicies: ValidationCapability[];

optional workingMemoryPrompt?: string;

Frozen persistent memory blocks loaded at session start (AgentMemory.workingMemory).


optional workingMemoryTools?: Record<string, AnyTool>;

Model-visible tools from working memory wiring (not in globalTools — mutating but scoped).

addSkill(skill): Promise<void>;

Add a skill to the live catalog for the current session. Announces the change once in the transcript and leaves skillPrompt byte-identical. No-op when the agent has no skills.

Parameter Type

skill

SkillLike

Promise<void>


approve(req): Promise<{
approved: boolean;
by?: string;
}>;
Parameter Type

req

{ description?: string; title: string; }

req.description?

string

req.title

string

Promise<{ approved: boolean; by?: string; }>


getSkill(name): SkillHandle;

Read-only access to bundled skill resources for tool/action code.

Parameter Type

name

string

SkillHandle


now(): Promise<number>;

Promise<number>


removeSkill(name): Promise<void>;

Withdraw a skill from the live catalog. Announces the withdrawal once. No-op when the agent has no skills or the skill was never available.

Parameter Type

name

string

Promise<void>


reserveCallsites(count): string[];

Reserve N contiguous effect callsite ordinals for parallel-safe tool batches (G9).

Parameter Type

count

number

string[]


resetCallsites(): void;

Rebase durable effect callsites to 0. The runtime calls this at flow entry so a flow’s durable callsites are anchored to the flow — identical on fresh entry (after an answering turn) and on resume (where that turn does not re-run).

void


signal<T>(name, opts): Promise<T>;
Type Parameter

T

Parameter Type

name

string

opts

{ deadline?: number; description?: string; meta?: Record<string, unknown>; responseSchema?: Record<string, unknown>; schema: StandardSchemaV1<unknown, T>; title?: string; }

opts.deadline?

number

opts.description?

string

opts.meta?

Record<string, unknown>

opts.responseSchema?

Record<string, unknown>

opts.schema

StandardSchemaV1<unknown, T>

opts.title?

string

Promise<T>


tool(
name,
args,
options?): Promise<unknown>;
Parameter Type Description

name

string

args

unknown

options?

{ callsite?: string; def?: AnyTool; index?: number; toolCallId?: string; toolCtx?: ToolContext; }

options.callsite?

string

Pre-reserved callsite ordinal for parallel-safe tool batches (G9).

options.def?

AnyTool

options.index?

number

Pre-reserved journal index for parallel-safe tool batches (G9).

options.toolCallId?

string

options.toolCtx?

ToolContext

Promise<unknown>


uuid(): Promise<string>;

Promise<string>