Cloud Computing 11 min read

How Direct Code Deployment with AgentCore Runtime Accelerates Agent Development

This article compares Amazon Bedrock AgentCore's container‑based and direct‑code deployment options, walks through a step‑by‑step Python example of the zip‑deployment workflow, and shows how the latter can cut iteration time from 30 seconds to about 10 seconds while simplifying setup.

Amazon Cloud Developers
Amazon Cloud Developers
Amazon Cloud Developers
How Direct Code Deployment with AgentCore Runtime Accelerates Agent Development

Amazon Bedrock AgentCore Runtime – Direct Code Deployment

AgentCore Runtime is a fully managed serverless environment for deploying AI agents. It supports session isolation, multimodal workloads and long‑running agents.

Deployment options

Container‑based : Dockerfile → ARM‑compatible image → Amazon ECR → AgentCore Runtime.

Direct code deployment (Python only) : Package code and dependencies into a zip, upload to Amazon S3, configure entry point, launch.

Prerequisites

Python 3.10–3.13

Package manager (example uses uv)

AWS account with access to Amazon Bedrock and Anthropic Claude Sonnet 4.0 model

Step‑by‑step direct deployment

Step 1 – Initialise project

uv init <project> --python 3.13
cd <project>

Step 2 – Add dependencies

uv add bedrock-agentcore strands-agents strands-agents-tools
uv add --dev bedrock-agentcore-starter-toolkit
source .venv/bin/activate

Step 3 – Create agent.py

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.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

@tool
def weather():
    """Get weather"""
    return "sunny"

model_id = "us.anthropic.claude-sonnet-4-20250514-v1:0"
model = BedrockModel(model_id=model_id)

agent = Agent(
    model=model,
    tools=[calculator, weather],
    system_prompt="You're a helpful assistant. You can do simple math calculation, and tell the weather."
)

@app.entrypoint
def invoke(payload):
    """Your AI agent function"""
    user_input = payload.get("prompt", "Hello! How can I help you today?")
    logger.info("
 User input: %s", user_input)
    response = agent(user_input)
    logger.info("
 Agent result: %s ", response.message)
    return response.message['content'][0]['text']

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

Step 4 – Configure and launch

agentcore configure --entrypoint agent.py --name <my-agent>
agentcore launch

The configure command creates a zip package, uploads it to the specified S3 bucket and registers the entry point. launch starts the agent in the runtime.

Step 5 – Invoke

agentcore invoke '{"prompt":"How is the weather today?"}'

First deployment takes ~30 seconds. Subsequent updates take ~10 seconds, roughly half the time of container‑based updates.

Comparison of deployment approaches

Process : Direct deployment avoids Docker, ECR and CodeBuild; uses only S3 and the runtime.

Deployment time : First deployment similar; updates ≈30 s (container) vs ≈10 s (direct).

Artifact storage : Direct – zip in S3 (standard S3 fees). Container – image in ECR (ECR fees).

Customization : Direct – custom Python dependencies via zip. Container – customization via Dockerfile.

Package size limit : Direct ≤ 250 MB. Container ≤ 2 GB.

Supported languages : Direct – Python 3.10‑3.13. Container – multiple runtimes.

Guidelines for choosing a method

Use container deployment when the package exceeds 250 MB, when an existing container CI/CD pipeline is in place, or when system‑level customizations are required.

Use direct code deployment for Python agents ≤ 250 MB, when rapid prototyping and fast iteration are priorities, and when avoiding Docker/ECR/CodeBuild simplifies the workflow.

Hybrid approach: start with direct deployment for experiments, switch to containers for production workloads that need larger packages or broader language support.

Reference

Amazon Bedrock AgentCore Runtime direct code deployment documentation: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-get-started-code-deploy.html

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

serverlessPythoncontainer deploymentAmazon BedrockAgentCore Runtimedirect deployment
Amazon Cloud Developers
Written by

Amazon Cloud Developers

Official technical community of Amazon Cloud. Shares practical AI/ML, big data, database, modern app development, IoT content, offers comprehensive learning resources, hosts regular developer events, and continuously empowers developers.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.