OverrideConfig

class aws_cdk.aws_bedrockagentcore.OverrideConfig(*, append_to_prompt, model)

Bases: object

Configuration for overriding model and prompt template.

Parameters:
  • append_to_prompt (str) – 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.

  • model (IModel) – The model to use for consolidation/extraction.

ExampleMetadata:

fixture=default infused

Example:

# Create a custom semantic memory strategy
custom_semantic_strategy = agentcore.MemoryStrategy.using_semantic(
    strategy_name="customSemanticStrategy",
    description="Custom semantic memory strategy",
    namespaces=["/custom/strategies/{memoryStrategyId}/actors/{actorId}"],
    custom_consolidation=agentcore.OverrideConfig(
        model=bedrock.FoundationModel.from_foundation_model_id(self, "ConsolidationModel", bedrock.FoundationModelIdentifier.ANTHROPIC_CLAUDE_3_5_SONNET_20241022_V2_0),
        append_to_prompt="Custom consolidation prompt for semantic memory"
    ),
    custom_extraction=agentcore.OverrideConfig(
        model=bedrock.FoundationModel.from_foundation_model_id(self, "ExtractionModel", bedrock.FoundationModelIdentifier.ANTHROPIC_CLAUDE_3_5_SONNET_20241022_V2_0),
        append_to_prompt="Custom extraction prompt for semantic memory"
    )
)

# Create memory with custom strategy
memory = agentcore.Memory(self, "MyMemory",
    memory_name="my-custom-memory",
    description="Memory with custom strategy",
    expiration_duration=cdk.Duration.days(90),
    memory_strategies=[custom_semantic_strategy]
)

Attributes

append_to_prompt

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.

See:

https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/system-prompts.html

model

The model to use for consolidation/extraction.