Skip to content
v2.274.0

Experimental

@aws-cdk/aws-bedrock-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

AgentProps Struct ​

Properties for creating a CDK managed Bedrock Agent.

TODO: Knowledge bases configuration will be added in a future update TODO: Inference profile configuration will be added in a future update

Example ​

ts
const parserFunction = new lambda.Function(this, 'ParserFunction', {
  runtime: lambda.Runtime.PYTHON_3_10,
  handler: 'index.handler',
  code: lambda.Code.fromAsset('lambda'),
});

const agent = new bedrock.Agent(this, 'Agent', {
  foundationModel: bedrock.BedrockFoundationModel.AMAZON_NOVA_LITE_V1,
  instruction: 'You are a helpful assistant.',
  promptOverrideConfiguration: bedrock.PromptOverrideConfiguration.withCustomParser({
    parser: parserFunction,
    preProcessingStep: {
      stepType: bedrock.AgentStepType.PRE_PROCESSING,
      useCustomParser: true
    }
  })
});

Properties ​

actionGroupsoptionalAgentActionGroup[]action_groupsoptionaltyping.List[AgentActionGroup]actionGroupsoptionalList<AgentActionGroup>ActionGroupsoptionalAgentActionGroup[]ActionGroupsoptional*[]AgentActionGroup#
The Action Groups associated with the agent.

Default: Only default action groups (UserInput and CodeInterpreter) are added

agentCollaborationoptionalAgentCollaborationagent_collaborationoptionalAgentCollaborationagentCollaborationoptionalAgentCollaborationAgentCollaborationoptionalAgentCollaborationAgentCollaborationoptionalAgentCollaboration#
Configuration for agent collaboration settings, including AgentCollaboratorType and AgentCollaborators.

Default: No agent collaboration configuration.

This property allows you to define how the agent collaborates with other agents and what collaborators it can work with.

agentNameoptionalstringagent_nameoptionalstragentNameoptionalStringAgentNameoptionalstringAgentNameoptional*string#
The name of the agent.

Default: A name is generated by CDK. Supported pattern : ^([0-9a-zA-Z][_-]?){1,100}$

This will be used as the physical name of the agent.

codeInterpreterEnabledoptionalbooleancode_interpreter_enabledoptionalboolcodeInterpreterEnabledoptionalBooleanCodeInterpreterEnabledoptionalboolCodeInterpreterEnabledoptional*bool= false#
Select whether the agent can generate, run, and troubleshoot code when trying to complete a task.
customOrchestrationExecutoroptionalCustomOrchestrationExecutorcustom_orchestration_executoroptionalCustomOrchestrationExecutorcustomOrchestrationExecutoroptionalCustomOrchestrationExecutorCustomOrchestrationExecutoroptionalCustomOrchestrationExecutorCustomOrchestrationExecutoroptionalCustomOrchestrationExecutor#
The Lambda function to use for custom orchestration.

Default: Default orchestration

If provided, custom orchestration will be used. If not provided, default orchestration will be used.

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#
A description of the agent.

Default: No description is provided.

existingRoleoptionalIRoleexisting_roleoptionalIRoleexistingRoleoptionalIRoleExistingRoleoptionalIRoleExistingRoleoptionalIRole#
An existing IAM Role to associate with this agent.

Default: A new role is created for you.

Use this property when you want to reuse an existing IAM role rather than create a new one. The role must have a trust policy that allows the Bedrock service to assume it.

forceDeleteoptionalbooleanforce_deleteoptionalboolforceDeleteoptionalBooleanForceDeleteoptionalboolForceDeleteoptional*bool= false#
Whether to delete the resource even if it's in use.
foundationModelIBedrockInvokablefoundation_modelIBedrockInvokablefoundationModelIBedrockInvokableFoundationModelIBedrockInvokableFoundationModelIBedrockInvokablerequired#
The foundation model used for orchestration by the agent.
guardrailoptionalIGuardrailguardrailoptionalIGuardrailguardrailoptionalIGuardrailGuardrailoptionalIGuardrailGuardrailoptionalIGuardrail#
The guardrail that will be associated with the agent.

Default: No guardrail is provided.

idleSessionTTLoptionalDurationidle_session_ttloptionalDurationidleSessionTTLoptionalDurationIdleSessionTTLoptionalDurationIdleSessionTTLoptionalDuration#
How long sessions should be kept open for the agent.

Default: 10 minutes

If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout.

instructionstringinstructionstrinstructionStringInstructionstringInstruction*stringrequired#
The instruction used by the agent.

This determines how the agent will perform his task. This instruction must have a minimum of 40 characters.

kmsKeyoptionalIKeykms_keyoptionalIKeykmsKeyoptionalIKeyKmsKeyoptionalIKeyKmsKeyoptionalIKey#
The KMS key of the agent if custom encryption is configured.

Default: An AWS managed key is used.

memoryoptionalMemorymemoryoptionalMemorymemoryoptionalMemoryMemoryoptionalMemoryMemoryoptionalMemory#
The type and configuration of the memory to maintain context across multiple sessions and recall past interactions.

Default: No memory will be used. Agents will retain context from the current session only.

This can be useful for maintaining continuity in multi-turn conversations and recalling user preferences or past interactions.

promptOverrideConfigurationoptionalPromptOverrideConfigurationprompt_override_configurationoptionalPromptOverrideConfigurationpromptOverrideConfigurationoptionalPromptOverrideConfigurationPromptOverrideConfigurationoptionalPromptOverrideConfigurationPromptOverrideConfigurationoptionalPromptOverrideConfiguration#
Overrides some prompt templates in different parts of an agent sequence configuration.

Default: No overrides are provided.

shouldPrepareAgentoptionalbooleanshould_prepare_agentoptionalboolshouldPrepareAgentoptionalBooleanShouldPrepareAgentoptionalboolShouldPrepareAgentoptional*bool= false#
Specifies whether to automatically update the `DRAFT` version of the agent after making changes to the agent.

The DRAFT version can be continually iterated upon during internal development.

userInputEnabledoptionalbooleanuser_input_enabledoptionalbooluserInputEnabledoptionalBooleanUserInputEnabledoptionalboolUserInputEnabledoptional*bool= false#
Select whether the agent can prompt additional information from the user when it does not have enough information to respond to an utterance.