AxAgentOptions Generated TypeScript API reference. typescript api api/reference build/apidocs/TypeAlias.AxAgentOptions.md type AxAgentOptions

AxAgentOptions

TypeScript
type AxAgentOptions<IN> = Omit<AxProgramForwardOptions<string>, "functions" | "description" | "onFunctionCall"> & object;

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

Type declaration

NameTypeDescription
actorTurnCallback?AxAgentActorTurnCallbackCalled after each actor turn is recorded with both the raw runtime result and the formatted action-log output.
agentStatusCallback()?(message: string, status: "success" | "failed") => void | Promise<void>Called when the executor signals task progress via reportSuccess(message) or reportFailure(message).
bubbleErrors?ReadonlyArray<(…args: any[]) => Error>Error classes that should bubble up instead of being caught and returned to the LLM.
contextFields?readonly AxContextFieldInput[]Input fields used as context. - string: runtime-only (legacy behavior) - { field, promptMaxChars }: runtime + conditionally inlined into the distiller prompt - { field, keepInPromptChars, reverseTruncate? }: runtime + truncated string excerpt in the distiller prompt
contextMap?AxAgentContextMapConfigOptional persistent context map for recurring long-context work. When configured, Ax injects the map into the distiller prompt and updates it once after each successful completed run. Use onUpdate to persist the updated snapshot.
contextOptions?AxStageOptionsForward options for the context distiller stage. Configures the REPL/turn loop and forward-to-LLM options for the context-understanding stage that runs before the executor. Set ai to override the AI service for this stage only — falls back to forward(ai, ...) when not set.
contextPolicy?AxContextPolicyConfigContext replay, checkpointing, and runtime-state policy.
debug?boolean-
executorModelPolicy?AxExecutorModelPolicyOrdered executor-model overrides keyed by consecutive error turns or namespace matches. Later entries take precedence over earlier ones.
executorOptions?AxStageOptionsForward options for the task executor stage. Set ai to override the AI service for this stage only — falls back to forward(ai, ...) when not set.
functionDiscovery?booleanEnables runtime callable discovery (modules + on-demand definitions).
functions?AxAgentFunctionCollectionTools registered under their configured namespace globals. May contain AxFunction / AxAgentFunction entries, grouped function modules, or AxAgentic instances — agents are auto-converted via .getFunction() and land under their agentIdentity.namespace (or utils if unset), exactly like a plain function. Pass an AxAgent here to use it as a child tool.
inputUpdateCallback?AxAgentInputUpdateCallback<IN>Called before each executor turn with current input values. Return a partial patch to update in-flight inputs for subsequent executor/responder steps.
judgeOptions?AxAgentJudgeOptionsDefault options for the built-in judge used by optimize().
maxBatchedLlmQueryConcurrency?numberMaximum parallel llmQuery calls in batched mode (default: 8).
maxRuntimeChars?numberMaximum characters to keep from runtime output and console/log replay.
maxSubAgentCalls?numberGlobal cap on recursive sub-agent calls across all descendants (default: 100).
maxTurns?numberMaximum Actor turns before forcing Responder (default: 10).
onContextEvent?AxAgentOnContextEventCalled when AxAgent measures context pressure or creates/clears compacted context. Use for observability and evaluation; failures are ignored.
onFunctionCall?AxAgentOnFunctionCallFired whenever any function registered on the agent is invoked from the runtime. kind is 'external' for user-registered functions, 'internal' for agent-injected ones (child agents, skills/memories loaders, discovery globals).
onLoadedMemories()?(results: readonly AxAgentMemoryResult[]) => void | Promise<void>Optional callback fired whenever recall(...) loads memories. Receives the matched { id, content }[] from onMemoriesSearch. Use this for load telemetry, cache warming, or feedback loops on retrieval relevance — it does not mean the actor used every memory in its final reasoning.
onLoadedSkills()?(results: readonly AxAgentSkillResult[]) => void | Promise<void>Optional callback fired whenever discover({ skills }) loads skills. Receives the matched { id?, name, content }[] from onSkillsSearch. Use this for analytics, telemetry, or feedback loops on skill relevance — it does not affect runtime behaviour.
onMemoriesSearch?AxAgentMemoriesSearchFnOptional memories search callback. When set, the distiller and executor stages gain a recall(searches: string[]): void global, and both stages get a memories input field. The callback receives the raw search strings plus a snapshot of inputs.memories already loaded for the current run (alreadyLoaded), and returns matched memories ({ id, content }); the runtime appends matched entries to inputs.memories (deduped by id, sorted) so the next turn’s prompt includes them. Use alreadyLoaded to skip work for entries the actor already has — e.g. filter your vector search by id NOT IN alreadyLoaded. recall() itself returns nothing — the actor reads inputs.memories next turn to see what landed. Memories loaded by the distiller thread to the executor automatically; the responder does not receive the memories field. Memories live for one .forward() call; persist them externally to carry across calls.
onSkillsSearch?AxAgentSkillsSearchFnOptional skills search callback. When set, the executor runtime gains a discover({ skills }) path. The callback receives the raw search strings and returns matched skills ({ id?, name, content }); each returned skill’s content is rendered into the executor system prompt for subsequent turns (sorted by id to keep the prefix cache stable). discover(...) itself returns nothing — the actor inspects the Loaded Skills section of the next turn’s prompt to see what landed.
onUsedMemories?AxAgentUsedMemoriesCallbackOptional callback fired once per agent forward when memory usage tracking is enabled. Receives actor-declared memories that actually influenced the distiller or executor ({ id, reason?, stage }). Unknown ids are dropped.
onUsedSkills?AxAgentUsedSkillsCallbackOptional callback fired once per agent forward when skill usage tracking is enabled. Receives actor-declared skills that actually influenced the executor ({ id, name, reason?, stage }). Unknown ids are dropped.
promptLevel?"default" | "detailed"Actor prompt verbosity and scaffolding level (default: ‘default’).
recursionOptions?AxAgentRecursionOptionsDefault forward options for recursive llmQuery sub-agent calls. Set ai to route recursive sub-agent calls to a different AI service than the one used for the parent agent. Falls back to the parent forward(ai, ...) argument when ai is not set.
responderOptions?AxStageOptionsForward options for the final responder stage. Set ai to override the AI service for this stage only — falls back to forward(ai, ...) when not set.
runtime?AxCodeRuntimeCode runtime for the REPL loop (default: AxJSRuntime).
skills?readonly AxAgentSkillResult[]Skills to preload into the executor prompt at startup, in the same shape returned by onSkillsSearch ({ id?, name, content }). Useful when the caller already knows which skills are relevant and wants to skip the actor’s discover({ skills }) round-trip. Merged with skills passed at forward()-time (forward overrides by id). Does NOT fire onLoadedSkills — that callback is for runtime-loaded skills.
summarizerOptions?Omit<AxProgramForwardOptions<string>, "functions">Default options for the internal checkpoint summarizer.

Type Parameters

Type ParameterDefault type
IN extends AxGenInAxGenIn
Docs