Class Agent
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.bedrock.alpha.AgentBase
software.amazon.awscdk.services.bedrock.alpha.Agent
- All Implemented Interfaces:
IEnvironmentAware,IResource,IAgent,IGrantable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-05T22:26:49.415Z")
@Stability(Experimental)
public class Agent
extends AgentBase
implements IAgent
(experimental) Class to create (or import) an Agent with CDK.
Example:
Function parserFunction = Function.Builder.create(this, "ParserFunction")
.runtime(Runtime.PYTHON_3_10)
.handler("index.handler")
.code(Code.fromAsset("lambda"))
.build();
Agent agent = Agent.Builder.create(this, "Agent")
.foundationModel(BedrockFoundationModel.AMAZON_NOVA_LITE_V1)
.instruction("You are a helpful assistant.")
.promptOverrideConfiguration(PromptOverrideConfiguration.withCustomParser(CustomParserProps.builder()
.parser(parserFunction)
.preProcessingStep(PromptPreProcessingConfigCustomParser.builder()
.stepType(AgentStepType.PRE_PROCESSING)
.useCustomParser(true)
.build())
.build()))
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrock.alpha.IAgent
IAgent.Jsii$Default, IAgent.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String(experimental) Uniquely identifies this class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAgent(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedAgent(software.amazon.jsii.JsiiObjectRef objRef) Agent(software.constructs.Construct scope, String id, AgentProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActionGroup(AgentActionGroup actionGroup) (experimental) Adds an action group to the agent and configures necessary permissions.voidaddActionGroups(AgentActionGroup... actionGroups) (experimental) Configuration for agent collaboration.voidaddGuardrail(IGuardrail guardrail) (experimental) Add guardrail to the agent.static IAgentfromAgentAttributes(software.constructs.Construct scope, String id, AgentAttributes attrs) (experimental) Creates an Agent reference from an existing agent's attributes.protected String(experimental) Generates a physical name for the agent.(experimental) action groups associated with the ageny.(experimental) The ARN of the agent.(experimental) The unique identifier for the agent.(experimental) The version of the agent.(experimental) The principal to grant permissions to.(experimental) The guardrail that will be associated with the agent.(experimental) Optional KMS encryption key associated with this agent.(experimental) When this agent was last updated.getName()(experimental) The name of the agent.getRole()(experimental) The IAM role associated to the agent.(experimental) Default alias of the agent.voidsetGuardrail(IGuardrail value) (experimental) The guardrail that will be associated with the agent.Methods inherited from class software.amazon.awscdk.services.bedrock.alpha.AgentBase
grantInvoke, metricCount, metricCount, onEvent, onEventMethods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods 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.amazon.awscdk.services.bedrock.alpha.IAgent
grantInvoke, metricCount, metricCount, onEvent, onEventMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
(experimental) Uniquely identifies this class.
-
-
Constructor Details
-
Agent
protected Agent(software.amazon.jsii.JsiiObjectRef objRef) -
Agent
protected Agent(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Agent
@Stability(Experimental) public Agent(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull AgentProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromAgentAttributes
@Stability(Experimental) @NotNull public static IAgent fromAgentAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull AgentAttributes attrs) (experimental) Creates an Agent reference from an existing agent's attributes.Default: - For attrs.agentVersion: 'DRAFT' if no explicit version is provided
- Parameters:
scope-- The construct scope.
id-- Identifier of the construct.
attrs-- Attributes of the existing agent.
- Returns:
- An IAgent reference to the existing agent
-
addActionGroup
(experimental) Adds an action group to the agent and configures necessary permissions.Default: - Default permissions: - Lambda function invoke permissions if executor is present - S3 GetObject permissions if apiSchema.s3File is present
- Parameters:
actionGroup-- The action group to add.
-
addActionGroups
(experimental) Configuration for agent collaboration.Default: - No collaboration configuration.
- Parameters:
actionGroups- This parameter is required.
-
addGuardrail
(experimental) Add guardrail to the agent.- Parameters:
guardrail- This parameter is required.
-
generatePhysicalName
(experimental) Generates a physical name for the agent.Default: - Generated name format: 'agent-{hash}-{uniqueName}' with: - maxLength: MAXLENGTH_FOR_ROLE_NAME - '-bedrockagent'.length - lower: true - separator: '-'
- Overrides:
generatePhysicalNamein classResource- Returns:
- A unique name for the agent with appropriate length constraints
-
getActionGroups
(experimental) action groups associated with the ageny. -
getAgentArn
(experimental) The ARN of the agent.- Specified by:
getAgentArnin interfaceIAgent- Specified by:
getAgentArnin classAgentBase
-
getAgentId
(experimental) The unique identifier for the agent.- Specified by:
getAgentIdin interfaceIAgent- Specified by:
getAgentIdin classAgentBase
-
getAgentVersion
(experimental) The version of the agent.- Specified by:
getAgentVersionin classAgentBase
-
getGrantPrincipal
(experimental) The principal to grant permissions to.- Specified by:
getGrantPrincipalin interfaceIGrantable- Specified by:
getGrantPrincipalin classAgentBase
-
getName
(experimental) The name of the agent. -
getRole
(experimental) The IAM role associated to the agent. -
getTestAlias
(experimental) Default alias of the agent. -
getKmsKey
(experimental) Optional KMS encryption key associated with this agent. -
getLastUpdated
(experimental) When this agent was last updated.- Specified by:
getLastUpdatedin interfaceIAgent- Specified by:
getLastUpdatedin classAgentBase
-
getGuardrail
(experimental) The guardrail that will be associated with the agent. -
setGuardrail
(experimental) The guardrail that will be associated with the agent.
-