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()
close(): void;Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L439
Returns
void
execute()
execute(code: string, options?: object): Promise<unknown>;Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L411
Parameters
| Parameter | Type |
|---|---|
code | string |
options? | { reservedNames?: readonly string[]; signal?: AbortSignal; } |
options.reservedNames? | readonly string[] |
options.signal? | AbortSignal |
Returns
Promise<unknown>
executeWithStatus()?
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
| Parameter | Type |
|---|---|
code | string |
options? | { reservedNames?: readonly string[]; signal?: AbortSignal; } |
options.reservedNames? | readonly string[] |
options.signal? | AbortSignal |
Returns
Promise<AxCodeExecutionResult>
inspectGlobals()?
optional inspectGlobals(options?: object): Promise<string>;Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L427
Parameters
| Parameter | Type |
|---|---|
options? | { reservedNames?: readonly string[]; signal?: AbortSignal; } |
options.reservedNames? | readonly string[] |
options.signal? | AbortSignal |
Returns
Promise<string>
patchGlobals()
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
| Parameter | Type |
|---|---|
globals | Record<string, unknown> |
options? | { signal?: AbortSignal; } |
options.signal? | AbortSignal |
Returns
Promise<void>
snapshotGlobals()?
optional snapshotGlobals(options?: object): Promise<AxCodeSessionSnapshot>;Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/agent/rlm.ts#L431
Parameters
| Parameter | Type |
|---|---|
options? | { reservedNames?: readonly string[]; signal?: AbortSignal; } |
options.reservedNames? | readonly string[] |
options.signal? | AbortSignal |
Returns
Promise<AxCodeSessionSnapshot>