Skip to content
Bedrock AgentCore: Deploy a Strands Agent as Classic Closes — ContentBuffer guide

Bedrock AgentCore: Deploy a Strands Agent as Classic Closes

K
Kodetra Technologies··8 min read Intermediate

Summary

Bedrock Agents Classic shut to new users. Deploy a Strands agent on AgentCore Runtime in Python.

AWS just froze its 2023 agent stack. Here is where to build instead

On July 30, 2026, Amazon quietly renamed Bedrock Agents to Bedrock Agents Classic and closed it to new customers. If you already run agents there, nothing breaks today: your existing agents, Knowledge Bases, and Guardrails keep working. But the service is now in maintenance mode, the model catalog is frozen as of that date, and every model released after it will only be reachable through the replacement. That replacement is Amazon Bedrock AgentCore.

The shift matters because it changes who owns the agent loop. Classic was a console-first product: you defined action groups, wired a Lambda, and let the service orchestrate. AgentCore flips that. You write the agent in whatever framework you like (Strands, LangGraph, CrewAI, or your own loop), and AgentCore gives you a secure, session-isolated runtime to host it, plus memory, gateway, identity, and observability as separate building blocks.

This guide walks the full path end to end: install the SDK, write a real agent, test it on your laptop, and deploy it to AgentCore Runtime two ways (the CLI and boto3 for CI). We will build a customer-support ticket triage agent and finish with a Classic-to-AgentCore migration map so you know exactly what each old concept maps to. Every command and API call here was verified against the AWS AgentCore developer guide and the bedrock-agentcore 1.20.0 SDK released August 4, 2026.

Prerequisites

  • An AWS account with credentials configured (aws configure) and permission to use Bedrock and create IAM roles.
  • Python 3.10 or newer. AgentCore Runtime supports Python 3.10-3.13; the direct-code path recommends 3.13.
  • Model access enabled: turn on Anthropic Claude Sonnet 4 in the Bedrock console, in the same region you plan to deploy (this guide uses us-west-2).
  • Node.js, so you can install the AgentCore CLI from npm.
  • Basic comfort with the terminal and JSON. No prior AgentCore knowledge needed.

Step 1: Install the SDK and CLI

AgentCore has two moving parts on your side: a lightweight Python SDK that wraps your agent as an HTTP service, and a CLI that packages and deploys it. Install both.

# Python SDK (wraps your agent for the runtime)
pip install bedrock-agentcore strands-agents

# AgentCore CLI (packaging + deploy), installed via npm
npm install -g @aws/agentcore

# confirm versions
python -c "import bedrock_agentcore, strands; print('sdk ok')"
agentcore --version

The bedrock-agentcore package is the runtime wrapper. strands-agents is the agent framework we will use for the actual reasoning loop; you can swap it for LangGraph or CrewAI later without changing how the runtime hosts you. The @aws/agentcore CLI handles zipping your code, building an arm64 dependency layer, provisioning IAM and CloudWatch, and shipping the agent.

Step 2: Write the agent

Create a file called main.py. The whole trick is the @app.entrypoint decorator: it turns a plain Python function into the /invocations endpoint the runtime calls, and the SDK adds the /ping health check for you. Everything inside the function is ordinary agent code.

# main.py
from bedrock_agentcore.runtime import BedrockAgentCoreApp
from strands import Agent
from strands.models import BedrockModel

app = BedrockAgentCoreApp()

# Cross-region inference profile id for Claude Sonnet 4
model = BedrockModel(model_id="us.anthropic.claude-sonnet-4-20250514")

triage = Agent(
    model=model,
    system_prompt=(
        "You triage customer support tickets. "
        "Reply with STRICT JSON only, no prose, using exactly these keys: "
        "category (Billing|Technical|Account|Other), "
        "priority (P1|P2|P3|P4), and one_line_summary."
    ),
)

@app.entrypoint
def invoke(payload):
    # Validate input before forwarding to the agent
    prompt = payload.get("prompt")
    if not isinstance(prompt, str):
        raise ValueError("prompt must be a string")

    result = triage(prompt)
    text = result.message["content"][0]["text"]
    return {"result": text}

if __name__ == "__main__":
    app.run()  # serves POST /invocations and GET /ping on port 8080

Two things worth calling out. First, we validate that prompt is a string before it reaches the model. That single check is your cheapest defense against a malformed or hostile payload being forwarded verbatim into the agent. Second, the entrypoint returns a plain dict, which the runtime serializes as one JSON response. If you instead yield events, the same handler streams them over Server-Sent Events, no extra wiring.

Step 3: Test locally before you touch AWS

You do not need to deploy to iterate. The SDK runs the exact same HTTP contract on your laptop. Make sure port 8080 is free, then start the dev server.

# terminal 1: run the agent locally
agentcore dev --no-browser
# (equivalently: python main.py)

# terminal 2: hit the local endpoint
curl -X POST http://localhost:8080/invocations \
  -H "Content-Type: application/json" \
  -d '{"prompt": "My invoice shows a double charge and I need a refund today, order #9921"}'

Example response from the local server:

{
  "result": "{\"category\": \"Billing\", \"priority\": \"P2\", \"one_line_summary\": \"Customer double-charged on order #9921, requesting a same-day refund.\"}"
}

That is the whole local loop. Because the contract is identical to production, an agent that behaves here will behave the same way once deployed. Stop the server with Ctrl+C when you are done.

Step 4: Deploy with the CLI (the fast path)

The CLI scaffolds project config, builds an arm64 dependency package, provisions the IAM execution role and CloudWatch logging, and deploys. Start by scaffolding a project, drop your main.py in, then deploy.

# scaffold config (choose Strands, name it, accept defaults)
agentcore create --name TicketTriage --defaults

# ... copy your main.py into the generated project ...

# build, upload, and provision the runtime
agentcore deploy

# invoke the deployed agent
agentcore invoke '{"prompt": "Card was declined at checkout twice, this is urgent"}'

The first deploy is the slow one because it installs and zips dependencies for the arm64 runtime. Later deploys reuse that layer and finish much faster. A successful invoke returns the same JSON shape you saw locally, now served from the managed runtime:

{
  "result": "{\"category\": \"Technical\", \"priority\": \"P1\", \"one_line_summary\": \"Repeated checkout card declines blocking purchase; needs urgent attention.\"}"
}

Under the hood agentcore deploy generates AWS CDK, so if you outgrow the CLI you can take the generated infrastructure-as-code and manage it directly.

Step 5: Deploy from CI with boto3

The CLI is great for humans; pipelines want an API. AgentCore exposes a control-plane client, bedrock-agentcore-control, with create_agent_runtime, update_agent_runtime, and delete_agent_runtime. You upload a zipped, arm64-built package to S3, then point a runtime at it. This is the exact create call, trimmed to the essentials:

import boto3

account_id = "123456789012"
agent_name = "ticket_triage"
region = "us-west-2"
bucket = f"bedrock-agentcore-code-{account_id}-{region}"

# 1) upload the arm64 deployment package (built with uv --python-platform aarch64-manylinux2014)
s3 = boto3.client("s3", region_name=region)
s3.upload_file(
    "deployment_package.zip",
    bucket,
    f"{agent_name}/deployment_package.zip",
    ExtraArgs={"ExpectedBucketOwner": account_id},
)

# 2) create the runtime pointing at that package
ctl = boto3.client("bedrock-agentcore-control", region_name=region)
resp = ctl.create_agent_runtime(
    agentRuntimeName=agent_name,
    agentRuntimeArtifact={
        "codeConfiguration": {
            "code": {"s3": {"bucket": bucket, "prefix": f"{agent_name}/deployment_package.zip"}},
            "runtime": "PYTHON_3_13",
            "entryPoint": ["main.py"],  # add "opentelemetry-instrument" first if you enable otel
        }
    },
    networkConfiguration={"networkMode": "PUBLIC"},
    roleArn=f"arn:aws:iam::{account_id}:role/AmazonBedrockAgentCoreSDKRuntime-{region}",
    lifecycleConfiguration={
        "idleRuntimeSessionTimeout": 300,  # seconds; kill idle sessions to cap cost
        "maxLifetime": 1800,               # seconds; hard ceiling per session
    },
)
print("ARN:", resp["agentRuntimeArn"], "Status:", resp["status"])

To ship a code change from CI, re-upload the zip and call update_agent_runtime with the same artifact block plus the agentRuntimeId. To tear everything down, call delete_agent_runtime and delete the S3 object. The lifecycleConfiguration fields are your cost seatbelt: idle sessions are billed until they time out, so set them deliberately.

Step 6: Call the agent from your application

Once deployed, invoke the runtime from any service with the data-plane client, bedrock-agentcore. Pass a session id so multi-turn calls land on the same isolated session.

import boto3, json

rt = boto3.client("bedrock-agentcore", region_name="us-west-2")

resp = rt.invoke_agent_runtime(
    agentRuntimeArn="arn:aws:bedrock-agentcore:us-west-2:123456789012:runtime/ticket_triage-abc123",
    runtimeSessionId="ticket-session-001",
    payload=json.dumps({"prompt": "I cannot log in, password reset email never arrives"}).encode(),
    contentType="application/json",
    accept="application/json",
)

body = resp["response"].read().decode()
print(json.loads(body))
# {'result': '{"category": "Account", "priority": "P2", "one_line_summary": "..."}'}

If you need to stop a live session early to avoid runaway cost (a stuck loop, a long tool call), call stop_runtime_session on the same data-plane client with the runtime ARN and session id. The CLI does not expose that yet, so this is the path for it.

Migrating from Bedrock Agents Classic

If you are moving an existing Classic agent, the mental model changes more than the code volume. Here is what each Classic concept becomes in AgentCore.

Bedrock Agents ClassicAgentCore equivalent
Action groups backed by LambdaTools in your framework (e.g. Strands @tool), or AgentCore Gateway to turn existing APIs into MCP tools
Knowledge Bases for retrievalKeep your Bedrock Knowledge Bases and call them from code; use AgentCore Memory for cross-session state
Console-defined orchestration/promptYour own code in any framework; you own the loop
Agent alias and versionAgentCore Runtime versions and endpoints
InvokeAgent APIinvoke_agent_runtime on the bedrock-agentcore client
Service manages hostingAgentCore Runtime hosts your container/zip; you control the code

Existing Classic agents are not deleted and keep serving traffic, but the frozen model catalog is the real forcing function: the moment you want a model released after July 30, 2026, you have to be on AgentCore. Treat migration as a scheduled project, not an emergency.

Common pitfalls and how to avoid them

  • arm64-only runtime. AgentCore Runtime runs on arm64. Pure-Python deps are fine, but anything with C extensions (numpy, pandas, pydantic-core) must be built for aarch64. Package with uv pip install --python-platform aarch64-manylinux2014 --only-binary=:all: or let the CLI do it. A package built for your Mac's arm64 is not the same as Linux arm64.
  • Model access is per-region. Enabling Claude in us-east-1 does nothing for a us-west-2 deploy. Enable the model in the same region, and use the cross-region inference profile id (the us. prefix) rather than the bare model id.
  • Port 8080 already in use. The local dev server binds 8080. Kill whatever holds it, or you will get a confusing bind error that looks like an SDK bug.
  • Forgetting the health check. The SDK adds GET /ping automatically. If you hand-roll your own HTTP server instead of using @app.entrypoint, you must implement /ping or the runtime marks the agent unhealthy.
  • Silent session costs. Sessions are billed until the idle timeout fires. Set idleRuntimeSessionTimeout and maxLifetime, and call stop_runtime_session for anything that looks stuck.
  • IAM role gaps. The execution role needs Bedrock model invoke, S3 read on your deployment bucket, and CloudWatch Logs write. Missing any one produces an error that rarely names the real cause.
  • Returning objects you did not validate. Keep the entrypoint strict: validate the payload, and return JSON-serializable data. Yielding a generator turns the response into a stream, which is great when you want it and surprising when you do not.

Quick reference

TaskCommand or API
Install SDK + frameworkpip install bedrock-agentcore strands-agents
Install CLInpm install -g @aws/agentcore
Run locallyagentcore dev --no-browser (POST /invocations, GET /ping, :8080)
Scaffold projectagentcore create --name TicketTriage --defaults
Deployagentcore deploy
Invoke (CLI)agentcore invoke '{"prompt": "..."}'
Create/update/delete runtimebedrock-agentcore-control client
Invoke from appbedrock-agentcore.invoke_agent_runtime(...)
Stop a sessionbedrock-agentcore.stop_runtime_session(...)

Next steps

You now have a production-hosted agent with a clean local loop. From here, the AgentCore building blocks compose onto the same runtime: add Memory for multi-turn context that survives across sessions, Gateway to expose internal REST APIs to the agent as MCP tools, Observability (the optional aws-opentelemetry-distro dependency plus CloudWatch Transaction Search) for traces, and Identity to require inbound auth on the endpoint. Wire the boto3 create/update path into your CI so every merge ships a new runtime version, and you have a repeatable, framework-agnostic agent platform that will not be frozen out from under you.


Verified against the Amazon Bedrock AgentCore developer guide and the bedrock-agentcore 1.20.0 Python SDK (released August 4, 2026). Facts on the Bedrock Agents Classic change reflect AWS's maintenance-mode announcement effective July 30, 2026.

Comments

Subscribe to join the conversation...

Be the first to comment

Found this useful?

Get new AI guides for builders by email. Free.

Join 3,605 newsletter subscribers.

Also get