Lesson 14: Deploying Agents to the Cloud
Code for this lesson: samples/14-deploy
From Local to Production
Section titled “From Local to Production”Everything so far has run on a local machine. A Strands agent is just Python, so you can containerize it and run it anywhere. This lesson deploys it to AWS using Amazon Bedrock AgentCore: Runtime for isolated execution, Memory for persistent and long-term recall, and Observability for automatic tracing.

Making Your Agent Deployable
Section titled “Making Your Agent Deployable”Wrap the agent in a BedrockAgentCoreApp and give it an entrypoint. The agent itself doesn’t change; the customer service agent below is the same one built across the previous lessons, with an AgentCore Memory session manager swapped in for persistence:
from strands import Agentfrom bedrock_agentcore.runtime import BedrockAgentCoreAppfrom bedrock_agentcore.memory.integrations.strands.config import ( AgentCoreMemoryConfig, RetrievalConfig)from bedrock_agentcore.memory.integrations.strands.session_manager import ( AgentCoreMemorySessionManager)
app = BedrockAgentCoreApp()
MEMORY_ID = os.environ.get("BEDROCK_AGENTCORE_MEMORY_ID", "")
def create_agent(actor_id: str, session_id: str): # AgentCore Memory for persistence + long-term recall session_manager = None if MEMORY_ID: config = AgentCoreMemoryConfig( memory_id=MEMORY_ID, session_id=session_id, actor_id=actor_id, retrieval_config={ "/users/{actorId}/facts": RetrievalConfig(), "/users/{actorId}/preferences": RetrievalConfig(), }, ) session_manager = AgentCoreMemorySessionManager( agentcore_memory_config=config, region_name="us-east-1", )
return Agent( tools=[lookup_customer, get_order_history, process_refund], plugins=[AgentSkills(skills=["./skills"]), RefundWorkflowHandler(), tone_handler], system_prompt=SYSTEM_PROMPT, context_manager="auto", session_manager=session_manager, )📂 main.py · lambda-deployment/ (alternative: AWS Lambda)
The retrieval_config namespaces tell AgentCore Memory which long-term memory strategies to pull from on each turn, so the agent recalls facts and preferences about a returning user without replaying old conversations.
Deployment Commands
Section titled “Deployment Commands”# Install CLInpm install -g @aws/agentcore
# Scaffold projectagentcore create
# Add memoryagentcore add memory --name CustomerServiceMemory --strategies SEMANTIC,USER_PREFERENCE
# Deployagentcore deploy
# InvokeSESSION_ID="<SESSION ID HERE>"agentcore invoke --session-id "$SESSION_ID" \ '{"prompt": "I need help returning my order", "actor_id": "sarah"}'What AgentCore Provides
Section titled “What AgentCore Provides”| Component | What It Does |
|---|---|
| Runtime | Isolated microVMs, maintains state across requests |
| Memory | Conversation persistence + semantic long-term recall |
| Observability | Automatic traces, logs, execution telemetry |
| Gateway | Expose APIs as MCP-compatible tools |
| Identity | IAM or OAuth authentication gate |
AgentCore has more capabilities beyond these. See the AgentCore developer guide for the full picture.
What You Still Need
Section titled “What You Still Need”The deployed agent is only part of a production architecture. You still need API gateways, rate limiting, retries, security controls, monitoring, and error handling around it. The surrounding architecture matters as much as the agent.