Skip to content

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;
plugins?: Plugin[];
retryStrategy?: | RetryStrategy
| RetryStrategy[]
| null;
structuredOutputSchema?: z.ZodSchema;
sessionManager?: SessionManager;
traceAttributes?: Record<string, AttributeValue>;
name?: string;
description?: string;
id?: string;
toolExecutor?: ToolExecutorStrategy;
};

Defined in: src/agent/agent.ts:115

Configuration object for creating a new Agent.

optional model?:
| Model<BaseModelConfig>
| string;

Defined in: src/agent/agent.ts:138

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.

// Using a string model ID (creates BedrockModel)
const agent = new Agent({
model: 'anthropic.claude-3-5-sonnet-20240620-v1:0'
})
// Using an explicit BedrockModel instance with configuration
const agent = new Agent({
model: new BedrockModel({
modelId: 'anthropic.claude-3-5-sonnet-20240620-v1:0',
temperature: 0.7,
maxTokens: 2048
})
})

optional messages?:
| Message[]
| MessageData[];

Defined in: src/agent/agent.ts:140

An initial set of messages to seed the agent’s conversation history.


optional tools?: ToolList;

Defined in: src/agent/agent.ts:146

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.


optional systemPrompt?:
| SystemPrompt
| SystemPromptData;

Defined in: src/agent/agent.ts:150

A system prompt which guides model behavior.


optional appState?: Record<string, JSONValue>;

Defined in: src/agent/agent.ts:152

Optional initial state values for the agent.


optional modelState?: Record<string, JSONValue>;

Defined in: src/agent/agent.ts:157

Optional initial model-provider state (e.g., restoring responseId from a prior session). Typically only set when hydrating from a snapshot.


optional printer?: boolean;

Defined in: src/agent/agent.ts:163

Enable automatic printing of agent output to console. When true, prints text generation, reasoning, and tool usage as they occur. Defaults to true.


optional conversationManager?: ConversationManager;

Defined in: src/agent/agent.ts:168

Conversation manager for handling message history and context overflow. Defaults to SlidingWindowConversationManager with windowSize of 40.


optional plugins?: Plugin[];

Defined in: src/agent/agent.ts:172

Plugins to register with the agent.


optional retryStrategy?:
| RetryStrategy
| RetryStrategy[]
| null;

Defined in: src/agent/agent.ts:183

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.name when the plugin registry initializes.
  • null or []: retries are explicitly disabled; failures propagate to the caller.

optional structuredOutputSchema?: z.ZodSchema;

Defined in: src/agent/agent.ts:187

Zod schema for structured output validation.


optional sessionManager?: SessionManager;

Defined in: src/agent/agent.ts:191

Session manager for saving and restoring agent sessions


optional traceAttributes?: Record<string, AttributeValue>;

Defined in: src/agent/agent.ts:197

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:201

Optional name for the agent. Defaults to “Strands Agent”.


optional description?: string;

Defined in: src/agent/agent.ts:205

Optional description of what the agent does.


optional id?: string;

Defined in: src/agent/agent.ts:209

Optional unique identifier for the agent. Defaults to “agent”.


optional toolExecutor?: ToolExecutorStrategy;

Defined in: src/agent/agent.ts:214

Strategy for executing tool calls from a single assistant turn. Defaults to 'concurrent'. See ToolExecutorStrategy for details.