
Bedrock AgentCore Runtime Quietly Has Two Deployment Models, and I Didn't Notice Until I Compared Four Agents
Bedrock AgentCore Runtime is sold as one serverless way to run an agent. Running four of my own agents on it, I found two distinct deployment paths underneath, one with a Dockerfile and one without, and the numbers behind when each one actually applies.
I have four AI agents running on Amazon Bedrock AgentCore Runtime right now: a Minecraft bot that plays the game through natural language, a payment agent that can spend real money with human approval, a debate simulator that pits language models against each other, and a fact-checker that flags exaggerated claims in social posts. I built them separately, over a few months, mostly copying whatever config worked last time. It was only when I lined up all four
.bedrock_agentcore.yaml files side by side that I noticed something I had glossed over every single time: three of them ship a Dockerfile, and one of them does not.AgentCore Runtime is usually introduced as a single thing, a serverless place to run an agent so you stop worrying about servers. That framing is accurate but incomplete. Underneath, the toolkit picks between two genuinely different deployment models, and which one you get depends on something as small as whether your agent needs Node.js installed next to Python.
Model one: container, the one with a Dockerfile
Three of my four agents use
deployment_type: container . You write a Dockerfile, the AgentCore CLI hands it to CodeBuild, CodeBuild pushes the resulting image to a private ECR repository, and the runtime pulls from there on every cold start. This is the path every AgentCore tutorial shows, because it is the flexible one: anything you can put in a container, you can run.Here is what that actually costs, pulled straight from my own ECR and CodeBuild history:
Agent | Base image | Extra runtime | Image size | Build time |
|---|---|---|---|---|
Minecraft bot | python:3.11-slim (arm64) | Node.js 20 | ~407 MB | ~100s |
Payment agent | python:3.11-slim (arm64) | none | ~198 MB | ~66s |
Fact-checker | python:3.11-slim (arm64) | none | ~198 MB | ~58s |
The two agents that are Python-only land at almost exactly the same size, which makes sense since they share the same slim base image and a similar dependency list. The Minecraft bot is the outlier, and the reason is not subtle once you see the Dockerfile: it needs to run
minecraft-mcp-server , an MCP server written in Node.js, alongside the Python agent code, so the image installs Node.js 20 on top of the Python base. That single addition roughly doubles the image and adds about 40 seconds to every build.FROM --platform=linux/arm64 public.ecr.aws/docker/library/python:3.11-slimRUN apt-get update && apt-get install -y --no-install-recommends \ curl ca-certificates gnupg gcc git \ && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \ && apt-get update && apt-get install -y --no-install-recommends nodejs# pre-fetch the MCP server so the first invocation isn't the first downloadRUN npx -y github:yuniko-software/minecraft-mcp-server --help 2>/dev/null || trueThat last line is a small trick worth stealing:
npx downloads the package from GitHub on first run, and if that first run happens to be a real user's first invocation, they eat the download latency. Running the same npx command once at build time, and throwing away the result, warms the layer cache so the real cold start never pays for it.Model two: no Dockerfile at all
The debate simulator is configured completely differently. Its YAML has
deployment_type: direct_code_deploy , runtime_type: PYTHON_3_12 , and ecr_repository: null . There is no Dockerfile in the project. Deploying it means uploading source to an S3 bucket and letting AgentCore run it on a runtime AWS manages, the same shape of experience as deploying a Lambda function from a zip file. I went looking for a CodeBuild project tied to this agent, the same way I found build times for the other three, and there simply isn't one. No image to build, no registry to push to, no build minutes to pay for.This is the part that reframes the whole comparison for me. I didn't choose
direct_code_deploy for the debate simulator because it was simpler in the abstract. I chose it, without thinking much about it at the time, because the agent is pure Python with dependencies from PyPI, nothing else. It never needed the flexibility that a Dockerfile buys you, so the toolkit defaulted to the path that skips the Dockerfile entirely.
The line between them
Lay the four agents next to each other and the deciding factor is not the complexity of the agent's logic, it's whether anything outside the Python runtime needs to exist in the execution environment. The debate simulator and the fact-checker are architecturally similar agents, plain Strands agents calling Bedrock, and one of them still needed a container purely because I later added tool integrations with native dependencies. The Minecraft bot needed one because Node.js is not something
direct_code_deploy will install for you.So the practical rule I now use before starting a new AgentCore project: if every dependency resolves through
pip install , start with direct_code_deploy and skip Docker, ECR, and CodeBuild entirely. The moment you need a second language runtime, a system package apt-get install would normally provide, or precise control over the OS layer, switch to container and accept the build time and image size that come with it. Trying to force a Node.js dependency into a Dockerfile-less deploy would have cost me more time than the 100-second build ever did.None of these numbers are large in absolute terms. A 66-second build and a 100-second build both finish before I've read the CloudWatch logs from the previous deploy. But the gap points at something easy to miss when a platform advertises itself as one unified serverless runtime: two of my agents never touch a container registry, and I only found out by going looking.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article