From 8fe377578a192366052b0f5ee6188f23be3d4d4a Mon Sep 17 00:00:00 2001 From: Jonathan Segev Date: Mon, 21 Jul 2025 13:21:54 -0400 Subject: [PATCH 1/5] chore: Added Bedrock AgentCore to Deployment patterns section --- docs/user-guide/deploy/operating-agents-in-production.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/user-guide/deploy/operating-agents-in-production.md b/docs/user-guide/deploy/operating-agents-in-production.md index 8a03e9bf..071852e2 100644 --- a/docs/user-guide/deploy/operating-agents-in-production.md +++ b/docs/user-guide/deploy/operating-agents-in-production.md @@ -119,6 +119,8 @@ Strands agents can be deployed using various options from serverless to dedicate Built-in guides are available for several AWS services: +* **Bedrock AgentCore** - Amazon Bedrock AgentCore Runtime is a secure, serverless runtime purpose-built for deploying and scaling dynamic AI agents and tools using any open-source framework with minimal infrastructure management. Equipped with session isolation, session persistence it enables you to securely and reliably run any type of agent including multi-modal, real-time, or long-running agents. [Learn more](deploy_to_bedrock_agentcore.md) + * **AWS Lambda** - Serverless option for short-lived agent interactions and batch processing with minimal infrastructure management. [Learn more](deploy_to_aws_lambda.md) * **AWS Fargate** - Containerized deployment with streaming support, ideal for interactive applications requiring real-time responses or high concurrency. [Learn more](deploy_to_aws_fargate.md) From 53783b3d0bd1d3bfed71cf13fdd921e766f35e5a Mon Sep 17 00:00:00 2001 From: Jonathan Segev Date: Mon, 21 Jul 2025 13:33:57 -0400 Subject: [PATCH 2/5] fix: Adjusted text to be inline with other options --- docs/user-guide/deploy/operating-agents-in-production.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/deploy/operating-agents-in-production.md b/docs/user-guide/deploy/operating-agents-in-production.md index 071852e2..8cb4cd21 100644 --- a/docs/user-guide/deploy/operating-agents-in-production.md +++ b/docs/user-guide/deploy/operating-agents-in-production.md @@ -119,7 +119,7 @@ Strands agents can be deployed using various options from serverless to dedicate Built-in guides are available for several AWS services: -* **Bedrock AgentCore** - Amazon Bedrock AgentCore Runtime is a secure, serverless runtime purpose-built for deploying and scaling dynamic AI agents and tools using any open-source framework with minimal infrastructure management. Equipped with session isolation, session persistence it enables you to securely and reliably run any type of agent including multi-modal, real-time, or long-running agents. [Learn more](deploy_to_bedrock_agentcore.md) +* **Bedrock AgentCore** - Amazon Bedrock AgentCore Runtime is a secure, serverless runtime purpose-built for deploying and scaling dynamic AI agents and tools. [Learn more](deploy_to_bedrock_agentcore.md) * **AWS Lambda** - Serverless option for short-lived agent interactions and batch processing with minimal infrastructure management. [Learn more](deploy_to_aws_lambda.md) From 448b8525062cd5d48dffb51b9b1b9105209aceef Mon Sep 17 00:00:00 2001 From: Jonathan Segev Date: Mon, 21 Jul 2025 15:18:06 -0400 Subject: [PATCH 3/5] fix: Adjusted text to read like the other options --- docs/user-guide/deploy/operating-agents-in-production.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/deploy/operating-agents-in-production.md b/docs/user-guide/deploy/operating-agents-in-production.md index 8cb4cd21..97e95e06 100644 --- a/docs/user-guide/deploy/operating-agents-in-production.md +++ b/docs/user-guide/deploy/operating-agents-in-production.md @@ -119,7 +119,7 @@ Strands agents can be deployed using various options from serverless to dedicate Built-in guides are available for several AWS services: -* **Bedrock AgentCore** - Amazon Bedrock AgentCore Runtime is a secure, serverless runtime purpose-built for deploying and scaling dynamic AI agents and tools. [Learn more](deploy_to_bedrock_agentcore.md) +* **Bedrock AgentCore** - A secure, serverless runtime purpose-built for deploying and scaling dynamic AI agents and tools. [Learn more](deploy_to_bedrock_agentcore.md) * **AWS Lambda** - Serverless option for short-lived agent interactions and batch processing with minimal infrastructure management. [Learn more](deploy_to_aws_lambda.md) From 5be652611c2862b563aa1f06d4bffebe706e7193 Mon Sep 17 00:00:00 2001 From: Jonathan Segev Date: Mon, 13 Oct 2025 17:01:00 -0400 Subject: [PATCH 4/5] feat: AgentCore Session Manager Documentation --- .../session-managers/agent-core-memory.md | 149 ++++++++++++++++++ .../concepts/agents/session-management.md | 9 ++ 2 files changed, 158 insertions(+) create mode 100644 docs/community/session-managers/agent-core-memory.md diff --git a/docs/community/session-managers/agent-core-memory.md b/docs/community/session-managers/agent-core-memory.md new file mode 100644 index 00000000..20293d81 --- /dev/null +++ b/docs/community/session-managers/agent-core-memory.md @@ -0,0 +1,149 @@ +# AgentCore Memory Session Manager + +{{ community_contribution_banner }} + +The [AgentCore Memory Session Manager](https://github.com/aws/bedrock-agentcore-sdk-python/tree/main/src/bedrock_agentcore/memory/integrations/strands) leverages Amazon Bedrock AgentCore Memory to provide advanced memory capabilities with intelligent retrieval for Strands Agents. It supports both short-term memory (STM) for conversation persistence and long-term memory (LTM) with multiple strategies for learning user preferences, facts, and session summaries. + +## Installation + +```bash +pip install 'bedrock-agentcore[strands-agents]' +``` + +## Usage + +### Basic Setup (Short-Term Memory) + +```python +from strands import Agent +from bedrock_agentcore.memory import MemoryClient +from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig +from bedrock_agentcore.memory.integrations.strands.session_manager import AgentCoreMemorySessionManager +from datetime import datetime + +# Create a basic memory for short-term functionality +client = MemoryClient(region_name="us-east-1") +basic_memory = client.create_memory( + name="BasicTestMemory", + description="Basic memory for testing short-term functionality" +) + +# Configure memory +agentcore_memory_config = AgentCoreMemoryConfig( + memory_id=basic_memory.get('id'), + session_id=f"session_{datetime.now().strftime('%Y%m%d%H%M%S')}", + actor_id=f"user_{datetime.now().strftime('%Y%m%d%H%M%S')}" +) + +# Create session manager +session_manager = AgentCoreMemorySessionManager( + agentcore_memory_config=agentcore_memory_config, + region_name="us-east-1" +) + +# Create agent +agent = Agent( + system_prompt="You are a helpful assistant. Use all you know about the user to provide helpful responses.", + session_manager=session_manager, +) + +# Use the agent - conversations are persisted with intelligent retrieval +agent("I like sushi with tuna") +agent("What should I buy for lunch today?") # Agent remembers preferences +``` + +### Advanced Setup (Long-Term Memory) + +For more sophisticated memory capabilities, create a memory with multiple strategies: + +```python +from bedrock_agentcore.memory.integrations.strands.config import RetrievalConfig + +# Create comprehensive memory with all built-in strategies +comprehensive_memory = client.create_memory_and_wait( + name="ComprehensiveAgentMemory", + description="Full-featured memory with all built-in strategies", + strategies=[ + { + "summaryMemoryStrategy": { + "name": "SessionSummarizer", + "namespaces": ["/summaries/{actorId}/{sessionId}"] + } + }, + { + "userPreferenceMemoryStrategy": { + "name": "PreferenceLearner", + "namespaces": ["/preferences/{actorId}"] + } + }, + { + "semanticMemoryStrategy": { + "name": "FactExtractor", + "namespaces": ["/facts/{actorId}"] + } + } + ] +) + +# Configure with multiple namespace retrieval +config = AgentCoreMemoryConfig( + memory_id=comprehensive_memory.get('id'), + session_id=f"session_{datetime.now().strftime('%Y%m%d%H%M%S')}", + actor_id=f"user_{datetime.now().strftime('%Y%m%d%H%M%S')}", + retrieval_config={ + "/preferences/{actorId}": RetrievalConfig( + top_k=5, + relevance_score=0.7 + ), + "/facts/{actorId}": RetrievalConfig( + top_k=10, + relevance_score=0.3 + ), + "/summaries/{actorId}/{sessionId}": RetrievalConfig( + top_k=5, + relevance_score=0.5 + ) + } +) + +session_manager = AgentCoreMemorySessionManager(config, region_name='us-east-1') +agent = Agent(session_manager=session_manager) +``` + +## Configuration + +### Memory Strategies + +AgentCore Memory supports three built-in strategies: + +1. **summaryMemoryStrategy**: Automatically summarizes conversation sessions for efficient context retrieval +2. **userPreferenceMemoryStrategy**: Learns and stores user preferences across sessions +3. **semanticMemoryStrategy**: Extracts and stores factual information from conversations + +### AgentCoreMemoryConfig Parameters + +- `memory_id`: ID of the Bedrock AgentCore Memory resource +- `session_id`: Unique identifier for the conversation session +- `actor_id`: Unique identifier for the user/actor +- `retrieval_config`: Dictionary mapping namespaces to RetrievalConfig objects + +### RetrievalConfig Parameters + +- `top_k`: Number of top results to retrieve (default: 5) +- `relevance_score`: Minimum relevance threshold (0.0-1.0) + +### Namespace Patterns + +- `/preferences/{actorId}`: User-specific preferences across sessions +- `/facts/{actorId}`: User-specific factual information +- `/summaries/{actorId}/{sessionId}`: Session-specific conversation summaries + +## Important Notes + +> **Session Limitations:** Currently, only **one** agent per session is supported when using AgentCoreMemorySessionManager. Creating multiple agents with the same session will show a warning. + +## Resources + +- **GitHub**: [bedrock-agentcore-sdk-python](https://github.com/aws/bedrock-agentcore-sdk-python/) +- **Documentation**: [Strands Integration Examples](https://github.com/aws/bedrock-agentcore-sdk-python/tree/main/src/bedrock_agentcore/memory/integrations/strands) +- **Issues**: Report bugs and feature requests in the [bedrock-agentcore-sdk-python repository](https://github.com/aws/bedrock-agentcore-sdk-python/issues/new/choose) diff --git a/docs/user-guide/concepts/agents/session-management.md b/docs/user-guide/concepts/agents/session-management.md index 3a26ef37..e798866b 100644 --- a/docs/user-guide/concepts/agents/session-management.md +++ b/docs/user-guide/concepts/agents/session-management.md @@ -209,6 +209,15 @@ The [`SessionMessage`](../../../api-reference/types.md#strands.types.session.Ses These data models work together to provide a complete representation of an agent's state and conversation history. The session management system handles serialization and deserialization of these models, including special handling for binary data using base64 encoding. +## Third-Party Session Managers + +The following third-party session managers extend Strands with additional storage and memory capabilities: + +| Session Manager | Provider | Description | Documentation | +|-----------------|----------|-------------|---------------| +| AgentCoreMemorySessionManager | Amazon | Advanced memory with intelligent retrieval using Amazon Bedrock AgentCore Memory. Supports both short-term memory (STM) and long-term memory (LTM) with strategies for user preferences, facts, and session summaries. | [View Documentation](../../../community/session-managers/agent-core-memory.md) | +| **Contribute Your Own** | Community | Have you built a session manager? Share it with the community! | [Learn How](../../../community/community-packages.md) | + ## Custom Session Repositories For advanced use cases, you can implement your own session storage backend by creating a custom session repository: From b8a1f6a45740a159cc9a673e75ae114e9aa6c621 Mon Sep 17 00:00:00 2001 From: Jonathan Segev Date: Mon, 13 Oct 2025 17:11:28 -0400 Subject: [PATCH 5/5] feat: add session management Community Sections --- .../{agent-core-memory.md => agentcore-memory.md} | 0 docs/user-guide/concepts/agents/session-management.md | 2 +- mkdocs.yml | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) rename docs/community/session-managers/{agent-core-memory.md => agentcore-memory.md} (100%) diff --git a/docs/community/session-managers/agent-core-memory.md b/docs/community/session-managers/agentcore-memory.md similarity index 100% rename from docs/community/session-managers/agent-core-memory.md rename to docs/community/session-managers/agentcore-memory.md diff --git a/docs/user-guide/concepts/agents/session-management.md b/docs/user-guide/concepts/agents/session-management.md index e798866b..3d1a416c 100644 --- a/docs/user-guide/concepts/agents/session-management.md +++ b/docs/user-guide/concepts/agents/session-management.md @@ -215,7 +215,7 @@ The following third-party session managers extend Strands with additional storag | Session Manager | Provider | Description | Documentation | |-----------------|----------|-------------|---------------| -| AgentCoreMemorySessionManager | Amazon | Advanced memory with intelligent retrieval using Amazon Bedrock AgentCore Memory. Supports both short-term memory (STM) and long-term memory (LTM) with strategies for user preferences, facts, and session summaries. | [View Documentation](../../../community/session-managers/agent-core-memory.md) | +| AgentCoreMemorySessionManager | Amazon | Advanced memory with intelligent retrieval using Amazon Bedrock AgentCore Memory. Supports both short-term memory (STM) and long-term memory (LTM) with strategies for user preferences, facts, and session summaries. | [View Documentation](../../../community/session-managers/agentcore-memory.md) | | **Contribute Your Own** | Community | Have you built a session manager? Share it with the community! | [Learn How](../../../community/community-packages.md) | ## Custom Session Repositories diff --git a/mkdocs.yml b/mkdocs.yml index d365518e..82a1c996 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -157,6 +157,8 @@ nav: - Cohere: community/model-providers/cohere.md - CLOVA Studio: community/model-providers/clova-studio.md - Fireworks AI: community/model-providers/fireworksai.md + - Session Managers: + - Amazon AgentCore Memory: community/session-managers/agentcore-memory.md - Contribute ❤️: https://github.com/strands-agents/sdk-python/blob/main/CONTRIBUTING.md - API Reference: