Skip to content
v2.274.0

OverrideConfig Struct ​

Configuration for overriding model and prompt template.

Example ​

ts
// Create a custom semantic memory strategy
const customSemanticStrategy = agentcore.MemoryStrategy.usingSemantic({
  strategyName: "customSemanticStrategy",
  description: "Custom semantic memory strategy",
  namespaces: ["/custom/strategies/{memoryStrategyId}/actors/{actorId}"],
  customConsolidation: {
    model: bedrock.FoundationModel.fromFoundationModelId(this, 'ConsolidationModel',
      bedrock.FoundationModelIdentifier.ANTHROPIC_CLAUDE_3_5_SONNET_20241022_V2_0,
    ),
    appendToPrompt: "Custom consolidation prompt for semantic memory",
  },
  customExtraction: {
    model: bedrock.FoundationModel.fromFoundationModelId(this, 'ExtractionModel',
      bedrock.FoundationModelIdentifier.ANTHROPIC_CLAUDE_3_5_SONNET_20241022_V2_0,
    ),
    appendToPrompt: "Custom extraction prompt for semantic memory",
  },
});

// Create memory with custom strategy
const memory = new agentcore.Memory(this, "MyMemory", {
  memoryName: "my-custom-memory",
  description: "Memory with custom strategy",
  expirationDuration: cdk.Duration.days(90),
  memoryStrategies: [customSemanticStrategy],
});

Properties ​

appendToPromptstringappend_to_promptstrappendToPromptStringAppendToPromptstringAppendToPrompt*stringrequired#
The prompt that will be appended to the system prompt to define the model's memory consolidation/extraction strategy.

This configuration provides customization to how the model identifies and extracts relevant information for memory storage. You can use the default user prompt or create a customized one.

modelIModelmodelIModelmodelIModelModelIModelModelIModelrequired#
The model to use for consolidation/extraction.