Skip to content

AgentOptions

Defined in: agent/agent.ts:71

Configuration options for the Agent.

optional baseDepth: number

Defined in: agent/agent.ts:178

Base depth for nodes created by this agent. Root agents use 0; subagents use (parentDepth + 1).


client: LLMist

Defined in: agent/agent.ts:73

The LLM client


optional compactionConfig: CompactionConfig

Defined in: agent/agent.ts:143

Context compaction configuration (enabled by default)


optional defaultGadgetTimeoutMs: number

Defined in: agent/agent.ts:131

Default gadget timeout


optional gadgetArgPrefix: string

Defined in: agent/agent.ts:109

Custom gadget argument prefix for block format parameters


optional gadgetEndPrefix: string

Defined in: agent/agent.ts:106

Custom gadget end prefix


optional gadgetOutputLimit: boolean

Defined in: agent/agent.ts:137

Enable gadget output limiting (default: true)


optional gadgetOutputLimitPercent: number

Defined in: agent/agent.ts:140

Max gadget output as % of model context window (default: 15)


optional gadgetStartPrefix: string

Defined in: agent/agent.ts:103

Custom gadget start prefix


optional hooks: AgentHooks

Defined in: agent/agent.ts:97

Clean hooks system


optional initialMessages: object[]

Defined in: agent/agent.ts:112

Initial messages. User messages support multimodal content.

content: MessageContent

role: "system" | "user" | "assistant"


optional logger: Logger<ILogObj>

Defined in: agent/agent.ts:94

Logger


optional maxIterations: number

Defined in: agent/agent.ts:85

Maximum iterations


model: string

Defined in: agent/agent.ts:76

The model ID


optional onSubagentEvent: (event) => void

Defined in: agent/agent.ts:155

Callback for subagent gadgets to report subagent events to parent

SubagentEvent

void


optional parentNodeId: string

Defined in: agent/agent.ts:172

Parent node ID in the tree (when this agent is a subagent). Used to set parentId on all nodes created by this agent.


optional parentTree: ExecutionTree

Defined in: agent/agent.ts:166

Shared execution tree for tracking all LLM calls and gadget executions. If provided (by a parent subagent), nodes are added to this tree. If not provided, the Agent creates its own tree.


optional promptConfig: PromptTemplateConfig

Defined in: agent/agent.ts:134

Custom prompt configuration for gadget system prompts


registry: GadgetRegistry

Defined in: agent/agent.ts:91

Gadget registry


optional requestHumanInput: (question) => Promise<string>

Defined in: agent/agent.ts:100

Callback for requesting human input during execution

string

Promise<string>


optional retryConfig: RetryConfig

Defined in: agent/agent.ts:146

Retry configuration for LLM API calls (enabled by default)


optional signal: AbortSignal

Defined in: agent/agent.ts:149

Optional abort signal for cancelling requests mid-flight


optional subagentConfig: SubagentConfigMap

Defined in: agent/agent.ts:152

Subagent-specific configuration overrides (from CLI config)


optional systemPrompt: string

Defined in: agent/agent.ts:79

System prompt


optional temperature: number

Defined in: agent/agent.ts:88

Temperature


optional textOnlyHandler: TextOnlyHandler

Defined in: agent/agent.ts:115

Text-only handler


optional textWithGadgetsHandler: object

Defined in: agent/agent.ts:121

Handler for text content that appears alongside gadget calls. When set, text accompanying gadgets will be wrapped as a synthetic gadget call.

gadgetName: string

Name of the gadget to use for wrapping text

parameterMapping: (text) => Record<string, unknown>

Maps text content to gadget parameters

string

Record<string, unknown>

optional resultMapping: (text) => string

Maps text content to the result string (optional, defaults to text)

string

string


optional userPrompt: string | ContentPart[]

Defined in: agent/agent.ts:82

Initial user prompt (optional if using build()). Can be text or multimodal content.