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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/agent/rlm.ts#L419

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

Methods

close()

TypeScript
close(): void;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/agent/rlm.ts#L448

Returns

void


execute()

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

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/agent/rlm.ts#L420

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/agent/rlm.ts#L432

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/agent/rlm.ts#L436

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/agent/rlm.ts#L444

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/agent/rlm.ts#L440

Parameters

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

Returns

Promise<AxCodeSessionSnapshot>

Docs