Published Date : 05/11/2025
Amazon Bedrock AgentCore is an advanced platform for building, deploying, and operating effective agents securely at scale. Amazon Bedrock AgentCore Runtime, a fully managed service, provides low-latency serverless environments to deploy agents and tools. It ensures session isolation, supports multiple agent frameworks, including popular open-source frameworks, and handles multimodal workloads and long-running agents.
With the container deployment method, developers must create a Dockerfile, build ARM-compatible containers, manage ECR repositories, and upload containers for code changes. This method works well where container DevOps pipelines have already been established to automate deployments. However, it can be time-consuming and complex, especially for developers who prefer not to worry about Docker expertise and container infrastructure when deploying agents.
To address these challenges, Amazon Bedrock AgentCore Runtime introduces direct code deployment, a method that significantly improves developer time and productivity. With direct code deployment, developers create a zip archive of their code and dependencies, upload it to Amazon S3, and configure the bucket in the agent configuration. The AgentCore starter toolkit simplifies this process by handling dependency detection, packaging, and upload, providing a much-simplified developer experience. Direct code deployment is also supported using the API.
How to Use Direct Code Deployment
To illustrate how direct code deployment works, we'll use an agent created with the Strands Agents SDK and the AgentCore starter-toolkit to deploy the agent.
Prerequisites
Before you begin, ensure you have the following:
- Any of the versions of Python 3.10 to 3.13
- Your preferred package manager installed (e.g., uv package manager)
- AWS account for creating and deploying agents
- Amazon Bedrock model access to Anthropic Claude Sonnet 4.0
Step 1: Initialize Your Project
Set up a new Python project using the uv package manager, then navigate into the project directory:
```
uv init <project> --python 3.13
cd <project>
```
Step 2: Add the Dependencies for the Project
Install the required Bedrock AgentCore libraries and development tools for your project. In this example, dependencies are added using a `.toml` file, but they can also be specified in a `requirements.txt` file:
```
uv add bedrock-agentcore strands-agents strands-agents-tools
uv add --dev bedrock-agentcore-starter-toolkit
source .venv/bin/activate
```
Step 3: Create an agent.py File
Create the main agent implementation file that defines your AI agent’s behavior:
```python
from bedrock_agentcore import BedrockAgentCoreApp
from strands import Agent, tool
from strands_tools import calculator
from strands.models import BedrockModel
import logging
app = BedrockAgentCoreApp(debug=True)
Logging setup
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
Create a custom tool
@tool
def weather():
Q: What is Amazon Bedrock AgentCore?
A: Amazon Bedrock AgentCore is an agentic platform for building, deploying, and operating effective agents securely at scale. It provides a fully managed service with low-latency serverless environments for deploying agents and tools.
Q: What is the difference between container-based deployment and direct code deployment?
A: Container-based deployment uses Docker and ECR, requiring Docker expertise and infrastructure. Direct code deployment involves creating a zip archive of code and dependencies, uploading it to S3, and configuring the bucket in the agent configuration, making it simpler and faster.
Q: What are the benefits of direct code deployment?
A: Direct code deployment is simpler, faster, and requires no Docker or container infrastructure. It is ideal for rapid prototyping and development with Python 3.10-3.13 and common frameworks.
Q: When should I use container-based deployment?
A: Use container-based deployment when your package exceeds 250MB, you have existing container CI/CD pipelines, or you need highly specialized dependencies and custom packaging requirements.
Q: What languages are supported by direct code deployment?
A: Direct code deployment currently supports Python 3.10, 3.11, 3.12, and 3.13. For other languages, consider container-based deployment.