CfnAgent
- class aws_cdk.aws_bedrock.CfnAgent(scope, id, *, agent_name, action_groups=None, agent_resource_role_arn=None, auto_prepare=None, customer_encryption_key_arn=None, description=None, foundation_model=None, guardrail_configuration=None, idle_session_ttl_in_seconds=None, instruction=None, knowledge_bases=None, prompt_override_configuration=None, skip_resource_in_use_check_on_delete=None, tags=None, test_alias_tags=None)
Bases:
CfnResource
Specifies an agent as a resource in a top-level template. Minimally, you must specify the following properties:.
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.
- See:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-bedrock-agent.html
- CloudformationResource:
AWS::Bedrock::Agent
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock cfn_agent = bedrock.CfnAgent(self, "MyCfnAgent", agent_name="agentName", # the properties below are optional action_groups=[bedrock.CfnAgent.AgentActionGroupProperty( action_group_name="actionGroupName", # the properties below are optional action_group_executor=bedrock.CfnAgent.ActionGroupExecutorProperty( custom_control="customControl", lambda_="lambda" ), action_group_state="actionGroupState", api_schema=bedrock.CfnAgent.APISchemaProperty( payload="payload", s3=bedrock.CfnAgent.S3IdentifierProperty( s3_bucket_name="s3BucketName", s3_object_key="s3ObjectKey" ) ), description="description", function_schema=bedrock.CfnAgent.FunctionSchemaProperty( functions=[bedrock.CfnAgent.FunctionProperty( name="name", # the properties below are optional description="description", parameters={ "parameters_key": bedrock.CfnAgent.ParameterDetailProperty( type="type", # the properties below are optional description="description", required=False ) } )] ), parent_action_group_signature="parentActionGroupSignature", skip_resource_in_use_check_on_delete=False )], agent_resource_role_arn="agentResourceRoleArn", auto_prepare=False, customer_encryption_key_arn="customerEncryptionKeyArn", description="description", foundation_model="foundationModel", guardrail_configuration=bedrock.CfnAgent.GuardrailConfigurationProperty( guardrail_identifier="guardrailIdentifier", guardrail_version="guardrailVersion" ), idle_session_ttl_in_seconds=123, instruction="instruction", knowledge_bases=[bedrock.CfnAgent.AgentKnowledgeBaseProperty( description="description", knowledge_base_id="knowledgeBaseId", # the properties below are optional knowledge_base_state="knowledgeBaseState" )], prompt_override_configuration=bedrock.CfnAgent.PromptOverrideConfigurationProperty( prompt_configurations=[bedrock.CfnAgent.PromptConfigurationProperty( base_prompt_template="basePromptTemplate", inference_configuration=bedrock.CfnAgent.InferenceConfigurationProperty( maximum_length=123, stop_sequences=["stopSequences"], temperature=123, top_k=123, top_p=123 ), parser_mode="parserMode", prompt_creation_mode="promptCreationMode", prompt_state="promptState", prompt_type="promptType" )], # the properties below are optional override_lambda="overrideLambda" ), skip_resource_in_use_check_on_delete=False, tags={ "tags_key": "tags" }, test_alias_tags={ "test_alias_tags_key": "testAliasTags" } )
- Parameters:
scope (
Construct
) – Scope in which this resource is defined.id (
str
) – Construct identifier for this resource (unique in its scope).agent_name (
str
) – The name of the agent.action_groups (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,AgentActionGroupProperty
,Dict
[str
,Any
]]],None
]) – The action groups that belong to an agent.agent_resource_role_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent.auto_prepare (
Union
[bool
,IResolvable
,None
]) – Specifies whether to automatically update theDRAFT
version of the agent after making changes to the agent. TheDRAFT
version can be continually iterated upon during internal development. By default, this value isfalse
. Default: - falsecustomer_encryption_key_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the AWS KMS key that encrypts the agent.description (
Optional
[str
]) – The description of the agent.foundation_model (
Optional
[str
]) – The foundation model used for orchestration by the agent.guardrail_configuration (
Union
[IResolvable
,GuardrailConfigurationProperty
,Dict
[str
,Any
],None
]) – Details about the guardrail associated with the agent.idle_session_ttl_in_seconds (
Union
[int
,float
,None
]) – The number of seconds for which Amazon Bedrock keeps information about a user’s conversation with the agent. A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout.instruction (
Optional
[str
]) – Instructions that tell the agent what it should do and how it should interact with users.knowledge_bases (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,AgentKnowledgeBaseProperty
,Dict
[str
,Any
]]],None
]) – The knowledge bases associated with the agent.prompt_override_configuration (
Union
[IResolvable
,PromptOverrideConfigurationProperty
,Dict
[str
,Any
],None
]) – Contains configurations to override prompt templates in different parts of an agent sequence. For more information, see Advanced prompts .skip_resource_in_use_check_on_delete (
Union
[bool
,IResolvable
,None
]) – Specifies whether to delete the resource even if it’s in use. By default, this value isfalse
. Default: - falsetags (
Optional
[Mapping
[str
,str
]]) – Metadata that you can assign to a resource as key-value pairs. For more information, see the following resources:. - Tag naming limits and requirements - Tagging best practicestest_alias_tags (
Union
[IResolvable
,Mapping
[str
,str
],None
]) –Metadata that you can assign to a resource as key-value pairs. For more information, see the following resources:. - Tag naming limits and requirements - Tagging best practices
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_dependency(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_depends_on(target)
(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Parameters:
target (
CfnResource
) –- Deprecated:
use addDependency
- Stability:
deprecated
- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT
). A list of resources that support this policy can be found in the following link:- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resource, please consult that specific resource’s documentation.
- See:
- Return type:
None
- get_att(attribute_name, type_hint=None)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.type_hint (
Optional
[ResolutionTypeHint
]) –
- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) – tree inspector to collect and process attributes.- Return type:
None
- obtain_dependencies()
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
- Return type:
List
[Union
[Stack
,CfnResource
]]
- obtain_resource_dependencies()
Get a shallow copy of dependencies between this resource and other resources in the same stack.
- Return type:
List
[CfnResource
]
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- remove_dependency(target)
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- replace_dependency(target, new_target)
Replaces one dependency with another.
- Parameters:
target (
CfnResource
) – The dependency to replace.new_target (
CfnResource
) – The new dependency to add.
- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::Bedrock::Agent'
- action_groups
The action groups that belong to an agent.
- agent_name
The name of the agent.
- agent_resource_role_arn
The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent.
- attr_agent_arn
The Amazon Resource Name (ARN) of the agent.
- CloudformationAttribute:
AgentArn
- attr_agent_id
The unique identifier of the agent.
- CloudformationAttribute:
AgentId
- attr_agent_status
.
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.
- CloudformationAttribute:
AgentStatus
- Type:
The status of the agent and whether it is ready for use. The following statuses are possible
- attr_agent_version
The version of the agent.
- CloudformationAttribute:
AgentVersion
- attr_created_at
The time at which the agent was created.
- CloudformationAttribute:
CreatedAt
- attr_failure_reasons
Contains reasons that the agent-related API that you invoked failed.
- CloudformationAttribute:
FailureReasons
- attr_prepared_at
The time at which the agent was last prepared.
- CloudformationAttribute:
PreparedAt
- attr_recommended_actions
Contains recommended actions to take for the agent-related API that you invoked to succeed.
- CloudformationAttribute:
RecommendedActions
- attr_updated_at
The time at which the agent was last updated.
- CloudformationAttribute:
UpdatedAt
- auto_prepare
Specifies whether to automatically update the
DRAFT
version of the agent after making changes to the agent.
- cdk_tag_manager
Tag Manager which manages the tags for this resource.
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- customer_encryption_key_arn
The Amazon Resource Name (ARN) of the AWS KMS key that encrypts the agent.
- description
The description of the agent.
- foundation_model
The foundation model used for orchestration by the agent.
- guardrail_configuration
Details about the guardrail associated with the agent.
- idle_session_ttl_in_seconds
The number of seconds for which Amazon Bedrock keeps information about a user’s conversation with the agent.
- instruction
Instructions that tell the agent what it should do and how it should interact with users.
- knowledge_bases
The knowledge bases associated with the agent.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The tree node.
- prompt_override_configuration
Contains configurations to override prompt templates in different parts of an agent sequence.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- skip_resource_in_use_check_on_delete
Specifies whether to delete the resource even if it’s in use.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
Metadata that you can assign to a resource as key-value pairs.
For more information, see the following resources:.
- test_alias_tags
Metadata that you can assign to a resource as key-value pairs.
For more information, see the following resources:.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(x)
Check whether the given object is a CfnResource.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
APISchemaProperty
- class CfnAgent.APISchemaProperty(*, payload=None, s3=None)
Bases:
object
Contains details about the OpenAPI schema for the action group.
For more information, see Action group OpenAPI schemas . You can either include the schema directly in the
payload
field or you can upload it to an S3 bucket and specify the S3 bucket location in thes3
field.- Parameters:
payload (
Optional
[str
]) –The JSON or YAML-formatted payload defining the OpenAPI schema for the action group. For more information, see Action group OpenAPI schemas .
s3 (
Union
[IResolvable
,S3IdentifierProperty
,Dict
[str
,Any
],None
]) –Contains details about the S3 object containing the OpenAPI schema for the action group. For more information, see Action group OpenAPI schemas .
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock a_pISchema_property = bedrock.CfnAgent.APISchemaProperty( payload="payload", s3=bedrock.CfnAgent.S3IdentifierProperty( s3_bucket_name="s3BucketName", s3_object_key="s3ObjectKey" ) )
Attributes
- payload
The JSON or YAML-formatted payload defining the OpenAPI schema for the action group.
For more information, see Action group OpenAPI schemas .
- s3
Contains details about the S3 object containing the OpenAPI schema for the action group.
For more information, see Action group OpenAPI schemas .
ActionGroupExecutorProperty
- class CfnAgent.ActionGroupExecutorProperty(*, custom_control=None, lambda_=None)
Bases:
object
Contains 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.
- Parameters:
custom_control (
Optional
[str
]) – To return the action group invocation results directly in theInvokeAgent
response, specifyRETURN_CONTROL
.lambda – The Amazon Resource Name (ARN) of the Lambda function containing the business logic that is carried out upon invoking the action.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock action_group_executor_property = bedrock.CfnAgent.ActionGroupExecutorProperty( custom_control="customControl", lambda_="lambda" )
Attributes
- custom_control
To return the action group invocation results directly in the
InvokeAgent
response, specifyRETURN_CONTROL
.
- lambda_
The Amazon Resource Name (ARN) of the Lambda function containing the business logic that is carried out upon invoking the action.
AgentActionGroupProperty
- class CfnAgent.AgentActionGroupProperty(*, action_group_name, action_group_executor=None, action_group_state=None, api_schema=None, description=None, function_schema=None, parent_action_group_signature=None, skip_resource_in_use_check_on_delete=None)
Bases:
object
Contains details about an action group.
- Parameters:
action_group_name (
str
) – The name of the action group.action_group_executor (
Union
[IResolvable
,ActionGroupExecutorProperty
,Dict
[str
,Any
],None
]) – The Amazon Resource Name (ARN) of 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.action_group_state (
Optional
[str
]) – Specifies whether the action group is available for the agent to invoke or not when sending an InvokeAgent request.api_schema (
Union
[IResolvable
,APISchemaProperty
,Dict
[str
,Any
],None
]) –Contains either details about the S3 object containing the OpenAPI schema for the action group or the JSON or YAML-formatted payload defining the schema. For more information, see Action group OpenAPI schemas .
description (
Optional
[str
]) – The description of the action group.function_schema (
Union
[IResolvable
,FunctionSchemaProperty
,Dict
[str
,Any
],None
]) – Defines functions that each define parameters that the agent needs to invoke from the user. Each function represents an action in an action group.parent_action_group_signature (
Optional
[str
]) – If this field is set asAMAZON.UserInput
, the agent can request the user for additional information when trying to complete a task. Thedescription
,apiSchema
, andactionGroupExecutor
fields must be blank for this action group. During orchestration, if the agent determines that it needs to invoke an API in an action group, but doesn’t have enough information to complete the API request, it will invoke this action group instead and return an Observation reprompting the user for more information.skip_resource_in_use_check_on_delete (
Union
[bool
,IResolvable
,None
]) – Specifies whether to delete the resource even if it’s in use. By default, this value isfalse
. Default: - false
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock agent_action_group_property = bedrock.CfnAgent.AgentActionGroupProperty( action_group_name="actionGroupName", # the properties below are optional action_group_executor=bedrock.CfnAgent.ActionGroupExecutorProperty( custom_control="customControl", lambda_="lambda" ), action_group_state="actionGroupState", api_schema=bedrock.CfnAgent.APISchemaProperty( payload="payload", s3=bedrock.CfnAgent.S3IdentifierProperty( s3_bucket_name="s3BucketName", s3_object_key="s3ObjectKey" ) ), description="description", function_schema=bedrock.CfnAgent.FunctionSchemaProperty( functions=[bedrock.CfnAgent.FunctionProperty( name="name", # the properties below are optional description="description", parameters={ "parameters_key": bedrock.CfnAgent.ParameterDetailProperty( type="type", # the properties below are optional description="description", required=False ) } )] ), parent_action_group_signature="parentActionGroupSignature", skip_resource_in_use_check_on_delete=False )
Attributes
- action_group_executor
The Amazon Resource Name (ARN) of 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.
- action_group_name
The name of the action group.
- action_group_state
//docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html>`_ request.
- See:
- Type:
Specifies whether the action group is available for the agent to invoke or not when sending an `InvokeAgent <https
- api_schema
Contains either details about the S3 object containing the OpenAPI schema for the action group or the JSON or YAML-formatted payload defining the schema.
For more information, see Action group OpenAPI schemas .
- description
The description of the action group.
- function_schema
Defines functions that each define parameters that the agent needs to invoke from the user.
Each function represents an action in an action group.
- parent_action_group_signature
If this field is set as
AMAZON.UserInput
, the agent can request the user for additional information when trying to complete a task. Thedescription
,apiSchema
, andactionGroupExecutor
fields must be blank for this action group.During orchestration, if the agent determines that it needs to invoke an API in an action group, but doesn’t have enough information to complete the API request, it will invoke this action group instead and return an Observation reprompting the user for more information.
- skip_resource_in_use_check_on_delete
Specifies whether to delete the resource even if it’s in use.
By default, this value is
false
.
AgentKnowledgeBaseProperty
- class CfnAgent.AgentKnowledgeBaseProperty(*, description, knowledge_base_id, knowledge_base_state=None)
Bases:
object
Contains details about a knowledge base that is associated with an agent.
- Parameters:
description (
str
) – The description of the association between the agent and the knowledge base.knowledge_base_id (
str
) – The unique identifier of the association between the agent and the knowledge base.knowledge_base_state (
Optional
[str
]) –Specifies whether to use the knowledge base or not when sending an InvokeAgent request.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock agent_knowledge_base_property = bedrock.CfnAgent.AgentKnowledgeBaseProperty( description="description", knowledge_base_id="knowledgeBaseId", # the properties below are optional knowledge_base_state="knowledgeBaseState" )
Attributes
- description
The description of the association between the agent and the knowledge base.
- knowledge_base_id
The unique identifier of the association between the agent and the knowledge base.
FunctionProperty
- class CfnAgent.FunctionProperty(*, name, description=None, parameters=None)
Bases:
object
Defines parameters that the agent needs to invoke from the user to complete the function.
Corresponds to an action in an action group.
This data type is used in the following API operations:
- Parameters:
name (
str
) – A name for the function.description (
Optional
[str
]) – A description of the function and its purpose.parameters (
Union
[IResolvable
,Mapping
[str
,Union
[IResolvable
,ParameterDetailProperty
,Dict
[str
,Any
]]],None
]) – The parameters that the agent elicits from the user to fulfill the function.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock function_property = bedrock.CfnAgent.FunctionProperty( name="name", # the properties below are optional description="description", parameters={ "parameters_key": bedrock.CfnAgent.ParameterDetailProperty( type="type", # the properties below are optional description="description", required=False ) } )
Attributes
- description
A description of the function and its purpose.
- name
A name for the function.
- parameters
The parameters that the agent elicits from the user to fulfill the function.
FunctionSchemaProperty
- class CfnAgent.FunctionSchemaProperty(*, functions)
Bases:
object
Defines functions that each define parameters that the agent needs to invoke from the user.
Each function represents an action in an action group.
This data type is used in the following API operations:
- Parameters:
functions (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,FunctionProperty
,Dict
[str
,Any
]]]]) – A list of functions that each define an action in the action group.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock function_schema_property = bedrock.CfnAgent.FunctionSchemaProperty( functions=[bedrock.CfnAgent.FunctionProperty( name="name", # the properties below are optional description="description", parameters={ "parameters_key": bedrock.CfnAgent.ParameterDetailProperty( type="type", # the properties below are optional description="description", required=False ) } )] )
Attributes
- functions
A list of functions that each define an action in the action group.
GuardrailConfigurationProperty
- class CfnAgent.GuardrailConfigurationProperty(*, guardrail_identifier=None, guardrail_version=None)
Bases:
object
Configuration information for a guardrail that you use with the Converse operation.
- Parameters:
guardrail_identifier (
Optional
[str
]) – The identifier for the guardrail.guardrail_version (
Optional
[str
]) – The version of the guardrail.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock guardrail_configuration_property = bedrock.CfnAgent.GuardrailConfigurationProperty( guardrail_identifier="guardrailIdentifier", guardrail_version="guardrailVersion" )
Attributes
- guardrail_identifier
The identifier for the guardrail.
- guardrail_version
The version of the guardrail.
InferenceConfigurationProperty
- class CfnAgent.InferenceConfigurationProperty(*, maximum_length=None, stop_sequences=None, temperature=None, top_k=None, top_p=None)
Bases:
object
Base inference parameters to pass to a model in a call to Converse or ConverseStream . For more information, see Inference parameters for foundation models .
If you need to pass additional parameters that the model supports, use the
additionalModelRequestFields
request field in the call toConverse
orConverseStream
. For more information, see Model parameters .- Parameters:
maximum_length (
Union
[int
,float
,None
]) – The maximum number of tokens allowed in the generated response.stop_sequences (
Optional
[Sequence
[str
]]) – A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.temperature (
Union
[int
,float
,None
]) –The likelihood of the model selecting higher-probability options while generating a response. A lower value makes the model more likely to choose higher-probability options, while a higher value makes the model more likely to choose lower-probability options. The default value is the default value for the model that you are using. For more information, see Inference parameters for foundation models .
top_k (
Union
[int
,float
,None
]) – While generating a response, the model determines the probability of the following token at each point of generation. The value that you set fortopK
is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you settopK
to 50, the model selects the next token from among the top 50 most likely choices.top_p (
Union
[int
,float
,None
]) –The percentage of most-likely candidates that the model considers for the next token. For example, if you choose a value of 0.8 for
topP
, the model selects from the top 80% of the probability distribution of tokens that could be next in the sequence. The default value is the default value for the model that you are using. For more information, see Inference parameters for foundation models .
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock inference_configuration_property = bedrock.CfnAgent.InferenceConfigurationProperty( maximum_length=123, stop_sequences=["stopSequences"], temperature=123, top_k=123, top_p=123 )
Attributes
- maximum_length
The maximum number of tokens allowed in the generated response.
- stop_sequences
A list of stop sequences.
A stop sequence is a sequence of characters that causes the model to stop generating the response.
- temperature
The likelihood of the model selecting higher-probability options while generating a response.
A lower value makes the model more likely to choose higher-probability options, while a higher value makes the model more likely to choose lower-probability options.
The default value is the default value for the model that you are using. For more information, see Inference parameters for foundation models .
- top_k
While generating a response, the model determines the probability of the following token at each point of generation.
The value that you set for
topK
is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you settopK
to 50, the model selects the next token from among the top 50 most likely choices.
- top_p
The percentage of most-likely candidates that the model considers for the next token.
For example, if you choose a value of 0.8 for
topP
, the model selects from the top 80% of the probability distribution of tokens that could be next in the sequence.The default value is the default value for the model that you are using. For more information, see Inference parameters for foundation models .
ParameterDetailProperty
- class CfnAgent.ParameterDetailProperty(*, type, description=None, required=None)
Bases:
object
Contains details about a parameter in a function for an action group.
This data type is used in the following API operations:
- Parameters:
type (
str
) – The data type of the parameter.description (
Optional
[str
]) – A description of the parameter. Helps the foundation model determine how to elicit the parameters from the user.required (
Union
[bool
,IResolvable
,None
]) – Whether the parameter is required for the agent to complete the function for action group invocation.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock parameter_detail_property = bedrock.CfnAgent.ParameterDetailProperty( type="type", # the properties below are optional description="description", required=False )
Attributes
- description
A description of the parameter.
Helps the foundation model determine how to elicit the parameters from the user.
- required
Whether the parameter is required for the agent to complete the function for action group invocation.
- type
The data type of the parameter.
PromptConfigurationProperty
- class CfnAgent.PromptConfigurationProperty(*, base_prompt_template=None, inference_configuration=None, parser_mode=None, prompt_creation_mode=None, prompt_state=None, prompt_type=None)
Bases:
object
Contains configurations to override a prompt template in one part of an agent sequence.
For more information, see Advanced prompts .
- Parameters:
base_prompt_template (
Optional
[str
]) – Defines the prompt template with which to replace the default prompt template. You can use placeholder variables in the base prompt template to customize the prompt. For more information, see Prompt template placeholder variables . For more information, see Configure the prompt templates .inference_configuration (
Union
[IResolvable
,InferenceConfigurationProperty
,Dict
[str
,Any
],None
]) –Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the
promptType
. For more information, see Inference parameters for foundation models .parser_mode (
Optional
[str
]) – Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by thepromptType
. If you set the field asOVERRIDEN
, theoverrideLambda
field in the PromptOverrideConfiguration must be specified with the ARN of a Lambda function.prompt_creation_mode (
Optional
[str
]) – Specifies whether to override the default prompt template for thispromptType
. Set this value toOVERRIDDEN
to use the prompt that you provide in thebasePromptTemplate
. If you leave it asDEFAULT
, the agent uses a default prompt template.prompt_state (
Optional
[str
]) – Specifies whether to allow the agent to carry out the step specified in thepromptType
. If you set this value toDISABLED
, the agent skips that step. The default state for eachpromptType
is as follows. -PRE_PROCESSING
–ENABLED
-ORCHESTRATION
–ENABLED
-KNOWLEDGE_BASE_RESPONSE_GENERATION
–ENABLED
-POST_PROCESSING
–DISABLED
prompt_type (
Optional
[str
]) – The step in the agent sequence that this prompt configuration applies to.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock prompt_configuration_property = bedrock.CfnAgent.PromptConfigurationProperty( base_prompt_template="basePromptTemplate", inference_configuration=bedrock.CfnAgent.InferenceConfigurationProperty( maximum_length=123, stop_sequences=["stopSequences"], temperature=123, top_k=123, top_p=123 ), parser_mode="parserMode", prompt_creation_mode="promptCreationMode", prompt_state="promptState", prompt_type="promptType" )
Attributes
- base_prompt_template
Defines the prompt template with which to replace the default prompt template.
You can use placeholder variables in the base prompt template to customize the prompt. For more information, see Prompt template placeholder variables . For more information, see Configure the prompt templates .
- inference_configuration
Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the
promptType
.For more information, see Inference parameters for foundation models .
- parser_mode
Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the
promptType
.If you set the field as
OVERRIDEN
, theoverrideLambda
field in the PromptOverrideConfiguration must be specified with the ARN of a Lambda function.
- prompt_creation_mode
Specifies whether to override the default prompt template for this
promptType
.Set this value to
OVERRIDDEN
to use the prompt that you provide in thebasePromptTemplate
. If you leave it asDEFAULT
, the agent uses a default prompt template.
- prompt_state
Specifies whether to allow the agent to carry out the step specified in the
promptType
.If you set this value to
DISABLED
, the agent skips that step. The default state for eachpromptType
is as follows.PRE_PROCESSING
–ENABLED
ORCHESTRATION
–ENABLED
KNOWLEDGE_BASE_RESPONSE_GENERATION
–ENABLED
POST_PROCESSING
–DISABLED
- prompt_type
The step in the agent sequence that this prompt configuration applies to.
PromptOverrideConfigurationProperty
- class CfnAgent.PromptOverrideConfigurationProperty(*, prompt_configurations, override_lambda=None)
Bases:
object
Contains configurations to override prompts in different parts of an agent sequence.
For more information, see Advanced prompts .
- Parameters:
prompt_configurations (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,PromptConfigurationProperty
,Dict
[str
,Any
]]]]) –Contains configurations to override a prompt template in one part of an agent sequence. For more information, see Advanced prompts .
override_lambda (
Optional
[str
]) – The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence. If you specify this field, at least one of thepromptConfigurations
must contain aparserMode
value that is set toOVERRIDDEN
. For more information, see Parser Lambda function in Amazon Bedrock Agents .
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock prompt_override_configuration_property = bedrock.CfnAgent.PromptOverrideConfigurationProperty( prompt_configurations=[bedrock.CfnAgent.PromptConfigurationProperty( base_prompt_template="basePromptTemplate", inference_configuration=bedrock.CfnAgent.InferenceConfigurationProperty( maximum_length=123, stop_sequences=["stopSequences"], temperature=123, top_k=123, top_p=123 ), parser_mode="parserMode", prompt_creation_mode="promptCreationMode", prompt_state="promptState", prompt_type="promptType" )], # the properties below are optional override_lambda="overrideLambda" )
Attributes
- override_lambda
The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
If you specify this field, at least one of the
promptConfigurations
must contain aparserMode
value that is set toOVERRIDDEN
. For more information, see Parser Lambda function in Amazon Bedrock Agents .
- prompt_configurations
Contains configurations to override a prompt template in one part of an agent sequence.
For more information, see Advanced prompts .
S3IdentifierProperty
- class CfnAgent.S3IdentifierProperty(*, s3_bucket_name=None, s3_object_key=None)
Bases:
object
The identifier information for an Amazon S3 bucket.
- Parameters:
s3_bucket_name (
Optional
[str
]) – The name of the S3 bucket.s3_object_key (
Optional
[str
]) – The S3 object key for the S3 resource.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_bedrock as bedrock s3_identifier_property = bedrock.CfnAgent.S3IdentifierProperty( s3_bucket_name="s3BucketName", s3_object_key="s3ObjectKey" )
Attributes
- s3_bucket_name
The name of the S3 bucket.
- s3_object_key
The S3 object key for the S3 resource.