Runtime Instances: Persistent Compute for AI Agents on Amazon Bedrock
In the world of AI, managing workloads efficiently is crucial. Runtime instances in Amazon Bedrock AgentCore provide a solution by offering persistent, managed infrastructure tailored for complex agent workloads. This means your AI agents can operate seamlessly without the overhead of constantly spinning up new environments, allowing for faster and more reliable processing.
At the core of this functionality are microVMs, which create a fully managed environment for invocations. These microVMs can run for up to 8 hours and support stateful workflows through managed session storage. The orchestrator agent on the runtime microVM coordinates tasks, routing them to specialized worker agents that perform compute-intensive operations, such as code compilation or security scanning. You can configure these instances with specific parameters, like the operating system (default is Linux 64-bit ARM), allowed EC2 instance types (default is c7g.2xlarge), and the programming language runtime (default is Python 3.13). This flexibility helps you tailor the environment to your specific needs.
In production, it’s essential to understand how session persistence works. Sessions can last up to 14 days, which is beneficial for long-running tasks. However, keep in mind that while these microVMs are powerful, they may not be suitable for every scenario. Always evaluate your workload requirements and test thoroughly to ensure optimal performance.
Key takeaways
- →Leverage Runtime instances for persistent compute in AI workflows.
- →Utilize microVMs for stateful workflows with managed session storage.
- →Configure parameters like operating system and instance types to fit your needs.
- →Understand session persistence of up to 14 days for long-running tasks.
Why it matters
In production, efficient resource management can significantly reduce costs and improve response times for AI agents. Runtime instances streamline operations, allowing teams to focus on development rather than infrastructure management.
Code examples
1writer = Agent(
2 model="us.anthropic.claude-sonnet-4-5-20250929-v1:0",
3 system_prompt=(
4 "You are a senior Python engineer. "
5 "Given a task, return ONLY a single Python code block — no prose."
6 ),
7)
8
9@app.entrypoint
10def handler(event, context):
11 task = event.get("task") or event.get("prompt")
12 session_id = getattr(context, "session_id", None) or event.get("session_id")
13 session_dir = SHARED_DIR / session_id
14 session_dir.mkdir(parents=True, exist_ok=True)
15
16 code = str(writer(task))
17 (session_dir / "code.py").write_text(code)
18
19 return {"agent": "writer", "wrote": str(session_dir / "code.py"), "code": code}1reviewer = Agent(
2 model="us.anthropic.claude-sonnet-4-5-20250929-v1:0",
3 system_prompt=(
4 "You are a strict Python code reviewer. "
5 "Given code, return 3 bullet points: bugs, style, suggestions."
6 ),
7)
8
9@app.entrypoint
10def handler(event, context):
11 session_id = getattr(context, "session_id", None) or event.get("session_id")
12 code_path = SHARED_DIR / session_id / "code.py"
13 code = code_path.read_text()
14 review = str(reviewer(f"Review this code:\n\n{code}"))
15
16 return {"agent": "reviewer", "read": str(code_path), "review": review}When NOT to use this
The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.
Want the complete reference?
Read official docsSimple, affordable cloud — VMs, Kubernetes, and managed databases in minutes. Trusted by 600,000+ developers. Spin up a Droplet in 60 seconds.
Try DigitalOcean →Unlocking AWS Innovations: Polly's Generative Voices and TorchNeuron for Trainium
AWS continues to push boundaries with its latest updates, including Amazon Polly's generative engine featuring 57 voices across 11 languages. Dive into how TorchNeuron simplifies model deployment on Trainium with a simple command.
AWS Weekly Roundup: Key Innovations from Prime Day 2026
Dive into the latest AWS advancements that emerged from Prime Day 2026. Discover how Claude Haiku 5.5 delivers performance at a fraction of the cost compared to its predecessor, and learn about Amazon Nova 2.5 Sonic's capabilities for real-time voice agents.
Unlocking AWS Bedrock: Managed Agents and New AI Capabilities
AWS Bedrock introduces Managed Agents powered by OpenAI, streamlining your AI workflows. With the new AWS Well-Architected Agent, you can optimize your applications for cost and performance effortlessly.
Get the daily digest
One email. 5 articles. Every morning.
No spam. Unsubscribe anytime.