Building Intelligent Multi-Agent Systems with AWS Strands SDK and Amazon Bedrock AgentCore
Building Intelligent Multi-Agent Systems with AWS Strands SDK and Amazon Bedrock AgentCore
Building Intelligent Multi-Agent Systems with AWS Strands SDK and Amazon Bedrock AgentCore
🎯 Problem & Solution
The Challenge
Modern AI applications face several critical challenges:
- Limited Contextual Memory: Traditional chatbots forget previous interactions, leading to repetitive conversations
- Single-Purpose Agents: Most AI systems can't coordinate multiple specialized tasks effectively
- Lack of External Integration: AI agents struggle to interact with real-world APIs, databases, and services
- Scalability Issues: Deploying and managing AI agents in production environments is complex and resource-intensive
- Tool Extension Limitations: Adding new capabilities to AI agents requires extensive coding and deployment cycles
Our Solution: Multi-Agent Framework with Strands SDK & AgentCore
We've developed a comprehensive multi-agent framework that solves these challenges through:
Intelligent Agent Orchestration: A teacher assistant agent that routes queries to specialized sub-agents (Math, English, Computer Science, Language, General Knowledge) based on natural language understanding.
Persistent Memory: Integration with mem0 and Amazon Bedrock AgentCore Memory for conversation history and user preferences across sessions.
Dynamic Tool Creation: Meta-tooling capabilities that allow agents to create new tools at runtime based on natural language descriptions.
External API Integration: Seamless connection to weather services, knowledge bases, web search engines (Tavily, Exa), and AWS services.
Production-Ready Deployment: Container-based deployment on Amazon Bedrock AgentCore with observability, identity management, and auto-scaling.
Who Benefits?
- Educational Institutions: Personalized tutoring across multiple subjects with memory of student progress
- Enterprise Organizations: Automated research, fact-checking, and report generation workflows
- Developers: Reusable framework for building complex agentic applications quickly
- End Users: More natural, contextual, and intelligent AI interactions
⚙️ Technical Implementation
Architecture Overview
AWS Services Used and Why
1. Amazon Bedrock - Foundation Model Layer
Purpose: Powers all AI agents with state-of-the-art LLMs
- Models Used:
-
us.amazon.nova-pro-v1:0: Primary model for complex reasoning and orchestration
-
us.amazon.nova-lite-v1:0: Lightweight model for research and analysis tasks
-
us.anthropic.claude-3-5-haiku-20241022-v1:0: Fast responses for calculator operations
-
us.anthropic.claude-3-5-sonnet-20241022-v2:0: Advanced reasoning for complex queries
Why: Bedrock provides managed access to multiple foundation models without infrastructure management, with built-in security and compliance.
Python
# Example Bedrock Model Configurationfrom strands.models import BedrockModelbedrock_model = BedrockModel(model_id="us.amazon.nova-pro-v1:0",temperature=0.3, # Balanced creativity and consistency)
2. Amazon Bedrock AgentCore Runtime - Container-Based Agent Hosting
Purpose: Production deployment of agents in scalable, managed containers
- Automatic scaling based on demand
- Built-in health monitoring
- HTTP/HTTPS protocol support
- Public and VPC network configurations
Why: Eliminates infrastructure management while providing enterprise-grade reliability.
Python
# Deployment Configurationagentcore_runtime.deploy(agent_name="strands_claude_remote",entry_point="strands_claude_remote.py",platform="linux/arm64",network_mode="PUBLIC",observability_enabled=True)
3. Amazon Bedrock AgentCore Memory - Persistent Conversation Memory
Purpose: Store and retrieve conversation history across sessions
- Short-term memory (STM) for immediate context
- Long-term memory (LTM) for user preferences and historical data
- Automatic memory expiry (configurable, e.g., 30 days)
Why: Enables personalized, context-aware interactions without managing databases.
Python
# AgentCore Memory Integrationfrom strands_tools.agent_core_memory import AgentCoreMemoryToolProvidermemory_provider = AgentCoreMemoryToolProvider(memory_id="memory-123abc4567",actor_id="user_123",session_id="session-789",namespace="default",region="us-west-2")
4. Amazon OpenSearch Service - Vector Database for Knowledge Bases
Purpose: Store and retrieve domain-specific knowledge using semantic search
- Vector embeddings for similarity search
- Fast retrieval of relevant information
- Scalable for millions of documents
Why: Powers the knowledge base agent with efficient semantic search capabilities.
5. Amazon S3 - Session Management and Storage
Purpose: Persist agent state and conversation history
- Store session data for multi-turn conversations
- Enable conversation continuity across restarts
- Cost-effective long-term storage
Python
# S3 Session Managementfrom strands.session.s3_session_manager import S3SessionManagersession_manager = S3SessionManager(bucket_name="strands-sessions",customer_id="customer_001")
6. Amazon Cognito - Identity and Access Management
Purpose: Secure agent invocations with JWT-based authentication
- User pool management
- OAuth 2.0 flows
- Resource server integration
Why: Enterprise-grade authentication for production deployments.
Python
# Cognito Authentication Flowdef get_cognito_token(user_pool_id, client_id, client_secret, scope):cognito_client = boto3.client('cognito-idp')response = cognito_client.initiate_auth(ClientId=client_id,AuthFlow='CLIENT_CREDENTIALS',AuthParameters={'SECRET_HASH': secret_hash})return response['AuthenticationResult']['AccessToken']
7. Amazon ECR - Container Registry
Purpose: Store and version control Docker images for agents
- Automatic image creation during deployment
- Vulnerability scanning
- Image lifecycle policies
8. AWS CloudWatch - Observability and Monitoring
Purpose: Track agent performance, errors, and usage metrics
- OpenTelemetry integration for distributed tracing
- Custom metrics for agent invocations
- Log aggregation for debugging
Python
# OpenTelemetry Tracing Integrationfrom opentelemetry import tracefrom opentelemetry.sdk.trace import TracerProviderfrom opentelemetry.sdk.trace.export import BatchSpanProcessorfrom opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExportertracer_provider = TracerProvider()otlp_exporter = OTLPSpanExporter(endpoint="https://cloudwatch-endpoint/v1/traces")tracer_provider.add_span_processor(BatchSpanProcessor(otlp_exporter))
9. Amazon Bedrock AgentCore Gateway - API Gateway Integration
Purpose: Expose agents as REST APIs with authentication
- Lambda function integration
- API key management
- Rate limiting and throttling
Why: Enables seamless integration with existing applications and microservices.
10. Amazon Bedrock AgentCore Code Interpreter - Dynamic Code Execution
Purpose: Execute Python code safely in sandboxed environments
- Data analysis and visualization
- Mathematical computations
- File processing
11. Amazon Bedrock AgentCore Browser - Web Automation
Purpose: Interact with web pages and perform browser-based tasks
- Form filling and submission
- Web scraping
- Automated testing
System Workflow
1. Model Context Protocol (MCP) Integration
MCP allows agents to communicate with external tools through a standardized protocol:
Python
# MCP Server Example - Calculator Toolfrom mcp.server import Serverfrom mcp.server.stdio import stdio_serverimport mcp.types as typesserver = Server("calculator")@server.list_tools()async def list_tools() -> list[types.Tool]:return [types.Tool(name="calculate",description="Perform mathematical calculations",inputSchema={"type": "object","properties": {"expression": {"type": "string"}},"required": ["expression"]})]@server.call_tool()async def call_tool(name: str, arguments: dict) -> str:if name == "calculate":return str(eval(arguments["expression"]))
2. Multi-Agent Orchestration
The teacher assistant agent routes queries to specialized agents:
Python
# Teacher Assistant Orchestratorfrom strands import Agent, toolfrom strands_tools import use_agent# Specialized agent tools@tooldef math_assistant(query: str) -> str:"""Process math-related queries using calculator tool"""formatted_query = f"Solve this math problem: {query}"math_agent = Agent(system_prompt="You are a math expert with calculator capabilities.",tools=[calculator],)return math_agent(formatted_query)@tooldef computer_science_assistant(query: str) -> str:"""Handle programming and CS queries"""cs_agent = Agent(system_prompt="You are a computer science expert.",tools=[code_interpreter, editor, file_read, file_write],)return cs_agent(query)# Main orchestratorteacher_agent = Agent(system_prompt=ORCHESTRATOR_PROMPT,tools=[math_assistant,english_assistant,language_assistant,computer_science_assistant,general_assistant])# Query routingresponse = teacher_agent("What is the derivative of x^2?")# Routes to math_assistant automatically
3. Workflow Orchestration
Multi-step workflows for complex tasks:
Python
# Research Workflow: Researcher → Analyst → Writerdef run_research_workflow(user_input):# Step 1: Research Agentresearcher = Agent(system_prompt="Gather web information using tools",tools=[http_request, retrieve])research_data = researcher(user_input)# Step 2: Analyst Agentanalyst = Agent(system_prompt="Verify facts and synthesize findings")analysis = analyst(f"Analyze this research: {research_data}")# Step 3: Writer Agentwriter = Agent(system_prompt="Create a comprehensive report")final_report = writer(f"Write a report based on: {analysis}")return final_report
4. Memory-Enabled Agents
Persistent memory across sessions:
Python
from strands_tools import mem0_memorymemory_agent = Agent(system_prompt="You remember user preferences and history",tools=[mem0_memory])# Store informationmemory_agent("Remember that I prefer Python over JavaScript")# Later session - retrieves memory automaticallyresponse = memory_agent("What programming language should I use?")# Response: "Based on your preference, I recommend Python..."
5. Meta-Tooling - Dynamic Tool Creation
Agents can create new tools at runtime:
Python
from strands_tools import meta_toolingmeta_agent = Agent(system_prompt="You can create tools dynamically",tools=[meta_tooling])# Create a custom tool through natural languageresponse = meta_agent("Create a tool that converts temperatures from Celsius to Fahrenheit")# Agent generates and loads the tool automatically# Use the newly created tooltemp_response = meta_agent("Convert 25°C to Fahrenheit")# Response: "25°C is 77°F"
📈 Scaling Strategy
Current Capacity
Development Environment:
- Local testing with Python 3.10+
- Virtual environment isolation
- Docker containers for consistency
- 7 specialized modules + 8 AgentCore sub-modules
Production Deployment:
- Amazon Bedrock AgentCore Runtime
- Auto-scaling containers (linux/arm64 and linux/amd64)
- Network modes: PUBLIC and VPC
- Observability: OpenTelemetry + CloudWatch
- Memory: 30-day retention with auto-expiry
Current Performance Metrics:
- Response Time: 2-5 seconds for simple queries
- Concurrent Sessions: Unlimited (serverless architecture)
- Memory Storage: Unlimited with AgentCore Memory/S3
- API Throughput: Configurable with API Gateway throttling
Scaling Strategies
Horizontal Scaling:
YAML
# AgentCore Configurationruntime_configuration:min_instances: 2max_instances: 100auto_scaling:target_utilization: 70%scale_up_cooldown: 60sscale_down_cooldown: 300s
Cost Optimization:
- Use Amazon Bedrock Nova Lite for research tasks (lower cost)
- Use Amazon Bedrock Nova Pro for complex reasoning
- Implement caching for frequent queries
- S3 Intelligent-Tiering for session storage
Performance Optimization:
- Parallel agent execution for independent sub-tasks
- Response streaming for real-time feedback
- Connection pooling for database queries
- CDN for static assets (Streamlit UI)
Monitoring & Observability:
Python
# Custom Metricscloudwatch.put_metric_data(Namespace='StrandsAgents',MetricData=[{'MetricName': 'AgentInvocationCount','Value': 1,'Unit': 'Count','Dimensions': [{'Name': 'AgentType', 'Value': 'teacher_assistant'},{'Name': 'Model', 'Value': 'nova-pro-v1'}]}])
📸 Visual Documentation, Code & Resources
Architecture Diagram
Key Feature Screenshots & Demo Visuals
1. Creating a Basic Agent

Demo:

2. Multi-Agent Orchestration

3. Workflow with Multiple Agents

4. Memory-Enabled Agent
AgentCore Memory provides state persistence. It is divided into two distinct implementation types based on retention and processing needs.
Type A: Short-Term Memory
Used for immediate conversation context within a session.
- Function: Stores raw conversation events (User says X, Agent replies Y).
- Behavior: Synchronous storage. Ensures the agent knows what was just said.
- Lifecycle: Data expires automatically based on a configurable TTL (e.g., 24 hours).
(Reference: 8.5.1 Short-Term Memory)
Type B: Long-Term Memory
Used for retaining knowledge across different sessions (e.g., "User is a vegetarian"). This involves asynchronous background processing.
- Strategies: You must configure a specific Memory Strategy to tell the system how to remember data.
- Semantic Memory Strategy: Extracts factual information and stores it as vector embeddings for search.
- Use Case: Remembering facts, product details, or specific user statements.
- User Preference Strategy: Specifically listens for likes, dislikes, and settings.
- Use Case: "I prefer Python over Java" or "I am allergic to peanuts."
- Summary Strategy: Compresses long conversations into summaries.
- Use Case: Recap previous interactions when starting a new session.
(Reference: 8.5.2 Long-Term Memory)


5. Streamlit UI Dashboard
As described in the architecture, a Streamlit application often serves as the user interface (UI) layer for AgentCore agents. This integration allows users to chat with agents that are running on the backend.
Architecture Pattern
- Frontend (Streamlit): Handles user input, displays chat history, and manages session state.
- Backend (AgentCore): The Streamlit app acts as a client that invokes either the AgentCore Runtime (where the agent logic lives) or the AgentCore Gateway (to access specific tools).

6. Deploying to AgentCore
Deployment in AgentCore involves two distinct workflows: one for the Agent Runtime (where your agent code lives) and one for the Gateway (where your tools live).

6.1 Deploying the Agent Runtime (The "Brain")
This process packages your agent code (using the Strands SDK) into a container and deploys it to the managed AgentCore cloud runtime.
- Prerequisites: AWS CLI configured, Python installed, Docker (or Finch/Podman) running locally.
- Step 1: Configure: Run the configuration command to generate the
Dockerfileand.bedrock_agentcore.yamlsettings. This step will prompt you to create an ECR repository and select your requirements file.
- Step 2: Launch: Build the image locally, push it to ECR, and deploy the service.
- Step 3: Invoke: Test the deployed agent directly from the CLI before connecting a UI.


5.2 Deploying the Gateway (The "Tools")
Deploying the Gateway is typically done via infrastructure-as-code scripts provided in the SDK, as it involves coordinating multiple AWS resources (Cognito, Lambda, IAM).
- Automated Script Workflow: Use the provided
create_agentcore_gateway.pyutility scripts to orchestrate the deployment.
- Resources Created:
- Lambda Function: Deploys your business logic code.
- IAM Role: Creates an execution role for the Gateway.
- Cognito User Pool: Sets up the authentication provider for Inbound Auth.
- AgentCore Gateway: The actual MCP server endpoint.
- Gateway Target: The binding between the Gateway and the Lambda.
- Output: The script returns a
GATEWAY_URL(e.g.,https://<id>.gateway.bedrock-agentcore.us-west-2.amazonaws.com/mcp). This URL is what you plug into your Agent Runtime or Client configuration.
**

GitHub Repository
🎯 Conclusion
This multi-agent framework demonstrates the power of combining AWS Strands SDK with Amazon Bedrock AgentCore to build production-ready agentic AI applications. By leveraging specialized agents, persistent memory, dynamic tool creation, and seamless AWS integration, we've created a scalable solution that solves real-world problems across education, enterprise research, and intelligent automation.
Key Achievements: ✅ 7 functional agent modules covering diverse use cases ✅ Integration with 10+ AWS services ✅ Production deployment on AgentCore with observability ✅ Persistent memory across sessions ✅ Dynamic tool creation capabilities ✅ Multi-agent workflow orchestration
Tags: #AI #AgenticAI #AWS #Bedrock #MultiAgent #MachineLearning #Python #Strands #AgentCore
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article