This construct provides a high-level abstraction for creating Amazon Bedrock Agents with associated resources.
import { BedrockAgentL3Construct } from '@aws-mdaa/bedrock-agent-l3-construct';
const agent = new BedrockAgentL3Construct(this, 'MyAgent', {
agentName: 'my-agent',
agentConfig: {
role: agentExecutionRole,
foundationModel: 'anthropic.claude-3-sonnet-20240229-v1:0',
instruction: 'You are a helpful assistant',
description: 'My custom agent',
actionGroups: [
{
actionGroupName: 'my-actions',
actionGroupExecutor: {
lambda: 'arn:aws:lambda:region:account:function:my-function'
},
description: 'Custom action group'
}
]
},
kmsKey: myKmsKey,
roleHelper: roleHelper,
naming: naming
});
foundationModel: The foundation model to use (required)instruction: Instructions for the agent (required)role: Execution role for the agent (required)description: Optional descriptionautoPrepare: Whether to auto-prepare the agentidleSessionTtlInSeconds: Session timeoutagentAliasName: Optional alias nameactionGroupName: Name of the action groupactionGroupExecutor: Lambda function configurationapiSchema: OpenAPI schema for the actionsdescription: Optional descriptionknowledgeBases: Array of knowledge base associationsguardrail: Guardrail configuration with ID and versionThe construct automatically creates IAM policies with permissions for:
@aws-mdaa/iam-constructs@aws-mdaa/iam-role-helper@aws-mdaa/kms-constructs@aws-mdaa/l3-constructaws-cdk-libconstructs