Experimental
@aws-cdk/aws-bedrock-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
AgentActionGroupProps Struct
**************************************************************************** PROPS - Action Group Class ***************************************************************************.
| Stability | Experimental |
|---|---|
| Source | bedrock/agents/action-group.ts |
Example
const bucket = s3.Bucket.fromBucketName(this, 'ExistingBucket', 'my-schema-bucket');
const s3Schema = bedrock.ApiSchema.fromS3File(bucket, 'schemas/action-group.yaml');
const actionGroupFunction = new lambda.Function(this, 'ActionGroupFunction', {
runtime: lambda.Runtime.PYTHON_3_12,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, '../lambda/action-group')),
});
const actionGroup = new bedrock.AgentActionGroup({
name: 'query-library',
description: 'Use these functions to get information about the books in the library.',
executor: bedrock.ActionGroupExecutor.fromLambda(actionGroupFunction),
enabled: true,
apiSchema: s3Schema,
});
const agent = new bedrock.Agent(this, 'Agent', {
foundationModel: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_HAIKU_V1_0,
instruction: 'You are a helpful and friendly agent that answers questions about literature.',
});
agent.addActionGroup(actionGroup);
bucket = s3.Bucket.from_bucket_name(self, "ExistingBucket", "my-schema-bucket")
s3_schema = bedrock.ApiSchema.from_s3_file(bucket, "schemas/action-group.yaml")
action_group_function = lambda_.Function(self, "ActionGroupFunction",
runtime=lambda_.Runtime.PYTHON_3_12,
handler="index.handler",
code=lambda_.Code.from_asset(path.join(__dirname, "../lambda/action-group"))
)
action_group = bedrock.AgentActionGroup(
name="query-library",
description="Use these functions to get information about the books in the library.",
executor=bedrock.ActionGroupExecutor.from_lambda(action_group_function),
enabled=True,
api_schema=s3_schema
)
agent = bedrock.Agent(self, "Agent",
foundation_model=bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_HAIKU_V1_0,
instruction="You are a helpful and friendly agent that answers questions about literature."
)
agent.add_action_group(action_group)
IBucket bucket = Bucket.fromBucketName(this, "ExistingBucket", "my-schema-bucket");
S3ApiSchema s3Schema = ApiSchema.fromS3File(bucket, "schemas/action-group.yaml");
Function actionGroupFunction = Function.Builder.create(this, "ActionGroupFunction")
.runtime(Runtime.PYTHON_3_12)
.handler("index.handler")
.code(Code.fromAsset(join(__dirname, "../lambda/action-group")))
.build();
AgentActionGroup actionGroup = AgentActionGroup.Builder.create()
.name("query-library")
.description("Use these functions to get information about the books in the library.")
.executor(ActionGroupExecutor.fromLambda(actionGroupFunction))
.enabled(true)
.apiSchema(s3Schema)
.build();
Agent agent = Agent.Builder.create(this, "Agent")
.foundationModel(BedrockFoundationModel.ANTHROPIC_CLAUDE_HAIKU_V1_0)
.instruction("You are a helpful and friendly agent that answers questions about literature.")
.build();
agent.addActionGroup(actionGroup);
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Alpha
var bucket = Bucket.FromBucketName(this, "ExistingBucket", "my-schema-bucket");
var s3Schema = ApiSchema.FromS3File(bucket, "schemas/action-group.yaml");
var actionGroupFunction = new Function(this, "ActionGroupFunction", new FunctionProps {
Runtime = Runtime.PYTHON_3_12,
Handler = "index.handler",
Code = Code.FromAsset(Join(__dirname, "../lambda/action-group"))
});
var actionGroup = new AgentActionGroup(new AgentActionGroupProps {
Name = "query-library",
Description = "Use these functions to get information about the books in the library.",
Executor = ActionGroupExecutor.FromLambda(actionGroupFunction),
Enabled = true,
ApiSchema = s3Schema
});
var agent = new Agent(this, "Agent", new AgentProps {
FoundationModel = BedrockFoundationModel.ANTHROPIC_CLAUDE_HAIKU_V1_0,
Instruction = "You are a helpful and friendly agent that answers questions about literature."
});
agent.AddActionGroup(actionGroup);
// Install: go get github.com/aws/aws-cdk-go/awsbedrockalpha/v2
bucket := s3.Bucket_FromBucketName(this, jsii.String("ExistingBucket"), jsii.String("my-schema-bucket"))
s3Schema := bedrock.ApiSchema_FromS3File(bucket, jsii.String("schemas/action-group.yaml"))
actionGroupFunction := lambda.NewFunction(this, jsii.String("ActionGroupFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_12(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("../lambda/action-group"))),
})
actionGroup := bedrock.NewAgentActionGroup(&AgentActionGroupProps{
Name: jsii.String("query-library"),
Description: jsii.String("Use these functions to get information about the books in the library."),
Executor: bedrock.ActionGroupExecutor_FromLambda(actionGroupFunction),
Enabled: jsii.Boolean(true),
ApiSchema: s3Schema,
})
agent := bedrock.NewAgent(this, jsii.String("Agent"), &AgentProps{
FoundationModel: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_HAIKU_V1_0(),
Instruction: jsii.String("You are a helpful and friendly agent that answers questions about literature."),
})
agent.AddActionGroup(actionGroup)
Properties
apiSchemaoptionalApiSchemaapi_schemaoptionalApiSchemaapiSchemaoptionalApiSchemaApiSchemaoptionalApiSchemaApiSchemaoptionalApiSchema #Default: undefined - No API Schema is provided
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #Default: undefined - No description is provided
enabledoptionalbooleanenabledoptionalboolenabledoptionalBooleanEnabledoptionalboolEnabledoptional*bool #Default: true - The action group is enabled
executoroptionalActionGroupExecutorexecutoroptionalActionGroupExecutorexecutoroptionalActionGroupExecutorExecutoroptionalActionGroupExecutorExecutoroptionalActionGroupExecutor #Default: undefined - No executor is provided
forceDeleteoptionalbooleanforce_deleteoptionalboolforceDeleteoptionalBooleanForceDeleteoptionalboolForceDeleteoptional*bool #Default: false - The resource will not be deleted if it's in use
functionSchemaoptionalFunctionSchemafunction_schemaoptionalFunctionSchemafunctionSchemaoptionalFunctionSchemaFunctionSchemaoptionalFunctionSchemaFunctionSchemaoptionalFunctionSchema #Default: undefined - No function schema is provided
NO L2 yet as this doesn't make much sense IMHO.
Default: A unique name is generated in the format 'action_group_quick_start_UUID'
parentActionGroupSignatureoptionalParentActionGroupSignatureparent_action_group_signatureoptionalParentActionGroupSignatureparentActionGroupSignatureoptionalParentActionGroupSignatureParentActionGroupSignatureoptionalParentActionGroupSignatureParentActionGroupSignatureoptionalParentActionGroupSignature #Default: undefined - No parent action group signature is provided
When this property is specified, you must leave the description, apiSchema, and actionGroupExecutor fields blank for this action group.