AxAgentSharedRuntimeSession Generated TypeScript API reference. typescript api api/reference build/apidocs/Class.AxAgentSharedRuntimeSession.md class AxAgentSharedRuntimeSession

AxAgentSharedRuntimeSession

Defined in: https://github.com/ax-llm/ax/blob/3306475085414d36aee4411ad2466e08e53bef8a/src/ax/agent/agentInternal/sharedSession.ts#L288

Coordinates one runtime session across the pipeline’s distiller and executor phases. Created per AxAgent.forward() by the pipeline, handed to both actor runs, closed by the pipeline.

Shared mode requires a JavaScript-capable runtime (the phase boundary is an in-session snippet). For other runtimes the pipeline keeps mode: 'fallback': each stage runs in its own session exactly as before, and the evidence value crosses through the host into the executor’s runtime globals — correctness preserved, zero-copy lost.

Constructors

Constructor

TypeScript
new AxAgentSharedRuntimeSession(options?: Readonly<{
  mode?: "shared" | "fallback";
}>): AxAgentSharedRuntimeSession;

Defined in: https://github.com/ax-llm/ax/blob/3306475085414d36aee4411ad2466e08e53bef8a/src/ax/agent/agentInternal/sharedSession.ts#L314

Parameters

ParameterType
options?Readonly<{ mode?: "shared" | "fallback"; }>

Returns

AxAgentSharedRuntimeSession

Properties

PropertyModifierTypeDefault valueDescription
excludeFieldDeletionspublicreadonly string[][]Executor-stage field deletions applied at the phase boundary.
fallbackEvidencepublicundefined | Record<string, unknown>undefinedFallback mode only: the real evidence value held host-side.
modereadonly"shared" | "fallback"undefined-
phasepublicAxSharedSessionPhase'distiller'-
phase1ReservedNamespublicreadonly string[][]Phase-1 system/alias names, excluded from the executor phase’s runtime inspection so inherited context aliases don’t render as user variables.
restoredEntriespublic| undefined | AxCodeSessionSnapshotEntry[]undefinedEntries actually restored into the phase-1 session from restoreState, kept for the distiller’s restore notice / live-state rendering.
restoreStatepublicundefined | AxAgentStateundefinedCross-run state (from the coordinator’s canonical executor-held AxAgentState). Variable bindings are applied once when the phase-1 session is adopted; stage-level prompt state stays with each stage.
sessionpublicundefined | AxCodeSessionundefined-

Accessors

isShared

Get Signature

TypeScript
get isShared(): boolean;

Defined in: https://github.com/ax-llm/ax/blob/3306475085414d36aee4411ad2466e08e53bef8a/src/ax/agent/agentInternal/sharedSession.ts#L318

Returns

boolean

Methods

adoptDistillerSession()

TypeScript
adoptDistillerSession(session: AxCodeSession, options: Readonly<{
  reservedNames: readonly string[];
  signal?: AbortSignal;
}>): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/3306475085414d36aee4411ad2466e08e53bef8a/src/ax/agent/agentInternal/sharedSession.ts#L326

Adopt the freshly created phase-1 session: apply cross-run variable bindings, install the in-worker final wrapper, remember reserved names.

Parameters

ParameterType
sessionAxCodeSession
optionsReadonly<{ reservedNames: readonly string[]; signal?: AbortSignal; }>

Returns

Promise<void>


beginExecutorPhase()

TypeScript
beginExecutorPhase(options: Readonly<{
  aliasNames: readonly string[];
  inputs: Record<string, unknown>;
  phaseGlobals: Record<string, unknown>;
  signal?: AbortSignal;
}>): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/3306475085414d36aee4411ad2466e08e53bef8a/src/ax/agent/agentInternal/sharedSession.ts#L363

Transition the adopted session into the executor phase. phaseGlobals are the executor run’s host closures (final/askClarification/llmQuery/ tools/…) patched over the phase-1 bindings; inputs are the executor’s input values merged per key.

Parameters

ParameterType
optionsReadonly<{ aliasNames: readonly string[]; inputs: Record<string, unknown>; phaseGlobals: Record<string, unknown>; signal?: AbortSignal; }>

Returns

Promise<void>


close()

TypeScript
close(): void;

Defined in: https://github.com/ax-llm/ax/blob/3306475085414d36aee4411ad2466e08e53bef8a/src/ax/agent/agentInternal/sharedSession.ts#L419

Returns

void


mergeInputs()

TypeScript
mergeInputs(inputs: Record<string, unknown>, options?: Readonly<{
  signal?: AbortSignal;
}>): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/3306475085414d36aee4411ad2466e08e53bef8a/src/ax/agent/agentInternal/sharedSession.ts#L395

Mid-phase per-key input sync (replaces wholesale inputs patches).

Parameters

ParameterType
inputsRecord<string, unknown>
options?Readonly<{ signal?: AbortSignal; }>

Returns

Promise<void>


replaceSession()

TypeScript
replaceSession(session: AxCodeSession): void;

Defined in: https://github.com/ax-llm/ax/blob/3306475085414d36aee4411ad2466e08e53bef8a/src/ax/agent/agentInternal/sharedSession.ts#L415

Session-death recovery mid-phase: the runtime context recreated a fresh session; track it so close() targets the live one. Inherited state is gone, which matches the existing per-stage restart semantics.

Parameters

ParameterType
sessionAxCodeSession

Returns

void

Docs