Introducing the AWS Guidance for Multi-Agent Orchestration using LangGraph
Teams that build agents with LangGraph need somewhere to run them. This post introduces the Guidance for Multi-Agent Orchestration using LangGraph on AWS, an AWS Cloud Development Kit (AWS CDK) sample that deploys a LangGraph supervisor and four specialist agents as Amazon ECS services on AWS Fargate. It covers routing between agents, conversation state in Amazon DynamoDB, data in Amazon Aurora and Amazon Bedrock Knowledge Bases, and real-time streaming through AWS AppSync.
Many teams already build their agents with LangGraph. They like its explicit graph model, where each step of an agent's work is a node and the paths between steps are edges they control. Customer support is a good fit for this model. One conversation can include an order status check, a troubleshooting question, and a product recommendation, and each of those needs different data, tools, and prompts.
Splitting that work across specialized agents keeps each prompt focused and lets each agent change on its own schedule. It also raises practical questions. Where do the agents run? How does a supervisor find and call the other agents? Where does conversation state live between turns? How do responses get back to the browser while the agents are still working?
To help with this, AWS offers the Guidance for Multi-Agent Orchestration on AWS , part of the AWS Solutions Library . It includes more than one implementation. This post covers the LangGraph implementation, which runs each agent as its own container service on Amazon Elastic Container Service (Amazon ECS) with AWS Fargate. It's for developers and architects who use LangGraph and want a reference for running a multi-agent system on AWS infrastructure they control.
The Multi-Agent Challenge: Running LangGraph Agents on AWS
Building a multi-agent system with LangGraph on your own infrastructure raises a predictable set of problems:
- Hosting and scaling: Each agent needs compute, health checks, and a way to scale. Putting every agent in one process makes them hard to update or scale separately.
- Agent-to-agent communication: A supervisor has to find each specialist and call it reliably, without hard-coded addresses.
- Conversation state: LangGraph saves graph state with a checkpointer. Without a durable checkpointer, context is lost when a container restarts or a request lands on a different task.
- Mixed data sources: Support agents need structured data, such as orders and inventory, and unstructured content, such as FAQs and troubleshooting guides.
- Streaming to the user: Multi-agent requests can take several seconds. Users expect to see progress instead of waiting for one final response.
- Visibility: With five services, you need one place to see health and resource use for all of them.
AWS Guidance for Multi-Agent Orchestration using LangGraph
This Guidance gives you a deployable code sample that addresses each of these problems with managed AWS services. The infrastructure is defined with the AWS Cloud Development Kit (AWS CDK) in TypeScript, and the agents are written in Python with LangGraph and LangChain. The agents call models on Amazon Bedrock through LangChain's
ChatBedrockConverse client.Use Case: Intelligent Customer Support
The Guidance shows the pattern through a retail customer support assistant. A Supervisor Agent coordinates four specialist agents:
Agent | Responsibility | Main data source |
|---|---|---|
Supervisor Agent | Analyzes intent, picks the agents to call, and combines their answers | Conversation state |
Order Management Agent | Order status, shipping, returns, and inventory | Amazon Aurora PostgreSQL-Compatible Edition |
Product Recommendation Agent | Product search and suggestions | Sample product catalog packaged with the agent |
Personalization Agent | Customer profiles, preferences, and browsing history | Sample profile data packaged with the agent and Amazon Bedrock Knowledge Bases |
Troubleshooting Agent | Step-by-step help from FAQs and troubleshooting guides | Amazon Bedrock Knowledge Bases |
Architecture Overview
Each of the five agents is a LangGraph application packaged as a container and deployed as its own Amazon ECS service on AWS Fargate. The supervisor is itself a LangGraph
StateGraph . Its first node analyzes the user's intent and decides which specialists to call. Conditional edges route the request to those specialists one after another, and a final synthesizer node combines their results into one answer.
Request Flow and AWS Service Integration
A typical request goes through the architecture like this:
- Sign-in and page delivery: The user opens the React web application, which is served from an Amazon Simple Storage Service (Amazon S3) bucket through Amazon CloudFront. AWS WAF protects the distribution with AWS Managed Rules for common threats, IP reputation, and bot control. Amazon Cognito signs the user in.
- Request over WebSocket: By default, the frontend publishes the user's message to a channel on an AWS AppSync Events API, using the user's Amazon Cognito credentials. The Supervisor Agent subscribes to that channel and picks up the request.
- Alternative GraphQL path: The frontend also includes a chat interface that uses an AWS AppSync GraphQL API instead. In that path, an AWS Lambda resolver function inside the Amazon Virtual Private Cloud (Amazon VPC) forwards the request to the Supervisor Agent through an internal Application Load Balancer that isn't reachable from the internet.
- Supervisor orchestration: The Supervisor Agent loads the conversation's saved state from Amazon DynamoDB, uses a model on Amazon Bedrock to analyze intent, and picks one or more specialist agents.
- Specialist calls: The supervisor calls each specialist over HTTP. It finds them through AWS Cloud Map private DNS names, so no addresses are hard-coded.
- Domain work: Each specialist runs its own LangGraph agent with its own tools:
- The Order Management agent queries orders and inventory in Amazon Aurora PostgreSQL-Compatible Edition (Amazon Aurora Serverless v2) through the Amazon Relational Database Service (Amazon RDS) Data API.
- The Product Recommendation agent searches a sample product catalog that ships inside its container.
- The Personalization agent combines sample customer profiles, also packaged with the agent, with browsing history from an Amazon Bedrock Knowledge Base.
- The Troubleshooting agent searches FAQs and troubleshooting guides in an Amazon Bedrock Knowledge Base.
- Both knowledge bases use Amazon Titan Text Embeddings V2 and an Amazon OpenSearch Serverless vector collection.
- Synthesis and state: The supervisor's synthesizer node combines the specialists' answers. LangGraph saves the updated conversation state to Amazon DynamoDB through a custom checkpointer.
- Streaming back: The supervisor publishes progress events to a response channel on the AWS AppSync Events API. The UI shows each agent's status and the supervisor's reasoning while the request runs, and then shows the final answer. Chat sessions and messages are stored in Amazon DynamoDB tables.
Amazon CloudWatch collects logs and Amazon CloudWatch Container Insights metrics from all five services, and AWS X-Ray traces the resolver function. The database credentials are stored in AWS Secrets Manager, and the agent container images are stored in Amazon Elastic Container Registry (Amazon ECR).
Key Features and Benefits
Independent Agent Services on Amazon ECS with AWS Fargate
Benefit: You can deploy, scale, and update each agent on its own, without managing servers.
How: Each agent runs as a separate Amazon ECS service on AWS Fargate in private subnets. By default, the supervisor, Order Management, and Product Recommendation services each run two tasks, and the Personalization and Troubleshooting services each run one. You can change the CPU, memory, and task count for each agent in the AWS CDK stack. To add an agent, you add a new agent folder and a matching entry in the Amazon ECS stack.
Supervisor Routing with a LangGraph StateGraph
Benefit: The routing logic is an explicit graph that you can read, test, and change.
How: The supervisor's graph has a node for intent analysis, a node for each specialist, and a synthesizer node. The intent node returns a structured result that lists the agents to call and the reason for the choice. Conditional edges move through that list, and the synthesizer writes the final answer. Because the graph is plain LangGraph code, you can add branches, change the order, or call specialists differently.
Service Discovery with AWS Cloud Map
Benefit: Agents find each other by name, even as tasks start, stop, and move.
How: The Guidance creates an AWS Cloud Map private DNS namespace for the agents. Each specialist registers under a name such as
order-management.multi-agent.local , and the supervisor calls that name. Amazon ECS keeps the registrations current as tasks change.Durable Conversation State in Amazon DynamoDB
Benefit: Conversations keep their context across turns, container restarts, and scaling events.
How: The Guidance includes a custom LangGraph checkpointer that stores graph state in an Amazon DynamoDB table, keyed by conversation thread. Any task of an agent can pick up a conversation where another task left off.
Structured and Unstructured Data
Benefit: Agents can answer from both business records and documents.
How: An Amazon Aurora Serverless v2 cluster (PostgreSQL-compatible) holds order and inventory data. The Order Management agent queries it through the Amazon RDS Data API, so it doesn't manage database connections. The Product Recommendation and Personalization agents use small sample datasets packaged in their containers, which you can replace with your own data stores. Two Amazon Bedrock Knowledge Bases, one for browsing history and one for FAQs and troubleshooting guides, provide retrieval-augmented generation (RAG) over documents stored in Amazon S3.
Real-Time Streaming with AWS AppSync
Benefit: Users see what the agents are doing while they work.
How: By default, the frontend and the Supervisor Agent exchange messages through channels on an AWS AppSync Events API over WebSocket, with users signed in through Amazon Cognito. The frontend sends each request on one channel, and the supervisor publishes progress and the final answer on another. The Guidance also includes an AWS AppSync GraphQL API path, with an AWS Lambda resolver that calls the supervisor through the internal Application Load Balancer. The UI shows which agents were selected, why, and each agent's status before the final answer arrives.
Monitoring with Amazon CloudWatch
Benefit: You can see the health of all five agents in one place.
How: The Guidance creates an Amazon CloudWatch dashboard with CPU, memory, and running task metrics for each agent service. It also creates alarms for each service when CPU or memory goes above 80 percent, or when the running task count drops below one.
Infrastructure as Code with the AWS CDK
Benefit: The whole system can be reviewed, versioned, deployed, and removed as code.
How: The AWS CDK app defines eight stacks: network, database, knowledge base, load balancer, Amazon ECS, monitoring, streaming API, and frontend. A deploy script bootstraps the AWS CDK, deploys every stack, and writes the frontend configuration from the stack outputs.
The table below summarizes the main features and the components that provide them:
Feature Area | Specific Capability | How It's Enabled |
|---|---|---|
Orchestration | Supervisor routing and answer synthesis | LangGraph StateGraph with conditional edges |
Compute | One container service per agent | Amazon ECS on AWS Fargate |
Networking | Private agent-to-agent calls | AWS Cloud Map + internal Application Load Balancer for the GraphQL path |
State | Conversation checkpoints | Custom LangGraph checkpointer on Amazon DynamoDB |
Structured data | Orders and inventory | Amazon Aurora Serverless v2 (PostgreSQL-compatible) + Amazon RDS Data API |
Unstructured data | FAQs, guides, browsing history | Amazon Bedrock Knowledge Bases + Amazon OpenSearch Serverless |
Models | Intent analysis and agent reasoning | Amazon Bedrock through ChatBedrockConverse |
User experience | Real-time progress and answers | AWS AppSync Events (default) or AWS AppSync GraphQL API |
Security | Sign-in and edge protection | Amazon Cognito + AWS WAF + Amazon CloudFront |
Monitoring | Dashboard and alarms per agent | Amazon CloudWatch + Amazon CloudWatch Container Insights |
Deployment | Infrastructure as code | AWS CDK (TypeScript) |
Getting Started: Deploying the Multi-Agent System
This section gives a high-level overview of deploying the Guidance.
Disclaimer: This walkthrough is based on the GitHub repository documentation available at the time of writing. Always check the repository for current instructions. Deploying this solution incurs costs for the AWS resources used. As an AWS Guidance sample, support is best effort through the repository's GitHub Issues.
Prerequisites
- An AWS account with permissions to deploy the resources in the architecture, in the US East (N. Virginia) Region (us-east-1).
- Amazon Bedrock model access for the model the agents use. The default is Anthropic Claude 3.5 Haiku through a cross-Region inference profile. You can use a different model by setting the
BEDROCK_MODEL_IDenvironment variable for the agents. You also need access to Amazon Titan Text Embeddings V2 for the knowledge bases.
- Enough AWS Fargate capacity for at least 10 tasks.
- AWS Command Line Interface (AWS CLI) v2, AWS CDK v2.100 or later, Node.js 18 or later with npm, Python 3.10 or later, Docker, and jq, on macOS, Ubuntu 20.04 or later, or Amazon Linux 2023.
Step 1: Clone the Repository
git clone https://github.com/aws-solutions-library-samples/guidance-for-multi-agent-orchestration-langgraph-on-aws.gitcd guidance-for-multi-agent-orchestration-langgraph-on-awsStep 2: Deploy the Stacks
Run the deploy script from the repository root:
./deploy.shThe script checks the prerequisites, bootstraps the AWS CDK, deploys all eight stacks, saves the outputs to
cdk-outputs.json , and writes the frontend configuration. The AWS CDK builds the five agent container images and pushes them to Amazon ECR as part of the deployment.Stack | What It Creates |
|---|---|
MultiAgentSystem-Network-dev | Amazon VPC across two Availability Zones, with public and private subnets and NAT gateways |
MultiAgentSystem-Database-dev | Amazon Aurora Serverless v2 cluster (PostgreSQL-compatible) |
MultiAgentSystem-BedrockKB-dev | Amazon Bedrock Knowledge Bases, Amazon OpenSearch Serverless collection, and Amazon S3 data buckets |
MultiAgentSystem-LoadBalancer-dev | Internal Application Load Balancer |
MultiAgentSystem-StreamingAPI-dev | Amazon Cognito user pool, AWS AppSync APIs, resolver function, and Amazon DynamoDB tables |
MultiAgentSystem-ECS-dev | Amazon ECS cluster, five agent services, and AWS Cloud Map namespace |
MultiAgentSystem-Monitoring-dev | Amazon CloudWatch dashboard and alarms |
MultiAgentSystem-Frontend-dev | Amazon S3 website bucket, Amazon CloudFront distribution, and AWS WAF web ACL |
Step 3: Load the Knowledge Base Content
The Personalization and Troubleshooting agents need their knowledge bases populated before they can answer. Find the two data bucket names in
cdk-outputs.json , then upload the sample files from the repository:cd agents/knowledge-base
aws s3 cp personalization/browse_history.txt s3://<personalization-bucket>/browsing-history/aws s3 cp troubleshooting/faq/faq.txt s3://<troubleshooting-bucket>/faqs/aws s3 cp troubleshooting/ts/ts_guide.txt s3://<troubleshooting-bucket>/faqs/Then open Knowledge Bases in the Amazon Bedrock console and choose Sync for each of the two knowledge bases. Syncing takes a few minutes.
Step 4: Verify and Sign In
Check that the deployment is healthy:
- In the AWS CloudFormation console, all
MultiAgentSystemstacks showCREATE_COMPLETE.
- In the Amazon ECS console, all five agent services are running.
- In the Amazon RDS console, the Amazon Aurora cluster is Available.
Get the website URL from the frontend stack outputs, create a user in the Amazon Cognito user pool, and sign in. Amazon Cognito asks you to change the temporary password the first time.
Step 5: Try a Conversation
Try questions that exercise different agents:
User Says | What Happens Behind the Scenes |
|---|---|
"Can you help me with order ORD-2024-001?" | Supervisor → Order Management Agent looks up the order in Amazon Aurora |
"I'm looking for a gaming laptop under $1,500." | Supervisor → Product Recommendation Agent searches the product catalog |
"My wireless headphones won't connect to my phone." | Supervisor → Troubleshooting Agent searches the knowledge base |
The Agent Progress panel shows the supervisor's intent analysis, the agents it selected, and the reasoning behind the choice, while each agent works.
Step 6: Customize and Extend
- Add agents by creating a new folder under
agents/and adding it to the Amazon ECS stack.
- Connect your own data by replacing the sample Amazon Aurora records, the sample catalog and profile data packaged with the agents, and the knowledge base documents.
- Change the routing by editing the supervisor's graph and prompts.
- Integrate other systems, such as a CRM, as new tools on the relevant agent.
- Change the UI in the React frontend.
Before You Go to Production
The sample is built for evaluation. Review these settings before you adapt it for real customers:
- User sign-up: The Amazon Cognito user pool allows self sign-up. Turn it off, or add controls, if only known users should have access.
- Customer identity: In the sample, agents receive the customer ID as part of the request. For real customer data, take the customer ID from the signed-in user's token in code, so the model can't choose whose data to query.
- Database access: The Order Management agent runs SQL through the Amazon RDS Data API. Use a database user with read-only access to the tables the agent needs, and keep queries parameterized.
- Data protection: The Amazon Aurora cluster has deletion protection turned off so the sample is easy to remove. Turn it on for production data.
- Safety controls: The sample doesn't include Amazon Bedrock Guardrails. Consider adding them to screen user input and model output.
- Scaling: Add AWS Fargate auto scaling policies for each agent service based on your traffic.
Cleanup
To remove the resources, run
cdk destroy --all from the infra folder. If a stack fails to delete, empty its Amazon S3 buckets and Amazon ECR repositories and try again. The repository README lists more steps for resources that are slow to delete, such as the Amazon OpenSearch Serverless collection and Amazon VPC endpoints.Why This Guidance Matters for AWS Builders
- Keep your framework: Teams that use LangGraph can run their agents on AWS without rewriting them for a different agent framework.
- Independent agents: Each agent is its own service, so one team can update, scale, or replace an agent without touching the others.
- Infrastructure you control: The agents run on Amazon ECS with AWS Fargate in your Amazon VPC, with private networking between them.
- Context that survives restarts: The Amazon DynamoDB checkpointer keeps conversation state outside the containers.
- Both kinds of data: Amazon Aurora and Amazon Bedrock Knowledge Bases cover records and documents in one system.
- Visible progress: Streaming through AWS AppSync shows users what the agents are doing while they work.
Conclusion: Run LangGraph Multi-Agent Systems on AWS
LangGraph gives you precise control over how agents reason and hand off work. The Guidance for Multi-Agent Orchestration using LangGraph on AWS shows how to run that kind of system on managed AWS services: container hosting on Amazon ECS with AWS Fargate, service discovery with AWS Cloud Map, durable state in Amazon DynamoDB, data in Amazon Aurora and Amazon Bedrock Knowledge Bases, and real-time streaming through AWS AppSync, all defined with the AWS CDK.
Explore the code on GitHub , deploy it in a development account, and adapt it to your own agents and data. To compare it with the managed approach on Amazon Bedrock AgentCore, see the Guidance for Multi-Agent Orchestration using Amazon Bedrock AgentCore on AWS .
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article