AWS Machine Learning Blog 09月25日 18:02
Deep Agents与AgentCore Runtime助力AI agent生产化部署
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

AI agents正从单一任务助手进化为能规划、批判和协作的复杂系统。Amazon Bedrock AgentCore Runtime提供安全、无服务器的环境,支持Deep Agents等多agent工作流,通过微虚拟机实现会话隔离。AgentCore框架无关、模型无关,支持持久化内存、MCP协议、企业认证等生产级功能,简化从原型到生产的部署流程,尤其适合需要异步处理、长期运行和外部API集成的深度研究agent。

🔧 AgentCore Runtime作为服务器less安全托管环境,通过轻量级容器和专用微虚拟机实现agent工作负载的弹性伸缩和隔离运行,支持长达8小时的复杂推理任务,并采用按量计费模式。

🤝 Deep Agents通过LangGraph状态管理构建多agent系统,包含任务规划工具、虚拟文件系统和递归推理能力,使研究agent能协同完成信息收集、整合和细化等多轮任务。

🛡️ AgentCore提供企业级安全特性,包括单SDK统一访问、企业认证集成和深度可观测性,同时支持多种框架(如LangGraph、CrewAI)和基础模型提供商,无需重写代码即可完成部署。

⚙️ AgentCore Starter Toolkit通过三步部署流程(配置、启动、调用)自动化处理Docker镜像生成、依赖构建、ECR推送和部署监控,将复杂基础设施管理抽象化,典型部署时间仅需2-3分钟。

AI agents are evolving beyond basic single-task helpers into more powerful systems that can plan, critique, and collaborate with other agents to solve complex problems. Deep Agents—a recently introduced framework built on LangGraph—bring these capabilities to life, enabling multi-agent workflows that mirror real-world team dynamics. The challenge, however, is not just building such agents but also running them reliably and securely in production. This is where Amazon Bedrock AgentCore Runtime comes in. By providing a secure, serverless environment purpose-built for AI agents and tools, Runtime makes it possible to deploy Deep Agents at enterprise scale without the heavy lifting of managing infrastructure.

In this post, we demonstrate how to deploy Deep Agents on AgentCore Runtime. As shown in the following figure, AgentCore Runtime scales any agent and provides session isolation by allocating a new microVM for each new session.

What is Amazon Bedrock AgentCore?

Amazon Bedrock AgentCore is both framework-agnostic and model-agnostic, giving you the flexibility to deploy and operate advanced AI agents securely and at scale. Whether you’re building with Strands Agents, CrewAI, LangGraph, LlamaIndex, or another framework—and running them on a large language model (LLM)—AgentCore provides the infrastructure to support them. Its modular services are purpose-built for dynamic agent workloads, with tools to extend agent capabilities and controls required for production use. By alleviating the undifferentiated heavy lifting of building and managing specialized agent infrastructure, AgentCore lets you bring your preferred framework and model and deploy without rewriting code.

Amazon Bedrock AgentCore offers a comprehensive suite of capabilities designed to transform local agent prototypes into production-ready systems. These include persistent memory for maintaining context in and across conversations, access to existing APIs using Model Context Protocol (MCP), seamless integration with corporate authentication systems, specialized tools for web browsing and code execution, and deep observability into agent reasoning processes. In this post, we focus specifically on the AgentCore Runtime component.

Core capabilities of AgentCore Runtime

AgentCore Runtime provides a serverless, secure hosting environment specifically designed for agentic workloads. It packages code into a lightweight container with a simple, consistent interface, making it equally well-suited for running agents, tools, MCP servers, or other workloads that benefit from seamless scaling and integrated identity management.AgentCore Runtime offers extended execution times up to 8 hours for complex reasoning tasks, handles large payloads for multimodal content, and implements consumption-based pricing that charges only during active processing—not while waiting for LLM or tool responses. Each user session runs in complete isolation within dedicated micro virtual machines (microVMs), maintaining security and helping to prevent cross-session contamination between agent interactions. The runtime works with many frameworks (for example: LangGraph, CrewAI, Strands, and so on) and many foundation model providers, while providing built-in corporate authentication, specialized agent observability, and unified access to the broader AgentCore environment through a single SDK.

Real-world example: Deep Agents integration

In this post we’re going to deploy the recently released Deep Agents implementation example on AgentCore Runtime—showing just how little effort it takes to get the latest agent innovations up and running.

The sample implementation in the preceding diagram includes:

Deep Agents uses LangGraph’s state management to create a multi-agent system with:

This architecture enables Deep Agents to handle research tasks that require multiple rounds of information gathering, synthesis, and refinement.The key integration points in our code showcase how agents work with AgentCore. The beauty is in its simplicity—we only need to add a couple of lines of code to make an agent AgentCore-compatible:

# 1. Import the AgentCore runtimefrom bedrock_agentcore.runtime import BedrockAgentCoreAppapp = BedrockAgentCoreApp()# 2. Decorate your agent function with @app.entrypoint@app.entrypointasync def langgraph_bedrock(payload):    # Your existing agent logic remains unchanged    user_input = payload.get("prompt")        # Call your agent as before    stream = agent.astream(        {"messages": [HumanMessage(content=user_input)]},        stream_mode="values"    )        # Stream responses back    async for chunk in stream:        yield(chunk)# 3. Add the runtime starter at the bottomif __name__ == "__main__":    app.run()

That’s it! The rest of the code—model initialization, API integrations, and agent logic—remains exactly as it was. AgentCore handles the infrastructure while your agent handles the intelligence. This integration pattern works for most Python agent frameworks, making AgentCore truly framework-agnostic.

Deploying to AgentCore Runtime: Step-by-step

Let’s walk through the actual deployment process using the AgentCore Starter ToolKit, which dramatically simplifies the deployment workflow.

Prerequisites

Before you begin, make sure you have:

Step 1: IAM permissions

There are two different AWS Identity and Access Management (IAM) permissions you need to consider when deploying an agent in an AgentCore Runtime—the role you, as a developer use to create AgentCore resources and the execution role that an agent needs to run in an AgentCore Runtime. While the latter role can now be auto-created by the AgentCore Starter Toolkit (auto_create_execution_role=True), the former must be defined as described in IAM Permissions for AgentCore Runtime.

Step 2: Add a wrapper to your agent

As shown in the preceding Deep Agents example, add the AgentCore imports and decorator to your existing agent code.

Step 3: Deploy using the AgentCore starter toolkit

The starter toolkit provides a three-step deployment process:

from bedrock_agentcore_starter_toolkit import Runtime# Step 1: Configureagentcore_runtime = Runtime()config_response = agentcore_runtime.configure(    entrypoint="hello.py", # contains the code we showed earlier in the post    execution_role=role_arn, # or auto-create    auto_create_ecr=True,    requirements_file="requirements.txt",    region="us-west-2",    agent_name="deepagents-research")# Step 2: Launchlaunch_result = agentcore_runtime.launch()print(f"Agent deployed! ARN: {launch_result['agent_arn']}")# Step 3: Invokeresponse = agentcore_runtime.invoke({    "prompt": "Research the latest developments in quantum computing"})

Step 4: What happens behind the scenes

When you run the deployment, the starter kit automatically:

    Generates an optimized Docker file with Python 3.13-slim base image and OpenTelemetry instrumentation Builds your container with the dependencies from requirements.txt Creates an Amazon Elastic Container Registry (Amazon ECR) repository (if auto_create_ecr=True) and pushes your image Deploys to AgentCore Runtime and monitors the deployment status Configures networking and observability with Amazon CloudWatch and AWS X-Ray integration

The entire process typically takes 2–3 minutes, after which your agent is ready to handle requests at scale. Each new session is launched in its own fresh AgentCore Runtime microVM, maintaining complete environment isolation.

The starter kit generates a configuration file (.bedrock_agentcore.yaml) that captures your deployment settings, making it straightforward to redeploy or update your agent later.

Invoking your deployed agent

After deployment, you have two options for invoking your agent:

Option 1: Using the start kit (shown in Step 3)

response = agentcore_runtime.invoke({    "prompt": "Research the latest developments in quantum computing"})

Option 2: Using boto3 SDK directly

import boto3import jsonagentcore_client = boto3.client('bedrock-agentcore', region_name='us-west-2')response = agentcore_client.invoke_agent_runtime(    agentRuntimeArn=agent_arn,    qualifier="DEFAULT",    payload=json.dumps({        "prompt": "Analyze the impact of AI on healthcare in 2024"    }))# Handle streaming responsefor event in response['completion']:    if 'chunk' in event:        print(event['chunk']['bytes'].decode('utf-8'))

Deep Agents in action

As the code executes in Bedrock AgentCore Runtime, the primary agent orchestrates specialized sub-agents—each with its own purpose, prompt, and tool access—to solve complex tasks more effectively. In this case, the orchestrator prompt (research_instructions) sets the plan:

    Write the question to question.txt Fan out to one or more research-agent calls (each on a single sub-topic) using the internet_search tool Synthesize findings into final_report.md Call critique-agent to evaluate gaps and structure Optionally loop back to more research/edits until quality is met

Here it is in action:

Clean up

When finished, don’t forget to de-allocate provisioned AgentCore Runtime in addition to the container repository that was created during the process:

agentcore_control_client = boto3.client(    'bedrock-agentcore-control', region_name=region )ecr_client = boto3.client('ecr',region_name=region )runtime_delete_response = agentcore_control_client.delete_agent_runtime(    agentRuntimeId=launch_result.agent_id,)response = ecr_client.delete_repository(    repositoryName=launch_result.ecr_uri.split('/')[1],force=True)

Conclusion

Amazon Bedrock AgentCore represents a paradigm shift in how we deploy AI agents. By abstracting away infrastructure complexity while maintaining framework and model flexibility, AgentCore enables developers to focus on building sophisticated agent logic rather than managing deployment pipelines. Our Deep Agents deployment demonstrates that even complex, multi-agent systems with external API integrations can be deployed with minimal code changes. The combination of enterprise-grade security, built-in observability, and serverless scaling makes AgentCore the best choice for production AI agent deployments. Specifically for deep research agents, AgentCore offers the following unique capabilities that you can explore:

Ready to deploy your agents to production? Here’s how to get started:

    Install the AgentCore starter kit: pip install bedrock-agentcore-starter-toolkit Experiment: Deploy your code by following this step by step guide.

The era of production-ready AI agents is here. With AgentCore, the journey from prototype to production has never been shorter.


About the authors

Vadim Omeltchenko is a Sr. AI/ML Solutions Architect who is passionate about helping AWS customers innovate in the cloud. His prior IT experience was predominantly on the ground.

Eashan Kaushik is a Specialist Solutions Architect AI/ML at Amazon Web Services. He is driven by creating cutting-edge generative AI solutions while prioritizing a customer-centric approach to his work. Before this role, he obtained an MS in Computer Science from NYU Tandon School of Engineering. Outside of work, he enjoys sports, lifting, and running marathons.

Shreyas Subramanian is a Principal data scientist and helps customers by using Machine Learning to solve their business challenges using the AWS platform. Shreyas has a background in large scale optimization and Machine Learning, and in use of Machine Learning and Reinforcement Learning for accelerating optimization tasks.

Mark Roy is a Principal Machine Learning Architect for AWS, helping customers design and build generative AI solutions. His focus since early 2023 has been leading solution architecture efforts for the launch of Amazon Bedrock, the flagship generative AI offering from AWS for builders. Mark’s work covers a wide range of use cases, with a primary interest in generative AI, agents, and scaling ML across the enterprise. He has helped companies in insurance, financial services, media and entertainment, healthcare, utilities, and manufacturing. Prior to joining AWS, Mark was an architect, developer, and technology leader for over 25 years, including 19 years in financial services. Mark holds six AWS Certifications, including the ML Specialty Certification.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Amazon Bedrock AgentCore Runtime Deep Agents AI Agent 生产化部署 多agent协作 LangGraph
相关文章