Guide to Integrate AWS Strands Agent with AgentCore Runtime using SDK Integration
Source: Dev.to
Prerequisites
There are two deployment approaches with AgentCore:
- SDK Integration – with automatic HTTP setup and built‑in deployment options.
- Custom – manual configuration.
SDK Integration
Use the SDK to integrate the AWS Strands Agent with the AgentCore runtime.
Installation
pip install bedrock-agentcore
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()
Test the Agent
Run the script locally:
python my_agent.py
Test the endpoint with curl:
curl -X POST http://localhost:8080/invocations \
-H "Content-Type: application/json" \
-d '{"prompt": "Hello world!"}'
Choose Your Deployment Method
Using StarterToolkit (Method 1 – Quick Prototyping)
Directory layout:
your_project_directory/
│ __init__.py # Makes the directory a Python package
│ requirements.txt
Note: The
agentcore launch --localcommand requires a container engine (Docker, Finch, or Podman) for local testing. This step is optional; you can skip directly toagentcore launchfor AWS deployment if local testing isn’t needed.
Using Boto3 (Method 2 – Manual Deployment)
For more control over the deployment process:
- Package your code as a container image.
- Push the image to Amazon Elastic Container Registry (ECR).
- Deploy using Boto3 scripts or AWS SDK calls.