Class AgentAgent


  • public class AgentAgent
    extends com.pulumi.resources.CustomResource
    Manages an AWS Agents for Amazon Bedrock Agent. ## Example Usage ### Basic Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.AwsFunctions;
     import com.pulumi.aws.inputs.GetCallerIdentityArgs;
     import com.pulumi.aws.inputs.GetPartitionArgs;
     import com.pulumi.aws.inputs.GetRegionArgs;
     import com.pulumi.aws.iam.IamFunctions;
     import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
     import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
     import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementConditionArgs;
     import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
     import com.pulumi.aws.iam.Role;
     import com.pulumi.aws.iam.RoleArgs;
     import com.pulumi.aws.iam.RolePolicy;
     import com.pulumi.aws.iam.RolePolicyArgs;
     import com.pulumi.aws.bedrock.AgentAgent;
     import com.pulumi.aws.bedrock.AgentAgentArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             final var current = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
                 .build());
     
             final var currentGetPartition = AwsFunctions.getPartition(GetPartitionArgs.builder()
                 .build());
     
             final var currentGetRegion = AwsFunctions.getRegion(GetRegionArgs.builder()
                 .build());
     
             final var exampleAgentTrust = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                 .statements(GetPolicyDocumentStatementArgs.builder()
                     .conditions(                
                         GetPolicyDocumentStatementConditionArgs.builder()
                             .test("StringEquals")
                             .values(current.accountId())
                             .variable("aws:SourceAccount")
                             .build(),
                         GetPolicyDocumentStatementConditionArgs.builder()
                             .test("ArnLike")
                             .values(String.format("arn:%s:bedrock:%s:%s:agent/*", currentGetPartition.partition(),currentGetRegion.region(),current.accountId()))
                             .variable("AWS:SourceArn")
                             .build())
                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                         .identifiers("bedrock.amazonaws.com")
                         .type("Service")
                         .build())
                     .actions("sts:AssumeRole")
                     .build())
                 .build());
     
             final var exampleAgentPermissions = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                 .statements(GetPolicyDocumentStatementArgs.builder()
                     .actions("bedrock:InvokeModel")
                     .resources(String.format("arn:%s:bedrock:%s::foundation-model/anthropic.claude-v2", currentGetPartition.partition(),currentGetRegion.region()))
                     .build())
                 .build());
     
             var example = new Role("example", RoleArgs.builder()
                 .assumeRolePolicy(exampleAgentTrust.json())
                 .namePrefix("AmazonBedrockExecutionRoleForAgents_")
                 .build());
     
             var exampleRolePolicy = new RolePolicy("exampleRolePolicy", RolePolicyArgs.builder()
                 .policy(exampleAgentPermissions.json())
                 .role(example.id())
                 .build());
     
             var exampleAgentAgent = new AgentAgent("exampleAgentAgent", AgentAgentArgs.builder()
                 .agentName("my-agent-name")
                 .agentResourceRoleArn(example.arn())
                 .idleSessionTtlInSeconds(500)
                 .instruction("You are a friendly assistant who helps answer questions.")
                 .foundationModel("anthropic.claude-v2")
                 .build());
     
         }
     }
     
     
    ## Import Using `pulumi import`, import Agents for Amazon Bedrock Agent using the agent ID. For example: ```sh $ pulumi import aws:bedrock/agentAgent:AgentAgent example GGRRAED6JP ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Detail

      • AgentAgent

        public AgentAgent​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • AgentAgent

        public AgentAgent​(java.lang.String name,
                          AgentAgentArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • AgentAgent

        public AgentAgent​(java.lang.String name,
                          AgentAgentArgs args,
                          @Nullable
                          com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • agentArn

        public com.pulumi.core.Output<java.lang.String> agentArn()
        Returns:
        ARN of the agent.
      • agentCollaboration

        public com.pulumi.core.Output<java.lang.String> agentCollaboration()
        Returns:
        Agents collaboration role. Valid values: `SUPERVISOR`, `SUPERVISOR_ROUTER`, `DISABLED`.
      • agentId

        public com.pulumi.core.Output<java.lang.String> agentId()
        Returns:
        Unique identifier of the agent.
      • agentName

        public com.pulumi.core.Output<java.lang.String> agentName()
        Returns:
        Name of the agent.
      • agentResourceRoleArn

        public com.pulumi.core.Output<java.lang.String> agentResourceRoleArn()
        Returns:
        ARN of the IAM role with permissions to invoke API operations on the agent.
      • agentVersion

        public com.pulumi.core.Output<java.lang.String> agentVersion()
        Returns:
        Version of the agent.
      • customerEncryptionKeyArn

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> customerEncryptionKeyArn()
        Returns:
        ARN of the AWS KMS key that encrypts the agent.
      • description

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
        Returns:
        Description of the agent.
      • foundationModel

        public com.pulumi.core.Output<java.lang.String> foundationModel()
        Returns:
        Foundation model used for orchestration by the agent. The following arguments are optional:
      • guardrailConfigurations

        public com.pulumi.core.Output<java.util.Optional<java.util.List<AgentAgentGuardrailConfiguration>>> guardrailConfigurations()
        Returns:
        Details about the guardrail associated with the agent. See `guardrailConfiguration` Block for details.
      • idleSessionTtlInSeconds

        public com.pulumi.core.Output<java.lang.Integer> idleSessionTtlInSeconds()
        Returns:
        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

        public com.pulumi.core.Output<java.lang.String> instruction()
        Returns:
        Instructions that tell the agent what it should do and how it should interact with users. If `prepareAgent` is `true` this argument is required. The valid range is 40 - 20000 characters.
      • memoryConfigurations

        public com.pulumi.core.Output<java.util.List<AgentAgentMemoryConfiguration>> memoryConfigurations()
        Returns:
        Configurations for the agent's ability to retain the conversational context. See `memoryConfiguration` Block for details.
      • prepareAgent

        public com.pulumi.core.Output<java.lang.Boolean> prepareAgent()
        Returns:
        Whether to prepare the agent after creation or modification. Defaults to `true`.
      • preparedAt

        public com.pulumi.core.Output<java.lang.String> preparedAt()
        Returns:
        Timestamp of when the agent was last prepared.
      • promptOverrideConfigurations

        public com.pulumi.core.Output<java.util.List<AgentAgentPromptOverrideConfiguration>> promptOverrideConfigurations()
        Returns:
        Configurations to override prompt templates in different parts of an agent sequence. For more information, see [Advanced prompts](https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts.html). See `promptOverrideConfiguration` Block for details.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • skipResourceInUseCheck

        public com.pulumi.core.Output<java.lang.Boolean> skipResourceInUseCheck()
        Returns:
        Whether to skip the in-use check when deleting the agent. Defaults to `false`.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Map of tags assigned to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • timeouts

        public com.pulumi.core.Output<java.util.Optional<AgentAgentTimeouts>> timeouts()
      • get

        public static AgentAgent get​(java.lang.String name,
                                     com.pulumi.core.Output<java.lang.String> id,
                                     @Nullable
                                     AgentAgentState state,
                                     @Nullable
                                     com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.