AgentConfig
type AgentConfig = { model?: | Model<BaseModelConfig> | string; messages?: | Message[] | MessageData[]; tools?: ToolList; systemPrompt?: | SystemPrompt | SystemPromptData; appState?: Record<string, JSONValue>; modelState?: Record<string, JSONValue>; printer?: boolean; conversationManager?: ConversationManager; contextManager?: ContextManagerStrategy; plugins?: Plugin[]; retryStrategy?: | RetryStrategy | RetryStrategy[] | null; interventions?: InterventionHandler[]; structuredOutputSchema?: z.ZodSchema; sessionManager?: SessionManager; memoryManager?: | MemoryManager | MemoryManagerConfig; traceAttributes?: Record<string, AttributeValue>; name?: string; description?: string; id?: string; toolExecutor?: ToolExecutorStrategy; sandbox?: Sandbox | false;};Defined in: src/agent/agent.ts:163
Configuration object for creating a new Agent.
Properties
Section titled “Properties”model?
Section titled “model?”optional model?: | Model<BaseModelConfig> | string;Defined in: src/agent/agent.ts:186
The model instance that the agent will use to make decisions. Accepts either a Model instance or a string representing a Bedrock model ID. When a string is provided, it will be used to create a BedrockModel instance.
Example
Section titled “Example”// Using a string model ID (creates BedrockModel)const agent = new Agent({ model: 'global.anthropic.claude-sonnet-4-6'})
// Using an explicit BedrockModel instance with configurationconst agent = new Agent({ model: new BedrockModel({ modelId: 'global.anthropic.claude-sonnet-4-6', temperature: 0.7, maxTokens: 2048 })})messages?
Section titled “messages?”optional messages?: | Message[] | MessageData[];Defined in: src/agent/agent.ts:188
An initial set of messages to seed the agent’s conversation history.
tools?
Section titled “tools?”optional tools?: ToolList;Defined in: src/agent/agent.ts:194
An initial set of tools to register with the agent. Accepts nested arrays of tools at any depth, which will be flattened automatically. Agent instances are automatically wrapped as tools via Agent.asTool.
systemPrompt?
Section titled “systemPrompt?”optional systemPrompt?: | SystemPrompt | SystemPromptData;Defined in: src/agent/agent.ts:198
A system prompt which guides model behavior.
appState?
Section titled “appState?”optional appState?: Record<string, JSONValue>;Defined in: src/agent/agent.ts:200
Optional initial state values for the agent.
modelState?
Section titled “modelState?”optional modelState?: Record<string, JSONValue>;Defined in: src/agent/agent.ts:205
Optional initial model-provider state (e.g., restoring responseId from a
prior session). Typically only set when hydrating from a snapshot.
printer?
Section titled “printer?”optional printer?: boolean;Defined in: src/agent/agent.ts:211
Enable automatic printing of agent output to console. When true, prints text generation, reasoning, and tool usage as they occur. Defaults to true.
conversationManager?
Section titled “conversationManager?”optional conversationManager?: ConversationManager;Defined in: src/agent/agent.ts:216
Conversation manager for handling message history and context overflow. Defaults to SlidingWindowConversationManager with windowSize of 40.
contextManager?
Section titled “contextManager?”optional contextManager?: ContextManagerStrategy;Defined in: src/agent/agent.ts:228
Context management strategy. When set to "auto", composes a ContextOffloader
plugin (maxResultTokens=1500, previewTokens=750) with a SummarizingConversationManager
(summaryRatio=0.3, compressionThreshold=0.85) using benchmark-validated defaults.
If conversationManager is also provided, the user’s conversation manager is used instead.
Defaults to undefined (no context management).
Remarks
Section titled “Remarks”The offloader uses in-memory storage that does not persist across process
restarts. For agents using sessionManager, provide an explicit ContextOffloader
with durable storage via the plugins parameter.
plugins?
Section titled “plugins?”optional plugins?: Plugin[];Defined in: src/agent/agent.ts:232
Plugins to register with the agent.
retryStrategy?
Section titled “retryStrategy?”optional retryStrategy?: | RetryStrategy | RetryStrategy[] | null;Defined in: src/agent/agent.ts:243
Retry strategy (or strategies) for failed model/tool calls.
- Omitted: a sensible default DefaultModelRetryStrategy with exponential backoff is used.
- Single strategy: the given strategy is used.
- Array of strategies: all are registered, in the given order. Passing two
instances of the same concrete class logs a warning — they will collide
on
plugin.namewhen the plugin registry initializes. nullor[]: retries are explicitly disabled; failures propagate to the caller.
interventions?
Section titled “interventions?”optional interventions?: InterventionHandler[];Defined in: src/agent/agent.ts:247
Intervention handlers evaluated in registration order at each lifecycle point.
structuredOutputSchema?
Section titled “structuredOutputSchema?”optional structuredOutputSchema?: z.ZodSchema;Defined in: src/agent/agent.ts:251
Zod schema for structured output validation.
sessionManager?
Section titled “sessionManager?”optional sessionManager?: SessionManager;Defined in: src/agent/agent.ts:255
Session manager for saving and restoring agent sessions
memoryManager?
Section titled “memoryManager?”optional memoryManager?: | MemoryManager | MemoryManagerConfig;Defined in: src/agent/agent.ts:261
Memory manager for cross-session memory retrieval and storage. Manages one or more memory stores and exposes search/add tools. Accepts a MemoryManager instance or a MemoryManagerConfig object (auto-wrapped).
traceAttributes?
Section titled “traceAttributes?”optional traceAttributes?: Record<string, AttributeValue>;Defined in: src/agent/agent.ts:267
Custom trace attributes to include in all spans. These attributes are merged with standard attributes in telemetry spans. Telemetry must be enabled globally via telemetry.setupTracer() for these to take effect.
optional name?: string;Defined in: src/agent/agent.ts:271
Optional name for the agent. Defaults to “Strands Agent”.
description?
Section titled “description?”optional description?: string;Defined in: src/agent/agent.ts:275
Optional description of what the agent does.
optional id?: string;Defined in: src/agent/agent.ts:279
Optional unique identifier for the agent. Defaults to “agent”.
toolExecutor?
Section titled “toolExecutor?”optional toolExecutor?: ToolExecutorStrategy;Defined in: src/agent/agent.ts:284
Strategy for executing tool calls from a single assistant turn.
Defaults to 'concurrent'. See ToolExecutorStrategy for details.
sandbox?
Section titled “sandbox?”optional sandbox?: Sandbox | false;Defined in: src/agent/agent.ts:298
Execution environment for running commands, code, and file operations. When provided, sandbox-aware tools route operations through it.
Two distinct intents, even though they resolve to the same host execution in Node today:
- Omitted: use the environment’s default sandbox (host execution in Node). This default is the slot reserved for richer behavior later.
false: explicitly opt out of a managed sandbox and run on the host.
Keep false distinct from omitting so the opt-out stays stable even if the
default changes.