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

AxAgentConfig

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

Extends

Type Parameters

Type Parameter
_IN extends AxGenIn
_OUT extends AxGenOut

Properties

PropertyTypeDescriptionOverridesInherited from
abortSignal?AbortSignalAbortSignal for cancelling in-flight requests.-AxAgentOptions.abortSignal
actorTurnCallback?AxAgentActorTurnCallbackCalled after each actor turn is recorded with both the raw runtime result and the formatted action-log output.-AxAgentOptions.actorTurnCallback
agentIdentity?AxAgentIdentity---
agentStatusCallback?(message: string, status: "success" | "failed") => void | Promise<void>Called when the executor signals task progress via reportSuccess(message) or reportFailure(message).-AxAgentOptions.agentStatusCallback
ai?AxAIService<unknown, unknown, string>-AxAgentOptions.ai-
asserts?AxAssertion<any>[]--AxAgentOptions.asserts
beta?booleanProvider-specific hint to opt in to beta API paths when available. Currently used by Google Gemini on Vertex AI to route requests through v1beta1 instead of the default stable v1 endpoint.-AxAgentOptions.beta
bubbleErrors?readonly (…args: any[]) => Error[]Error classes that should bubble up instead of being caught and returned to the LLM.-AxAgentOptions.bubbleErrors
cachingFunction?(key: string, value?: AxGenOut) => | undefined | AxGenOut | Promise<undefined | AxGenOut>--AxAgentOptions.cachingFunction
contextCache?AxContextCacheOptionsContext caching options for large prompt prefixes. When enabled, large prompt prefixes can be cached for cost savings and lower latency on subsequent requests. Currently supported by: Google Gemini/Vertex AI-AxAgentOptions.contextCache
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-AxAgentOptions.contextFields
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.-AxAgentOptions.contextMap
contextOptions?Partial<Omit<AxProgramForwardOptions<string>, "functions"> & object>Forward 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.-AxAgentOptions.contextOptions
contextPolicy?AxContextPolicyConfigContext replay, checkpointing, and runtime-state policy.-AxAgentOptions.contextPolicy
corsProxy?stringCORS proxy URL for browser environments. When running in a browser, API calls may be blocked by CORS. Specify a proxy URL to route requests through. Example 'https://cors-anywhere.herokuapp.com/'-AxAgentOptions.corsProxy
customLabels?Record<string, string>Custom labels for OpenTelemetry metrics. These labels are merged with axGlobals.customLabels (service-level options override global settings). Example { environment: 'production', feature: 'search' }-AxAgentOptions.customLabels
customTemplate?string--AxAgentOptions.customTemplate
debug?booleanEnable debug logging for troubleshooting. When true, logs detailed information about prompts, responses, and the generation pipeline. Useful for understanding AI behavior.-AxAgentOptions.debug
debugHideSystemPrompt?booleanHide system prompt in debug output (for cleaner logs).-AxAgentOptions.debugHideSystemPrompt
disableMemoryCleanup?boolean--AxAgentOptions.disableMemoryCleanup
excludeContentFromTrace?booleanExclude message content from OpenTelemetry traces (for privacy).-AxAgentOptions.excludeContentFromTrace
executorModelPolicy?AxExecutorModelPolicyOrdered executor-model overrides keyed by consecutive error turns or namespace matches. Later entries take precedence over earlier ones.-AxAgentOptions.executorModelPolicy
executorOptions?Partial<Omit<AxProgramForwardOptions<string>, "functions"> & object>Forward 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.-AxAgentOptions.executorOptions
fastFail?boolean--AxAgentOptions.fastFail
fetch?{ (input: URL | RequestInfo, init?: RequestInit): Promise<Response>; (input: string | URL | Request, init?: RequestInit): Promise<Response>; }Custom fetch implementation (useful for proxies or custom HTTP handling).-AxAgentOptions.fetch
functionCall?| "auto" | "none" | "required" | { function: { name: string; }; type: "function"; }--AxAgentOptions.functionCall
functionCallMode?"prompt" | "auto" | "native"How to handle function/tool calling. - 'auto' - Let the provider decide the best approach (default) - 'native' - Use the provider’s native function calling API. Fails if the model doesn’t support it. - 'prompt' - Simulate function calling via prompt engineering. Works with any model but may be less reliable. Default 'auto'-AxAgentOptions.functionCallMode
functionDiscovery?booleanEnables runtime callable discovery (modules + on-demand definitions).-AxAgentOptions.functionDiscovery
functionResultFormatter?(result: unknown) => string--AxAgentOptions.functionResultFormatter
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.-AxAgentOptions.functions
includeOptionalInputFieldsInSystemPrompt?boolean--AxAgentOptions.includeOptionalInputFieldsInSystemPrompt
includeRequestBodyInErrors?booleanWhether to include the request body in AxAIServiceError messages. When false, the request body is omitted from thrown errors. Useful when requests may contain sensitive data (API keys, PII) or large base64-encoded content that would bloat error logs. Default true-AxAgentOptions.includeRequestBodyInErrors
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.-AxAgentOptions.inputUpdateCallback
judgeAI?AxAIService<unknown, unknown, string>---
judgeOptions?Partial<Omit<AxJudgeOptions, "ai">>Default options for the built-in judge used by optimize().-AxAgentOptions.judgeOptions
logger?AxLoggerFunctionCustom logger function for debug output.-AxAgentOptions.logger
maxBatchedLlmQueryConcurrency?numberMaximum parallel llmQuery calls in batched mode (default: 8).-AxAgentOptions.maxBatchedLlmQueryConcurrency
maxRetries?number--AxAgentOptions.maxRetries
maxRuntimeChars?numberMaximum characters to keep from runtime output and console/log replay.-AxAgentOptions.maxRuntimeChars
maxSteps?number--AxAgentOptions.maxSteps
maxSubAgentCalls?numberGlobal cap on recursive sub-agent calls across all descendants (default: 100).-AxAgentOptions.maxSubAgentCalls
maxTurns?numberMaximum Actor turns before forcing Responder (default: 10).-AxAgentOptions.maxTurns
mem?AxAIMemory--AxAgentOptions.mem
meter?MeterOpenTelemetry meter for metrics collection.-AxAgentOptions.meter
model?string--AxAgentOptions.model
modelConfig?AxModelConfig--AxAgentOptions.modelConfig
onContextEvent?AxAgentOnContextEventCalled when AxAgent measures context pressure or creates/clears compacted context. Use for observability and evaluation; failures are ignored.-AxAgentOptions.onContextEvent
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).-AxAgentOptions.onFunctionCall
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.-AxAgentOptions.onLoadedMemories
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.-AxAgentOptions.onLoadedSkills
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.-AxAgentOptions.onMemoriesSearch
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.-AxAgentOptions.onSkillsSearch
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.-AxAgentOptions.onUsedMemories
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.-AxAgentOptions.onUsedSkills
promptLevel?"default" | "detailed"Actor prompt verbosity and scaffolding level (default: ‘default’).-AxAgentOptions.promptLevel
promptTemplate?typeof AxPromptTemplate--AxAgentOptions.promptTemplate
rateLimiter?AxRateLimiterFunctionCustom rate limiter function to control request throughput.-AxAgentOptions.rateLimiter
recursionOptions?Partial<Omit<AxProgramForwardOptions<string>, "functions">>Default 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.-AxAgentOptions.recursionOptions
responderOptions?Partial<Omit<AxProgramForwardOptions<string>, "functions"> & object>Forward 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.-AxAgentOptions.responderOptions
resultPicker?AxResultPickerFunction<AxGenOut>--AxAgentOptions.resultPicker
retry?Partial<RetryConfig>Retry configuration for failed requests. Controls automatic retry behavior for transient errors (rate limits, timeouts, server errors).-AxAgentOptions.retry
runtime?AxCodeRuntimeCode runtime for the REPL loop (default: AxJSRuntime).-AxAgentOptions.runtime
sampleCount?number--AxAgentOptions.sampleCount
selfTuning?boolean | AxSelfTuningConfig--AxAgentOptions.selfTuning
sessionId?stringSession identifier for conversation tracking and memory isolation.-AxAgentOptions.sessionId
showThoughts?booleanInclude the model’s thinking/reasoning in the output. When true and thinkingTokenBudget is set, the model’s internal reasoning is included in the response. Useful for debugging and understanding AI behavior. Default false-AxAgentOptions.showThoughts
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.-AxAgentOptions.skills
speech?AxSpeechConfig--AxAgentOptions.speech
stepHooks?AxStepHooks--AxAgentOptions.stepHooks
stepIndex?numberInternal: Current step index for multi-step operations.-AxAgentOptions.stepIndex
stopFunction?string | string[]--AxAgentOptions.stopFunction
stream?booleanEnable streaming responses. When true, the AI returns responses as a stream of chunks, enabling real-time display of generated text.-AxAgentOptions.stream
streamingAsserts?AxStreamingAssertion[]--AxAgentOptions.streamingAsserts
strictMode?boolean--AxAgentOptions.strictMode
structuredOutputMode?"function" | "auto" | "native"--AxAgentOptions.structuredOutputMode
summarizerOptions?Omit<AxProgramForwardOptions<string>, "functions">Default options for the internal checkpoint summarizer.-AxAgentOptions.summarizerOptions
thinkingTokenBudget?"high" | "low" | "minimal" | "medium" | "highest" | "none"Token budget for extended thinking (chain-of-thought reasoning). Extended thinking allows models to “think through” complex problems before responding. Higher budgets allow deeper reasoning but cost more. Approximate token allocations: - 'none' - Disabled (default) - 'minimal' - ~1,000 tokens (~750 words of thinking) - 'low' - ~4,000 tokens - 'medium' - ~10,000 tokens - 'high' - ~20,000 tokens - 'highest' - ~32,000+ tokens (provider maximum) Provider support: - Anthropic Claude: Full support with claude-sonnet-4 and above - OpenAI: Supported with o1/o3 models (uses reasoning_effort) - Google: Supported with Gemini 2.0 Flash Thinking - DeepSeek: Supported with DeepSeek V4 models Example // Enable medium thinking for complex reasoning await gen.forward(ai, values, { thinkingTokenBudget: 'medium' });-AxAgentOptions.thinkingTokenBudget
thoughtFieldName?string--AxAgentOptions.thoughtFieldName
timeout?numberRequest timeout in milliseconds. Default 300000 (5 minutes)-AxAgentOptions.timeout
traceContext?ContextOpenTelemetry trace context for distributed tracing.-AxAgentOptions.traceContext
traceLabel?string--AxAgentOptions.traceLabel
tracer?TracerOpenTelemetry tracer for distributed tracing.-AxAgentOptions.tracer
useExpensiveModel?"yes"Hint to use a more capable (and expensive) model for complex tasks. Some providers offer tiered models. Setting this to ‘yes’ requests the higher-capability tier when available.-AxAgentOptions.useExpensiveModel
verbose?booleanEnable low-level HTTP request/response logging. More verbose than debug. Shows raw HTTP traffic including headers. Useful for debugging API issues.-AxAgentOptions.verbose
webSocket?anyCustom WebSocket constructor for providers that use realtime WebSocket transports.-AxAgentOptions.webSocket
Docs