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

AxAgent

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L129

Pipeline-based coordinator. Every run walks the same static sequence:

distiller (RLM actor) → executor (RLM actor) ↓ responder (Synthesizer)

The distiller’s final(request, evidence) payload feeds the executor as {executorRequest, distilledContext}. When no contextFields are declared, the distiller still acts as the context-understanding/request-normalization stage over the original inputs.

This is the primary user-facing class. ActorAgentRLM and Synthesizer are exported for callers that need direct per-instance control.

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Implements

Constructors

Constructor

TypeScript
new AxAgent<IN, OUT>(init: Readonly<{
  agentIdentity?: Readonly<AxAgentIdentity>;
  agentModuleNamespace?: string;
  ai?: Readonly<AxAIService>;
  judgeAI?: Readonly<AxAIService>;
  signature:   | string
     | Readonly<AxSignatureConfig>
     | Readonly<AxSignature<IN, OUT>>;
}>, options: Readonly<AxAgentOptions<IN>>): AxAgent<IN, OUT>;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L179

Parameters

ParameterType
initReadonly<{ agentIdentity?: Readonly<AxAgentIdentity>; agentModuleNamespace?: string; ai?: Readonly<AxAIService>; judgeAI?: Readonly<AxAIService>; signature: | string | Readonly<AxSignatureConfig> | Readonly<AxSignature<IN, OUT>>; }>
optionsReadonly<AxAgentOptions<IN>>

Returns

AxAgent<IN, OUT>

Properties

PropertyModifierTypeDescription
distillerreadonlyActorAgentRLM<any, any>RLM actor that normalizes the request and distils context evidence.
distillerAi?readonlyReadonly<AxAIService<unknown, unknown, string>>Per-stage AI service overrides. When set, the corresponding stage uses this AI service instead of the one passed positionally to forward(). forward(ai, ...) is the fallback when the stage-specific override is not defined.
executorreadonlyActorAgentRLM<any, any>RLM actor that runs tools / discovery with the pre-distilled context.
executorAi?readonlyReadonly<AxAIService<unknown, unknown, string>>-
executorExcludeFieldsreadonlySet<string>Field names stripped from executor inputs (from executorOptions.excludeFields).
responderreadonlySynthesizer<OUT>Synthesizer that produces the user’s output signature. Always present.
responderAi?readonlyReadonly<AxAIService<unknown, unknown, string>>-
responderExcludeFieldsreadonlySet<string>Field names stripped from responder inputs (from responderOptions.excludeFields).

Accessors

primaryAgent

Get Signature

TypeScript
get primaryAgent(): ActorAgentRLM<any, any>;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L145

Backward-compat handle used by legacy access patterns: returns the actor stage that “owns” the run-time forward — always the executor in current pipeline shapes. Tests reach in via agent.primaryAgent.actorProgram etc.

Returns

ActorAgentRLM<any, any>

Methods

_forwardForEvaluation()

TypeScript
_forwardForEvaluation<T>(
   parentAi: T, 
   task: Readonly<AxAgentEvalTask<IN>>, 
options?: Readonly<AxProgramForwardOptionsWithModels<T>>): Promise<AxAgentEvalPrediction<OUT>>;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L810

Internal

Used by the optimizer to evaluate a single dataset task end-to-end.

Type Parameters

Type Parameter
T extends Readonly<AxAIService<unknown, unknown, string>>

Parameters

ParameterType
parentAiT
taskReadonly<AxAgentEvalTask<IN>>
options?Readonly<AxProgramForwardOptionsWithModels<T>>

Returns

Promise<AxAgentEvalPrediction<OUT>>


_syncContextMapPrompt()

TypeScript
_syncContextMapPrompt(): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L612

Returns

void


_updateContextMapFromPipelineState()

TypeScript
_updateContextMapFromPipelineState(
   ai: Readonly<AxAIService>, 
   state: Readonly<Record<string, any>>, 
finalOutput?: unknown): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L620

Parameters

ParameterType
aiReadonly<AxAIService>
stateReadonly<Record<string, any>>
finalOutput?unknown

Returns

Promise<void>


applyOptimization()

TypeScript
applyOptimization(optimizedProgram: any): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L747

Parameters

ParameterType
optimizedProgramany

Returns

void

Implementation of

AxAgentic.applyOptimization


applyOptimizedComponents()

TypeScript
applyOptimizedComponents(updates: Readonly<Record<string, string>>): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L762

Apply a map of componentKey → newValue updates produced by an optimizer. Each program filters keys belonging to itself and dispatches internally. Unknown keys are silently ignored, which lets parents broadcast a single map across the whole subtree.

Parameters

ParameterType
updatesReadonly<Record<string, string>>

Returns

void

Implementation of

AxAgentic.applyOptimizedComponents


forward()

TypeScript
forward<T>(
   ai: T, 
   values: IN, 
options?: Readonly<AxAgentForwardOptions<T>>): Promise<OUT>;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L401

Type Parameters

Type Parameter
T extends Readonly<AxAIService<unknown, unknown, string>>

Parameters

ParameterType
aiT
valuesIN
options?Readonly<AxAgentForwardOptions<T>>

Returns

Promise<OUT>

Implementation of

AxAgentic.forward


getChatLog()

TypeScript
getChatLog(): readonly AxChatLogEntry[];

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L559

Returns

readonly AxChatLogEntry[]

Implementation of

AxAgentic.getChatLog


getContextMap()

TypeScript
getContextMap(): undefined | AxAgentContextMap;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L596

Returns

undefined | AxAgentContextMap


getFunction()

TypeScript
getFunction(): AxFunction;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L417

Returns

AxFunction

Implementation of

AxAgentic.getFunction


getId()

TypeScript
getId(): string;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L437

Returns

string

Implementation of

AxAgentic.getId


getOptimizableComponents()

TypeScript
getOptimizableComponents(): readonly any[];

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L754

Enumerate all string-valued artifacts this program tree exposes for reflective optimization (instructions, signature descriptions, function names/descriptions, agent system prompts, etc.). Composite programs flat-map their children’s components and append their own.

The optimizer never walks the tree — traversal is encapsulated here.

Returns

readonly any[]

Implementation of

AxAgentic.getOptimizableComponents


getSignature()

TypeScript
getSignature(): AxSignature;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L426

Returns

AxSignature

Implementation of

AxAgentic.getSignature


getStagedUsage()

TypeScript
getStagedUsage(): object;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L532

Returns

object

NameType
ctx?AxAgentUsage
taskAxAgentUsage

getState()

TypeScript
getState(): undefined | AxAgentState;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L588

Returns

undefined | AxAgentState


getTraces()

TypeScript
getTraces(): AxProgramTrace<IN, OUT>[];

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L472

Returns

AxProgramTrace<IN, OUT>[]

Implementation of

AxAgentic.getTraces


getUsage()

TypeScript
getUsage(): AxAgentUsage;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L520

Returns

AxAgentUsage

Implementation of

AxAgentic.getUsage


namedProgramInstances()

TypeScript
namedProgramInstances(): AxNamedProgramInstance<IN, OUT>[];

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L462

Returns

AxNamedProgramInstance<IN, OUT>[]

Implementation of

AxAgentic.namedProgramInstances


namedPrograms()

TypeScript
namedPrograms(): object[];

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L450

The explorer is reported under ctx.* and the executor / responder pair under task.* so optimizer demo IDs and template-overrides keep stable stage ownership.

Returns

object[]


optimize()

TypeScript
optimize(dataset: Readonly<AxAgentEvalDataset<IN>>, options?: Readonly<AxAgentOptimizeOptions<_IN, _OUT>>): Promise<AxAgentOptimizeResult<OUT>>;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L770

Parameters

ParameterType
datasetReadonly<AxAgentEvalDataset<IN>>
options?Readonly<AxAgentOptimizeOptions<_IN, _OUT>>

Returns

Promise<AxAgentOptimizeResult<OUT>>


resetUsage()

TypeScript
resetUsage(): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L584

Returns

void

Implementation of

AxAgentic.resetUsage


setContextMap()

TypeScript
setContextMap(map?: 
  | string
  | AxAgentContextMapSnapshot
  | AxAgentContextMap): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L600

Parameters

ParameterType
map?| string | AxAgentContextMapSnapshot | AxAgentContextMap

Returns

void


setDemos()

TypeScript
setDemos(demos: readonly (
  | AxAgentDemos<IN, OUT>
  | AxProgramDemos<IN, OUT>)[], options?: object): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L484

Parameters

ParameterType
demosreadonly ( | AxAgentDemos<IN, OUT> | AxProgramDemos<IN, OUT>)[]
options?{ modelConfig?: Record<string, unknown>; }
options.modelConfig?Record<string, unknown>

Returns

void

Implementation of

AxAgentic.setDemos


setId()

TypeScript
setId(id: string): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L441

Parameters

ParameterType
idstring

Returns

void

Implementation of

AxAgentic.setId


setSignature()

TypeScript
setSignature(signature: AxSignatureInput): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L652

Parameters

ParameterType
signatureAxSignatureInput

Returns

void


setState()

TypeScript
setState(state?: AxAgentState): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L592

Parameters

ParameterType
state?AxAgentState

Returns

void


stop()

TypeScript
stop(): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L430

Returns

void


streamingForward()

TypeScript
streamingForward<T>(
   ai: T, 
   values: IN, 
options?: Readonly<AxAgentStreamingForwardOptions<T>>): AxGenStreamingOut<OUT>;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L409

Type Parameters

Type Parameter
T extends Readonly<AxAIService<unknown, unknown, string>>

Parameters

ParameterType
aiT
valuesIN
options?Readonly<AxAgentStreamingForwardOptions<T>>

Returns

AxGenStreamingOut<OUT>

Implementation of

AxAgentic.streamingForward


test()

TypeScript
test(
   code: string, 
   values?: Partial<IN>, 
   options?: Readonly<{
  abortSignal?: AbortSignal;
  ai?: AxAIService<unknown, unknown, string>;
  debug?: boolean;
}>): Promise<AxAgentTestResult>;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/agent/agentInternal/coordinator.ts#L823

Parameters

ParameterType
codestring
values?Partial<IN>
options?Readonly<{ abortSignal?: AbortSignal; ai?: AxAIService<unknown, unknown, string>; debug?: boolean; }>

Returns

Promise<AxAgentTestResult>

Docs