@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
215 lines • 8.36 kB
JavaScript
;
// *** 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.AgentcoreMemoryStrategy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an AWS Bedrock AgentCore Memory Strategy. Memory strategies define how the agent processes and organizes information within a memory, such as semantic understanding, summarization, or custom processing logic.
*
* **Important Limitations:**
*
* - Each memory can have a maximum of 6 strategies total
* - Only one strategy of each built-in type (`SEMANTIC`, `SUMMARIZATION`, `USER_PREFERENCE`) can exist per memory
* - Multiple `CUSTOM` strategies are allowed (subject to the total limit of 6)
*
* ## Example Usage
*
* ### Semantic Strategy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const semantic = new aws.bedrock.AgentcoreMemoryStrategy("semantic", {
* name: "semantic-strategy",
* memoryId: example.id,
* type: "SEMANTIC",
* description: "Semantic understanding strategy",
* namespaces: ["default"],
* });
* ```
*
* ### Summarization Strategy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const summary = new aws.bedrock.AgentcoreMemoryStrategy("summary", {
* name: "summary-strategy",
* memoryId: example.id,
* type: "SUMMARIZATION",
* description: "Text summarization strategy",
* namespaces: ["{sessionId}"],
* });
* ```
*
* ### User Preference Strategy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const userPref = new aws.bedrock.AgentcoreMemoryStrategy("user_pref", {
* name: "user-preference-strategy",
* memoryId: example.id,
* type: "USER_PREFERENCE",
* description: "User preference tracking strategy",
* namespaces: ["preferences"],
* });
* ```
*
* ### Custom Strategy with Semantic Override
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const customSemantic = new aws.bedrock.AgentcoreMemoryStrategy("custom_semantic", {
* name: "custom-semantic-strategy",
* memoryId: example.id,
* memoryExecutionRoleArn: example.memoryExecutionRoleArn,
* type: "CUSTOM",
* description: "Custom semantic processing strategy",
* namespaces: ["{sessionId}"],
* configuration: {
* type: "SEMANTIC_OVERRIDE",
* consolidation: {
* appendToPrompt: "Focus on extracting key semantic relationships and concepts",
* modelId: "anthropic.claude-3-sonnet-20240229-v1:0",
* },
* extraction: {
* appendToPrompt: "Extract and categorize semantic information",
* modelId: "anthropic.claude-3-haiku-20240307-v1:0",
* },
* },
* });
* ```
*
* ### Custom Strategy with Summary Override
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const customSummary = new aws.bedrock.AgentcoreMemoryStrategy("custom_summary", {
* name: "custom-summary-strategy",
* memoryId: example.id,
* type: "CUSTOM",
* description: "Custom summarization strategy",
* namespaces: ["summaries"],
* configuration: {
* type: "SUMMARY_OVERRIDE",
* consolidation: {
* appendToPrompt: "Create concise summaries while preserving key details",
* modelId: "anthropic.claude-3-sonnet-20240229-v1:0",
* },
* },
* });
* ```
*
* ### Custom Strategy with User Preference Override
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const customUserPref = new aws.bedrock.AgentcoreMemoryStrategy("custom_user_pref", {
* name: "custom-user-preference-strategy",
* memoryId: example.id,
* type: "CUSTOM",
* description: "Custom user preference tracking strategy",
* namespaces: ["user_prefs"],
* configuration: {
* type: "USER_PREFERENCE_OVERRIDE",
* consolidation: {
* appendToPrompt: "Consolidate user preferences and behavioral patterns",
* modelId: "anthropic.claude-3-sonnet-20240229-v1:0",
* },
* extraction: {
* appendToPrompt: "Extract user preferences and interaction patterns",
* modelId: "anthropic.claude-3-haiku-20240307-v1:0",
* },
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Bedrock AgentCore Memory Strategy using the `memory_id,strategy_id`. For example:
*
* ```sh
* $ pulumi import aws:bedrock/agentcoreMemoryStrategy:AgentcoreMemoryStrategy example MEMORY1234567890,STRATEGY0987654321
* ```
*/
class AgentcoreMemoryStrategy extends pulumi.CustomResource {
/**
* Get an existing AgentcoreMemoryStrategy 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 AgentcoreMemoryStrategy(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AgentcoreMemoryStrategy. 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'] === AgentcoreMemoryStrategy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["configuration"] = state?.configuration;
resourceInputs["description"] = state?.description;
resourceInputs["memoryExecutionRoleArn"] = state?.memoryExecutionRoleArn;
resourceInputs["memoryId"] = state?.memoryId;
resourceInputs["memoryStrategyId"] = state?.memoryStrategyId;
resourceInputs["name"] = state?.name;
resourceInputs["namespaces"] = state?.namespaces;
resourceInputs["region"] = state?.region;
resourceInputs["timeouts"] = state?.timeouts;
resourceInputs["type"] = state?.type;
}
else {
const args = argsOrState;
if (args?.memoryId === undefined && !opts.urn) {
throw new Error("Missing required property 'memoryId'");
}
if (args?.namespaces === undefined && !opts.urn) {
throw new Error("Missing required property 'namespaces'");
}
if (args?.type === undefined && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["configuration"] = args?.configuration;
resourceInputs["description"] = args?.description;
resourceInputs["memoryExecutionRoleArn"] = args?.memoryExecutionRoleArn;
resourceInputs["memoryId"] = args?.memoryId;
resourceInputs["name"] = args?.name;
resourceInputs["namespaces"] = args?.namespaces;
resourceInputs["region"] = args?.region;
resourceInputs["timeouts"] = args?.timeouts;
resourceInputs["type"] = args?.type;
resourceInputs["memoryStrategyId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AgentcoreMemoryStrategy.__pulumiType, name, resourceInputs, opts);
}
}
exports.AgentcoreMemoryStrategy = AgentcoreMemoryStrategy;
/** @internal */
AgentcoreMemoryStrategy.__pulumiType = 'aws:bedrock/agentcoreMemoryStrategy:AgentcoreMemoryStrategy';
//# sourceMappingURL=agentcoreMemoryStrategy.js.map