AxCodeSession Generated TypeScript API reference. typescript api api/reference build/apidocs/Interface.AxCodeSession.md interface AxCodeSession

AxCodeSession

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L410

A persistent code execution session. Variables persist across execute() calls.

Methods

close()

TypeScript
close(): void;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L439

Returns

void


execute()

TypeScript
execute(code: string, options?: object): Promise<unknown>;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L411

Parameters

ParameterType
codestring
options?{ reservedNames?: readonly string[]; signal?: AbortSignal; }
options.reservedNames?readonly string[]
options.signal?AbortSignal

Returns

Promise<unknown>


executeWithStatus()?

TypeScript
optional executeWithStatus(code: string, options?: object): Promise<AxCodeExecutionResult>;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L423

Optional variant of execute() that also reports whether the resolved value describes an error in the code. Implement it when the runtime returns errors as readable text instead of rejecting (as AxJSRuntime does for ReferenceError, TypeError, SyntaxError, …) so AxAgent tags those turns as errors while the actor still reads the same text. Without it, only rejected executions count as errors.

Parameters

ParameterType
codestring
options?{ reservedNames?: readonly string[]; signal?: AbortSignal; }
options.reservedNames?readonly string[]
options.signal?AbortSignal

Returns

Promise<AxCodeExecutionResult>


inspectGlobals()?

TypeScript
optional inspectGlobals(options?: object): Promise<string>;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L427

Parameters

ParameterType
options?{ reservedNames?: readonly string[]; signal?: AbortSignal; }
options.reservedNames?readonly string[]
options.signal?AbortSignal

Returns

Promise<string>


patchGlobals()

TypeScript
patchGlobals(globals: Record<string, unknown>, options?: object): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L435

Parameters

ParameterType
globalsRecord<string, unknown>
options?{ signal?: AbortSignal; }
options.signal?AbortSignal

Returns

Promise<void>


snapshotGlobals()?

TypeScript
optional snapshotGlobals(options?: object): Promise<AxCodeSessionSnapshot>;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L431

Parameters

ParameterType
options?{ reservedNames?: readonly string[]; signal?: AbortSignal; }
options.reservedNames?readonly string[]
options.signal?AbortSignal

Returns

Promise<AxCodeSessionSnapshot>

Docs