AgentConfig
type AgentConfig = { model?: | Model<BaseModelConfig> | string; messages?: | Message[] | MessageData[]; tools?: ToolList; systemPrompt?: | SystemPrompt | SystemPromptData; state?: Record<string, JSONValue>; printer?: boolean; conversationManager?: HookProvider; hooks?: HookProvider[]; structuredOutputSchema?: z.ZodSchema; traceAttributes?: Record<string, AttributeValue>; name?: string; agentId?: string;};Defined in: src/agent/agent.ts:67
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:90
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: 'anthropic.claude-3-5-sonnet-20240620-v1:0'})
// Using an explicit BedrockModel instance with configurationconst agent = new Agent({ model: new BedrockModel({ modelId: 'anthropic.claude-3-5-sonnet-20240620-v1:0', temperature: 0.7, maxTokens: 2048 })})messages?
Section titled “messages?”optional messages: | Message[] | MessageData[];Defined in: src/agent/agent.ts:92
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:97
An initial set of tools to register with the agent. Accepts nested arrays of tools at any depth, which will be flattened automatically.
systemPrompt?
Section titled “systemPrompt?”optional systemPrompt: | SystemPrompt | SystemPromptData;Defined in: src/agent/agent.ts:101
A system prompt which guides model behavior.
state?
Section titled “state?”optional state: Record<string, JSONValue>;Defined in: src/agent/agent.ts:103
Optional initial state values for the agent.
printer?
Section titled “printer?”optional printer: boolean;Defined in: src/agent/agent.ts:109
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: HookProvider;Defined in: src/agent/agent.ts:114
Conversation manager for handling message history and context overflow. Defaults to SlidingWindowConversationManager with windowSize of 40.
hooks?
Section titled “hooks?”optional hooks: HookProvider[];Defined in: src/agent/agent.ts:119
Hook providers to register with the agent. Hooks enable observing and extending agent behavior.
structuredOutputSchema?
Section titled “structuredOutputSchema?”optional structuredOutputSchema: z.ZodSchema;Defined in: src/agent/agent.ts:123
Zod schema for structured output validation.
traceAttributes?
Section titled “traceAttributes?”optional traceAttributes: Record<string, AttributeValue>;Defined in: src/agent/agent.ts:129
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:133
Optional name for the agent. Defaults to “Strands Agent”.
agentId?
Section titled “agentId?”optional agentId: string;Defined in: src/agent/agent.ts:137
Optional unique identifier for the agent. Defaults to “default”.