AWS Builder Center
Bring AI agents into production in minutes - Runtime

Bring AI agents into production in minutes - Runtime

Deploy production-ready agents in 15 minutes vs. traditional 3-week setups. No Docker, Kubernetes, or DevOps expertise needed. Simply use 2 commands, for serverless auto-scaling deployment. The tutorial demonstrates building a calculator agent using Strands Agents with Claude (Anthropic) as the model provider, managing API keys securely through AgentCore Identity, and achieving full production deployment with built-in monitoring and session management.

Developer Advocate/SDE, GenAI

🔗 Complete AgentCore Series

Master production AI agents with this series:

🤯 The Production Deployment Problem Every Developer Faces

You've built an incredible AI agent. It works well on your laptop.
Now you need to deploy it to production.
Here's what usually happens:
  • 3 weeks setting up infrastructure ⏰
  • Docker and Kubernetes nightmares 🐳
  • Security configurations that make you cry 🔐
  • Scaling policies you barely understand 📈
  • Session management... what even is that? 🤷
Sound familiar?
 Amazon Bedrock AgentCore  changes everything. Deploy production-ready AI agents with just 2 commands. No DevOps degree required. No infrastructure headaches.
This hands-on tutorial shows you exactly how - from local testing to production endpoint in under 15 minutes.
This tutorial is based on Mike Chambers' blog:  Turn Your AI Script into a Production-Ready Agent , Thanks Mike :)

🎯 What You'll Build

  • ✅ A calculator AI agent with  Strands Agents  and Claude as the model provider
  • ✅ Secure APIKey management with AgentCore Identity
  • ✅ Auto-scaling production deployment
  • ✅ Session-aware conversations
  • ✅ Full monitoring and observability


AgentCore Services Overview

Service
Purpose
Key Features
⭐
 AgentCore Runtime 
Serverless execution
Auto-scaling, Session management, Container orchestration
⭐
 AgentCore Identity 
Credential management
API keys, OAuth tokens, Secure vault
 AgentCore Memory 
State persistence
Short-term memory, Long-term storage
 AgentCore Code Interpreter 
Code execution
Secure sandbox, Data analysis
 AgentCore Browser 
Web interaction
Cloud browser, Auto-scaling
 AgentCore Gateway 
API management
Tool discovery, Service integration
 AgentCore Observability 
Monitoring
Tracing, Dashboards, Debugging
⭐ Used in this tutorial: Runtime and Identity services handle deployment and credential management.


Prerequisites

Before you begin, verify that you have:
New AWS customers receive up to $200 in credits Start at no cost with AWS Free Tier. Get $100 USD at sign-up plus $100 USD more exploring key services.

Let's turn your prototype into production. 🚀

Tutorial Roadmap:
  1. Setup ⚙️ → 2. Code Agent 💻 → 3. Test Locally ✅ → 4. Deploy 🚀 → 5. Invoke ⚡
Estimated time: 15 minutes

Create IAM User

Create an AWS IAM user and attach the  BedrockAgentCoreFullAccess  managed policy.


Configure AgentCore Identity

Create credential providers through the AgentCore console Identity menu. Store your  Claude API key  securely using AgentCore Identity's encrypted vault.

AgentCore Identity provides comprehensive credential management with secure storage, OAuth support, and access control across multiple authentication systems.


Install Dependencies

python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
Required packages:
  •  bedrock-agentcore  - AgentCore SDK
  •  strands-agents  - Agent framework
  •  bedrock-agentcore-starter-toolkit  - Deployment toolkit
  •  strands-agents-tools  - Calculator functionality

Agent Implementation

AgentCore Entry Point

The  @app.entrypoint  decorator makes your agent deployable:
@app.entrypoint
def invoke(payload, context):
"""AgentCore Runtime entry point"""
agent = create_agent(calculator)
prompt = payload.get("prompt", "Hello!")
result = agent(prompt)
return {
"response": result.message.get('content', [{}])[0].get('text', str(result))
}

Secure Credential Management

@requires_api_key(provider_name="ClaudeAPIKeys")
async def retrieve_api_key(*, api_key: str):
os.environ["CLAUDE_APIKEY"] = api_key
AgentCore Identity retrieves API keys securely without exposing credentials in your code.

Model Configuration

def create_model():
return AnthropicModel(
client_args={"api_key": os.environ["CLAUDE_APIKEY"]},
max_tokens=4000,
model_id="claude-3-5-haiku-20241022",
params={"temperature": 0.3}
)

Performance Optimization

Initialize agents once per session to preserve state and reduce latency:
agent = None
def create_agent(tools):
global agent
if agent is None:
agent = Agent(
model=create_model(),
tools=[tools],
system_prompt="You are a helpful assistant that can perform calculations. Use the calculate tool for any math problems."
)
return agent
AgentCore provides session isolation in dedicated containers that run up to 8 hours.

Test Locally

Start your agent:
python3 my_agent.py
Test functionality:
curl -X POST http://localhost:8080/invocations \
-H "Content-Type: application/json" \
-d '{"prompt": "What is 50 plus 30?"}'

Deploy to Production

Deploy with two commands:

Configure Agent

agentcore configure -e my_agent.py
Provide your IAM role ARN when prompted.


Launch to Production

agentcore launch

AgentCore automatically:
  • Creates runtime environment
  • Sets up auto-scaling
  • Configures security
  • Provides production endpoint

Verify Deployment

agentcore status
View agent status, endpoint information, and observability dashboards.

You can also monitor deployment progress in the AgentCore console:


Invoke Your Agent

Terminal Testing

agentcore invoke '{"prompt": "What is 50 plus 30?"}' --session-id session-123 --user-id user-456
agentcore invoke '{"prompt": "Now multiply that result by 2"}' --session-id session-123 --user-id user-456

Production Integration

Use AWS SDK for application integration:
import boto3
import json

client = boto3.client('bedrock-agentcore-runtime', region_name='us-west-2')
agent_arn = "arn:aws:bedrock-agentcore:us-west-2:123456789012:runtime/your-agent-name"

response = client.invoke_agent_runtime(
agentRuntimeArn=agent_arn,
sessionId="production_session_2024_user456",
inputText="What is 25 * 4 + 10?"
)

result = json.loads(response['body'].read())
print(result['response'])
Production Requirements:
  • Get Agent ARN from  agentcore status 
  • Session IDs must be 33+ characters
  • Uses AWS credentials for authentication

Why AgentCore vs Traditional Deployment?

Traditional Deployment
AgentCore Deployment
❌ 3 weeks
✅ 15 minutes
❌ Docker + K8s
✅ Serverless
❌ Manual scaling
✅ Auto-scaling
❌ Complex security
✅ Built-in security
❌ DevOps expertise
✅ 2 commands

Clean Up

Remove all resources:
agentcore destroy
This removes AgentCore deployment, ECR repository, IAM roles, and CloudWatch logs.

🔗 Complete AgentCore Series

Master production AI agents with this series:

🎉 You Just Deployed Your First Production AI Agent!

Now comes the fun part: What will you build? 🚀

💡 Taking It Further

I've been building various AI agents with Strands Agents - from multimodal content processing to multi-agent systems. Now I'm taking them all to production with AgentCore.
If you're curious about what's possible, check out some of the agents I've built:

🎨 Multimodal AI Agents

Process images, videos, and text together:

🤝 Multi-Agent Systems

Agents working together:

🧠 RAG and Memory

Make agents remember and learn:
Next up: I'll be showing how to deploy these advanced agents to production with AgentCore.



❤️ If This Helped You

  • ❤️ Heart it - helps others discover this tutorial
  • 🔖 Bookmark it - for when you need it later
  • 📤 Share it - with your team or on social media



📚 Resources

AgentCore:
AWS Free Tier:
My Other Tutorials:


Happy building! 🚀
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article