domains / / awslabs/agentcore-samples
Explicit memory disabling
When building LLM agents for AgentCore/runtime environments, don’t rely on framework defaults for memory. If your agent does not use conversational/session memory, explicitly disable it (e.g., set `memory_mode='NO_MEMORY'`) to prevent the runtime/framework from automatically creating/using STM.
When building LLM agents for AgentCore/runtime environments, don’t rely on framework defaults for memory. If your agent does not use conversational/session memory, explicitly disable it (e.g., set memory_mode='NO_MEMORY') to prevent the runtime/framework from automatically creating/using STM.
Example (pattern):
# Only enable memory if you actually need it.
agent = Agent(
model=bedrock_model,
system_prompt=system_prompt,
tools=[web_search],
memory_mode='NO_MEMORY',
)
If you later add memory, make that change intentional (and document why), rather than leaving defaults enabled inadvertently.