Guide to Integrate AWS Strands Agent with AgentCore Runtime using SDK Integration

Prerequisites
Python 3.10+
AWS account with appropriate permissions
Optional: A container engine (Docker, Finch, or Podman) – only required for local testing and advanced deployment scenarios

There are 2 deployment approaches with AgentCore

SDK Integration
For simple agents and minimal functions which can use quick deploy

with Automatic HTTP setup and built in deployment options.

Custom
For Complex agents, custom middleware, production systems with full
control over HTTP but more setup required, manual server
configuration

SDK Integration
**1. Install and import the package

pip install bedrock-agentcore

2. Create the Agent

from bedrock_agentcore.runtime import BedrockAgentCoreApp
from strands import Agent

app = BedrockAgentCoreApp()
agent = Agent()

@app.entrypoint
def invoke(payload):
    """Process user input and return a response"""
    user_message = payload.get("prompt", "Hello")
    result = agent(user_message)
    return {"result": result.message}

if __name__ == "__main__":
    app.run()

3. Test the Agent

python my_agent.py

# Test with curl:
curl -X POST http://localhost:8080/invocations 
-H "Content-Type: application/json" 
-d '{"prompt": "Hello world!"}'
  1. Choose Your Deployment Method
    1. Using StarterToolkit
    2. Using Boto3

Method 1: Starter Toolkit (For quick prototyping)

Starter Toolkit

your_project_directory/
├── agent_example.py # Your main agent code
├── requirements.txt # Dependencies for your agent
└── init.py # Makes the directory a Python package

Simple AI Agent

Requirements.txt
strands-agents
bedrock-agentcore

Note: The agentcore launch –local command requires a container engine (Docker, Finch, or Podman) for local deployment testing. This step is optional – you can skip directly to agentcore launch for AWS deployment if you don’t need local testing.

Method 2: Manual Deployment with boto3

For more control over the deployment process:

Package your code as a container image and push it to ECR
Create your agent using CreateAgentRuntime:

Leave a Reply