UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

177 lines 8.23 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.AgentAgentCollaborator = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Resource for managing an AWS Bedrock Agents Agent Collaborator. * * ## Example Usage * * ### Basic Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getCallerIdentity({}); * const currentGetPartition = aws.getPartition({}); * const currentGetRegion = aws.getRegion({}); * const exampleAgentTrust = Promise.all([current, currentGetPartition, currentGetRegion, current]).then(([current, currentGetPartition, currentGetRegion, current1]) => aws.iam.getPolicyDocument({ * statements: [{ * actions: ["sts:AssumeRole"], * principals: [{ * identifiers: ["bedrock.amazonaws.com"], * type: "Service", * }], * conditions: [ * { * test: "StringEquals", * values: [current.accountId], * variable: "aws:SourceAccount", * }, * { * test: "ArnLike", * values: [`arn:${currentGetPartition.partition}:bedrock:${currentGetRegion.region}:${current1.accountId}:agent/*`], * variable: "AWS:SourceArn", * }, * ], * }], * })); * const exampleAgentPermissions = Promise.all([currentGetPartition, currentGetRegion, currentGetRegion, current, currentGetRegion, current]).then(([currentGetPartition, currentGetRegion, currentGetRegion1, current, currentGetRegion2, current1]) => aws.iam.getPolicyDocument({ * statements: [ * { * actions: ["bedrock:InvokeModel"], * resources: [`arn:${currentGetPartition.partition}:bedrock:${currentGetRegion.region}::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0`], * }, * { * actions: [ * "bedrock:GetAgentAlias", * "bedrock:InvokeAgent", * ], * resources: [ * `arn:${currentAgent.partition}:bedrock:${currentGetRegion1.region}:${current.accountId}:agent/*`, * `arn:${currentAgent.partition}:bedrock:${currentGetRegion2.region}:${current1.accountId}:agent-alias/*`, * ], * }, * ], * })); * const example = new aws.iam.Role("example", { * assumeRolePolicy: exampleAgentTrust.then(exampleAgentTrust => exampleAgentTrust.json), * namePrefix: "AmazonBedrockExecutionRoleForAgents_", * }); * const exampleRolePolicy = new aws.iam.RolePolicy("example", { * policy: exampleAgentPermissions.then(exampleAgentPermissions => exampleAgentPermissions.json), * role: example.id, * }); * const exampleCollaborator = new aws.bedrock.AgentAgent("example_collaborator", { * agentName: "my-agent-collaborator", * agentResourceRoleArn: example.arn, * idleSessionTtlInSeconds: 500, * foundationModel: "anthropic.claude-3-5-sonnet-20241022-v2:0", * instruction: "do what the supervisor tells you to do", * }); * const exampleSupervisor = new aws.bedrock.AgentAgent("example_supervisor", { * agentName: "my-agent-supervisor", * agentResourceRoleArn: example.arn, * agentCollaboration: "SUPERVISOR", * idleSessionTtlInSeconds: 500, * foundationModel: "anthropic.claude-3-5-sonnet-20241022-v2:0", * instruction: "tell the sub agent what to do", * prepareAgent: false, * }); * const exampleAgentAgentAlias = new aws.bedrock.AgentAgentAlias("example", { * agentAliasName: "my-agent-alias", * agentId: exampleCollaborator.agentId, * description: "Test Alias", * }); * const exampleAgentAgentCollaborator = new aws.bedrock.AgentAgentCollaborator("example", { * agentId: exampleSupervisor.agentId, * collaborationInstruction: "tell the other agent what to do", * collaboratorName: "my-collab-example", * relayConversationHistory: "TO_COLLABORATOR", * agentDescriptor: { * aliasArn: exampleAgentAgentAlias.agentAliasArn, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import Bedrock Agents Agent Collaborator using a comma-delimited string combining `agent_id`, `agent_version`, and `collaborator_id`. For example: * * ```sh * $ pulumi import aws:bedrock/agentAgentCollaborator:AgentAgentCollaborator example 9LSJO0BFI8,DRAFT,AG3TN4RQIY * ``` */ class AgentAgentCollaborator extends pulumi.CustomResource { /** * Get an existing AgentAgentCollaborator resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new AgentAgentCollaborator(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of AgentAgentCollaborator. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === AgentAgentCollaborator.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["agentDescriptor"] = state?.agentDescriptor; resourceInputs["agentId"] = state?.agentId; resourceInputs["agentVersion"] = state?.agentVersion; resourceInputs["collaborationInstruction"] = state?.collaborationInstruction; resourceInputs["collaboratorId"] = state?.collaboratorId; resourceInputs["collaboratorName"] = state?.collaboratorName; resourceInputs["prepareAgent"] = state?.prepareAgent; resourceInputs["region"] = state?.region; resourceInputs["relayConversationHistory"] = state?.relayConversationHistory; resourceInputs["timeouts"] = state?.timeouts; } else { const args = argsOrState; if (args?.agentId === undefined && !opts.urn) { throw new Error("Missing required property 'agentId'"); } if (args?.collaborationInstruction === undefined && !opts.urn) { throw new Error("Missing required property 'collaborationInstruction'"); } if (args?.collaboratorName === undefined && !opts.urn) { throw new Error("Missing required property 'collaboratorName'"); } resourceInputs["agentDescriptor"] = args?.agentDescriptor; resourceInputs["agentId"] = args?.agentId; resourceInputs["agentVersion"] = args?.agentVersion; resourceInputs["collaborationInstruction"] = args?.collaborationInstruction; resourceInputs["collaboratorName"] = args?.collaboratorName; resourceInputs["prepareAgent"] = args?.prepareAgent; resourceInputs["region"] = args?.region; resourceInputs["relayConversationHistory"] = args?.relayConversationHistory; resourceInputs["timeouts"] = args?.timeouts; resourceInputs["collaboratorId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(AgentAgentCollaborator.__pulumiType, name, resourceInputs, opts); } } exports.AgentAgentCollaborator = AgentAgentCollaborator; /** @internal */ AgentAgentCollaborator.__pulumiType = 'aws:bedrock/agentAgentCollaborator:AgentAgentCollaborator'; //# sourceMappingURL=agentAgentCollaborator.js.map