Class CfnAgent
- All Implemented Interfaces:
IEnvironmentAware,IInspectable,ITaggableV2,IAgentRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
- AgentName – Specify a name for the agent.
- AgentResourceRoleArn – Specify the Amazon Resource Name (ARN) of the service role with permissions to invoke API operations on the agent. For more information, see Create a service role for Agents for Amazon Bedrock .
- FoundationModel – Specify the model ID of a foundation model to use when invoking the agent. For more information, see Supported regions and models for Agents for Amazon Bedrock .
For more information about using agents in Amazon Bedrock , see Agents for Amazon Bedrock .
See the Properties section below for descriptions of both the required and optional properties.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.*;
Object additionalModelRequestFields;
CfnAgent cfnAgent = CfnAgent.Builder.create(this, "MyCfnAgent")
.agentName("agentName")
// the properties below are optional
.actionGroups(List.of(AgentActionGroupProperty.builder()
.actionGroupName("actionGroupName")
// the properties below are optional
.actionGroupExecutor(ActionGroupExecutorProperty.builder()
.customControl("customControl")
.lambda("lambda")
.build())
.actionGroupState("actionGroupState")
.apiSchema(APISchemaProperty.builder()
.payload("payload")
.s3(S3IdentifierProperty.builder()
.s3BucketName("s3BucketName")
.s3ObjectKey("s3ObjectKey")
.build())
.build())
.description("description")
.functionSchema(FunctionSchemaProperty.builder()
.functions(List.of(FunctionProperty.builder()
.name("name")
// the properties below are optional
.description("description")
.parameters(Map.of(
"parametersKey", ParameterDetailProperty.builder()
.type("type")
// the properties below are optional
.description("description")
.required(false)
.build()))
.requireConfirmation("requireConfirmation")
.build()))
.build())
.parentActionGroupSignature("parentActionGroupSignature")
.skipResourceInUseCheckOnDelete(false)
.build()))
.agentCollaboration("agentCollaboration")
.agentCollaborators(List.of(AgentCollaboratorProperty.builder()
.agentDescriptor(AgentDescriptorProperty.builder()
.aliasArn("aliasArn")
.build())
.collaborationInstruction("collaborationInstruction")
.collaboratorName("collaboratorName")
// the properties below are optional
.relayConversationHistory("relayConversationHistory")
.build()))
.agentResourceRoleArn("agentResourceRoleArn")
.autoPrepare(false)
.customerEncryptionKeyArn("customerEncryptionKeyArn")
.customOrchestration(CustomOrchestrationProperty.builder()
.executor(OrchestrationExecutorProperty.builder()
.lambda("lambda")
.build())
.build())
.description("description")
.foundationModel("foundationModel")
.guardrailConfiguration(GuardrailConfigurationProperty.builder()
.guardrailIdentifier("guardrailIdentifier")
.guardrailVersion("guardrailVersion")
.build())
.idleSessionTtlInSeconds(123)
.instruction("instruction")
.knowledgeBases(List.of(AgentKnowledgeBaseProperty.builder()
.description("description")
.knowledgeBaseId("knowledgeBaseId")
// the properties below are optional
.knowledgeBaseState("knowledgeBaseState")
.build()))
.memoryConfiguration(MemoryConfigurationProperty.builder()
.enabledMemoryTypes(List.of("enabledMemoryTypes"))
.sessionSummaryConfiguration(SessionSummaryConfigurationProperty.builder()
.maxRecentSessions(123)
.build())
.storageDays(123)
.build())
.orchestrationType("orchestrationType")
.promptOverrideConfiguration(PromptOverrideConfigurationProperty.builder()
.promptConfigurations(List.of(PromptConfigurationProperty.builder()
.additionalModelRequestFields(additionalModelRequestFields)
.basePromptTemplate("basePromptTemplate")
.foundationModel("foundationModel")
.inferenceConfiguration(InferenceConfigurationProperty.builder()
.maximumLength(123)
.stopSequences(List.of("stopSequences"))
.temperature(123)
.topK(123)
.topP(123)
.build())
.parserMode("parserMode")
.promptCreationMode("promptCreationMode")
.promptState("promptState")
.promptType("promptType")
.build()))
// the properties below are optional
.overrideLambda("overrideLambda")
.build())
.skipResourceInUseCheckOnDelete(false)
.tags(Map.of(
"tagsKey", "tags"))
.testAliasTags(Map.of(
"testAliasTagsKey", "testAliasTags"))
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceContains details about the Lambda function containing the business logic that is carried out upon invoking the action or the custom control method for handling the information elicited from the user.static interfaceContains details of the inline agent's action group.static interfaceAn agent collaborator.static interfaceAn agent descriptor.static interfaceContains details about a knowledge base that is associated with an agent.static interfaceContains details about the OpenAPI schema for the action group.static final classA fluent builder forCfnAgent.static interfaceContains details of the custom orchestration configured for the agent.static interfaceDefines parameters that the agent needs to invoke from the user to complete the function.static interfaceContains details about the function schema for the action group or the JSON or YAML-formatted payload defining the schema.static interfaceConfiguration information for a guardrail that you use with the Converse operation.static interfaceBase inference parameters to pass to a model in a call to Converse or ConverseStream .static interfaceDetails of the memory configuration.static interfaceThe structure of the executor invoking the actions in custom orchestration.static interfaceContains details about a parameter in a function for an action group.static interfaceContains configurations to override a prompt template in one part of an agent sequence.static interfaceContains configurations to override prompts in different parts of an agent sequence.static interfaceThe identifier information for an Amazon S3 bucket.static interfaceConfiguration for SESSION_SUMMARY memory type enabled for the agent.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrock.IAgentRef
IAgentRef.Jsii$Default, IAgentRef.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggableV2
ITaggableV2.Jsii$Default, ITaggableV2.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnAgent(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnAgent(software.amazon.jsii.JsiiObjectRef objRef) CfnAgent(software.constructs.Construct scope, String id, CfnAgentProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IAgentReffromAgentArn(software.constructs.Construct scope, String id, String arn) Creates a new IAgentRef from an ARN.static IAgentReffromAgentId(software.constructs.Construct scope, String id, String agentId) Creates a new IAgentRef from a agentId.The action groups that belong to an agent.The agent's collaboration settings.List of Agent Collaborators.The name of the agent.A reference to a Agent resource.The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent.The Amazon Resource Name (ARN) of the agent.The unique identifier of the agent.The status of the agent and whether it is ready for use.The version of the agent.The time at which the agent was created.Contains reasons that the agent-related API that you invoked failed.The time at which the agent was last prepared.Contains recommended actions to take for the agent-related API that you invoked to succeed.The time at which the agent was last updated.Specifies whether to automatically update theDRAFTversion of the agent after making changes to the agent.Tag Manager which manages the tags for this resource.The Amazon Resource Name (ARN) of the AWS KMS key that encrypts the agent.Contains custom orchestration configurations for the agent.The description of the agent.The foundation model used for orchestration by the agent.Details about the guardrail associated with the agent.The number of seconds for which Amazon Bedrock keeps information about a user's conversation with the agent.Instructions that tell the agent what it should do and how it should interact with users.The knowledge bases associated with the agent.Contains memory configuration for the agent.Specifies the orchestration strategy for the agent.Contains configurations to override prompt templates in different parts of an agent sequence.Specifies whether to delete the resource even if it's in use.getTags()Metadata that you can assign to a resource as key-value pairs.Metadata that you can assign to a resource as key-value pairs.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetActionGroups(List<Object> value) The action groups that belong to an agent.voidsetActionGroups(IResolvable value) The action groups that belong to an agent.voidsetAgentCollaboration(String value) The agent's collaboration settings.voidsetAgentCollaborators(List<Object> value) List of Agent Collaborators.voidsetAgentCollaborators(IResolvable value) List of Agent Collaborators.voidsetAgentName(String value) The name of the agent.voidsetAgentResourceRoleArn(String value) The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent.voidsetAutoPrepare(Boolean value) Specifies whether to automatically update theDRAFTversion of the agent after making changes to the agent.voidsetAutoPrepare(IResolvable value) Specifies whether to automatically update theDRAFTversion of the agent after making changes to the agent.voidThe Amazon Resource Name (ARN) of the AWS KMS key that encrypts the agent.voidContains custom orchestration configurations for the agent.voidContains custom orchestration configurations for the agent.voidsetDescription(String value) The description of the agent.voidsetFoundationModel(String value) The foundation model used for orchestration by the agent.voidDetails about the guardrail associated with the agent.voidDetails about the guardrail associated with the agent.voidsetIdleSessionTtlInSeconds(Number value) The number of seconds for which Amazon Bedrock keeps information about a user's conversation with the agent.voidsetInstruction(String value) Instructions that tell the agent what it should do and how it should interact with users.voidsetKnowledgeBases(List<Object> value) The knowledge bases associated with the agent.voidsetKnowledgeBases(IResolvable value) The knowledge bases associated with the agent.voidContains memory configuration for the agent.voidContains memory configuration for the agent.voidsetOrchestrationType(String value) Specifies the orchestration strategy for the agent.voidContains configurations to override prompt templates in different parts of an agent sequence.voidContains configurations to override prompt templates in different parts of an agent sequence.voidSpecifies whether to delete the resource even if it's in use.voidSpecifies whether to delete the resource even if it's in use.voidMetadata that you can assign to a resource as key-value pairs.voidsetTestAliasTags(Map<String, String> value) Metadata that you can assign to a resource as key-value pairs.voidsetTestAliasTags(IResolvable value) Metadata that you can assign to a resource as key-value pairs.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnAgent
protected CfnAgent(software.amazon.jsii.JsiiObjectRef objRef) -
CfnAgent
protected CfnAgent(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnAgent
@Stability(Stable) public CfnAgent(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnAgentProps props) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties. This parameter is required.
-
-
Method Details
-
fromAgentArn
@Stability(Stable) @NotNull public static IAgentRef fromAgentArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String arn) Creates a new IAgentRef from an ARN.- Parameters:
scope- This parameter is required.id- This parameter is required.arn- This parameter is required.
-
fromAgentId
@Stability(Stable) @NotNull public static IAgentRef fromAgentId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String agentId) Creates a new IAgentRef from a agentId.- Parameters:
scope- This parameter is required.id- This parameter is required.agentId- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAgentRef
A reference to a Agent resource.- Specified by:
getAgentRefin interfaceIAgentRef
-
getAttrAgentArn
The Amazon Resource Name (ARN) of the agent. -
getAttrAgentId
The unique identifier of the agent. -
getAttrAgentStatus
The status of the agent and whether it is ready for use. The following statuses are possible:.- CREATING – The agent is being created.
- PREPARING – The agent is being prepared.
- PREPARED – The agent is prepared and ready to be invoked.
- NOT_PREPARED – The agent has been created but not yet prepared.
- FAILED – The agent API operation failed.
- UPDATING – The agent is being updated.
- DELETING – The agent is being deleted.
-
getAttrAgentVersion
The version of the agent. -
getAttrCreatedAt
The time at which the agent was created. -
getAttrFailureReasons
Contains reasons that the agent-related API that you invoked failed. -
getAttrPreparedAt
The time at which the agent was last prepared. -
getAttrRecommendedActions
Contains recommended actions to take for the agent-related API that you invoked to succeed. -
getAttrUpdatedAt
The time at which the agent was last updated. -
getCdkTagManager
Tag Manager which manages the tags for this resource.- Specified by:
getCdkTagManagerin interfaceITaggableV2
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getAgentName
The name of the agent. -
setAgentName
The name of the agent. -
getActionGroups
The action groups that belong to an agent.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnAgent.AgentActionGroupProperty> -
setActionGroups
The action groups that belong to an agent. -
setActionGroups
The action groups that belong to an agent. -
getAgentCollaboration
The agent's collaboration settings. -
setAgentCollaboration
The agent's collaboration settings. -
getAgentCollaborators
List of Agent Collaborators.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnAgent.AgentCollaboratorProperty> -
setAgentCollaborators
List of Agent Collaborators. -
setAgentCollaborators
List of Agent Collaborators. -
getAgentResourceRoleArn
The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent. -
setAgentResourceRoleArn
The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent. -
getAutoPrepare
Specifies whether to automatically update theDRAFTversion of the agent after making changes to the agent.Returns union: either
BooleanorIResolvable -
setAutoPrepare
Specifies whether to automatically update theDRAFTversion of the agent after making changes to the agent. -
setAutoPrepare
Specifies whether to automatically update theDRAFTversion of the agent after making changes to the agent. -
getCustomerEncryptionKeyArn
The Amazon Resource Name (ARN) of the AWS KMS key that encrypts the agent. -
setCustomerEncryptionKeyArn
The Amazon Resource Name (ARN) of the AWS KMS key that encrypts the agent. -
getCustomOrchestration
Contains custom orchestration configurations for the agent.Returns union: either
IResolvableorCfnAgent.CustomOrchestrationProperty -
setCustomOrchestration
Contains custom orchestration configurations for the agent. -
setCustomOrchestration
@Stability(Stable) public void setCustomOrchestration(@Nullable CfnAgent.CustomOrchestrationProperty value) Contains custom orchestration configurations for the agent. -
getDescription
The description of the agent. -
setDescription
The description of the agent. -
getFoundationModel
The foundation model used for orchestration by the agent. -
setFoundationModel
The foundation model used for orchestration by the agent. -
getGuardrailConfiguration
Details about the guardrail associated with the agent.Returns union: either
IResolvableorCfnAgent.GuardrailConfigurationProperty -
setGuardrailConfiguration
Details about the guardrail associated with the agent. -
setGuardrailConfiguration
@Stability(Stable) public void setGuardrailConfiguration(@Nullable CfnAgent.GuardrailConfigurationProperty value) Details about the guardrail associated with the agent. -
getIdleSessionTtlInSeconds
The number of seconds for which Amazon Bedrock keeps information about a user's conversation with the agent. -
setIdleSessionTtlInSeconds
The number of seconds for which Amazon Bedrock keeps information about a user's conversation with the agent. -
getInstruction
Instructions that tell the agent what it should do and how it should interact with users. -
setInstruction
Instructions that tell the agent what it should do and how it should interact with users. -
getKnowledgeBases
The knowledge bases associated with the agent.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnAgent.AgentKnowledgeBaseProperty> -
setKnowledgeBases
The knowledge bases associated with the agent. -
setKnowledgeBases
The knowledge bases associated with the agent. -
getMemoryConfiguration
Contains memory configuration for the agent.Returns union: either
IResolvableorCfnAgent.MemoryConfigurationProperty -
setMemoryConfiguration
Contains memory configuration for the agent. -
setMemoryConfiguration
@Stability(Stable) public void setMemoryConfiguration(@Nullable CfnAgent.MemoryConfigurationProperty value) Contains memory configuration for the agent. -
getOrchestrationType
Specifies the orchestration strategy for the agent. -
setOrchestrationType
Specifies the orchestration strategy for the agent. -
getPromptOverrideConfiguration
Contains configurations to override prompt templates in different parts of an agent sequence.Returns union: either
IResolvableorCfnAgent.PromptOverrideConfigurationProperty -
setPromptOverrideConfiguration
Contains configurations to override prompt templates in different parts of an agent sequence. -
setPromptOverrideConfiguration
@Stability(Stable) public void setPromptOverrideConfiguration(@Nullable CfnAgent.PromptOverrideConfigurationProperty value) Contains configurations to override prompt templates in different parts of an agent sequence. -
getSkipResourceInUseCheckOnDelete
Specifies whether to delete the resource even if it's in use.Returns union: either
BooleanorIResolvable -
setSkipResourceInUseCheckOnDelete
Specifies whether to delete the resource even if it's in use. -
setSkipResourceInUseCheckOnDelete
Specifies whether to delete the resource even if it's in use. -
getTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
-
setTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
-
getTestAliasTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
Returns union: either Mapinvalid input: '<'String,
String> orIResolvable -
setTestAliasTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
-
setTestAliasTags
Metadata that you can assign to a resource as key-value pairs.For more information, see the following resources:.
-