
Multi-Agent AI Systems on AWS: How Agents Collaborate to Solve Complex Tasks
Explore how multiple AI agents collaborate on AWS to solve complex production problems. This article covers multi-agent architecture, parallel execution using Strands Agents, Amazon Bedrock, real-world AWS troubleshooting scenarios, and the challenges of building reliable, secure, and scalable AI systems.
Introduction
A production issue in AWS rarely comes with a clear explanation.
Consider an application running on Amazon ECS behind an Application Load Balancer. Suddenly, the 5xx error rate increases, request latency goes up, and some requests start timing out.
CloudWatch raises an alarm, but the alarm only tells us that something is wrong. It does not explain why.
The engineering team needs to investigate application logs, infrastructure metrics, recent deployments, and downstream dependencies. Each source provides a different part of the problem.
Now imagine having a group of AI agents working on this investigation.
One agent examines application logs, another analyzes infrastructure metrics, and a third checks recent deployment changes. A coordinating agent brings their findings together and prepares an investigation report.
This is the idea behind multi-agent AI systems.
Instead of expecting one AI agent to handle every responsibility, we distribute the work across specialized agents that collaborate to solve a larger problem.
In this article, we'll explore how to design this architecture using AWS services, implement parallel agent execution with Strands Agents, and address the challenges of running multi-agent applications in production.
1. Understanding Multi-Agent AI Architecture
A multi-agent AI system consists of multiple specialized agents that work together to complete a task.
Each agent has:
- A clearly defined responsibility.
- Instructions describing its objective.
- Access to specific tools and information.
- A defined output that other agents can consume.
For example, an AWS incident investigation system could have the following agents:
Agent | Responsibility |
|---|---|
Coordinator Agent | Understands the request and manages the investigation |
Log Analysis Agent | Examines application and infrastructure logs |
Metrics Agent | Investigates CPU, memory, latency, and error rates |
Deployment Agent | Reviews recent deployments and configuration changes |
Investigation Agent | Correlates findings and identifies possible root causes |
Resolution Agent | Recommends corrective actions |
The important design decision is that every agent does not need access to every tool.
The Log Analysis Agent needs access to relevant log information. The Metrics Agent needs access to monitoring data. The Resolution Agent should receive investigation findings without automatically receiving permission to modify production infrastructure.
This separation makes the architecture easier to understand, secure, and maintain.
2. Designing the AWS Architecture
Let's translate the production incident into an AWS architecture.
The workflow starts when CloudWatch detects an abnormal condition and generates an alarm.
An EventBridge rule can capture the alarm state change and start an AWS Step Functions workflow.
Step Functions coordinates the investigation and allows independent tasks to execute in parallel.
AWS services involved
Amazon Bedrock
Provides access to foundation models that power the reasoning capabilities of the agents.
Strands Agents
An open-source framework for defining AI agents, their instructions, tools, and interactions using Python or TypeScript.
Amazon Bedrock AgentCore
Provides production-oriented capabilities for running and managing AI agents, including Runtime, Gateway, Identity, Memory, and Observability.
Amazon CloudWatch
Provides application logs, metrics, alarms, and monitoring information.
Amazon EventBridge
Captures CloudWatch alarm state changes and triggers the investigation workflow.
AWS Step Functions
Coordinates the workflow, executes independent investigation branches, and manages retries and failure handling.
AWS Lambda
Runs event-driven components such as alert processing and controlled AWS data retrieval functions.
Amazon S3
Stores investigation reports, supporting evidence, and historical incident information.
Architecture flow
Application on Amazon ECS | v Application Load Balancer | v Amazon CloudWatch / \ Logs Metrics \ / CloudWatch Alarm | v Amazon EventBridge | v AWS Step Functions | v Coordinator Agent | +-----------+-----------+ | | | v v v Log Agent Metrics Deployment Agent Agent | | | +-----------+-----------+ | v Investigation Agent | v Resolution Agent | v Human Approval | v Approved Recovery Action | v Amazon S3 Investigation ReportThis is one possible architecture, not a mandatory combination of AWS services.
For example, Step Functions can manage the workflow's parallel execution, while SQS can be introduced when independent tasks need asynchronous queuing and additional decoupling.
Similarly, Strands can implement the agent logic, while AgentCore Runtime can host agents that need a dedicated managed runtime.
3. How Do Agents Collaborate?
Let's follow the execution of one production incident.
Step 1: Coordinator Agent receives the alert
The Coordinator Agent receives information from the monitoring workflow.
For example:
{ "application": "payment-service", "environment": "production", "aws_resource": "ecs-payment-service", "alert": "High HTTP 5xx error rate", "timestamp": "2026-11-06T10:30:00Z"}The coordinator identifies which investigations are required.
It delegates the work to the Log Analysis Agent, Metrics Agent, and Deployment Agent.
These investigations can run independently because they use different information sources.
Step 2: Log Analysis Agent investigates application logs
The Log Analysis Agent retrieves relevant application logs through a controlled CloudWatch Logs Insights query.
For example, it might identify:
ERROR: Database connection timeoutERROR: Connection pool exhaustedERROR: Request processing exceeded timeoutIt converts the observations into a structured response:
{ "agent": "log_analysis", "status": "completed", "findings": [ "Repeated database connection timeouts", "Connection pool exhaustion detected" ], "evidence": { "log_group": "/aws/ecs/payment-service", "time_window": "Last 30 minutes" }}The agent should report only what the retrieved logs support.
Step 3: Metrics Agent investigates infrastructure
The Metrics Agent independently analyzes CloudWatch metrics.
It checks:
- ECS CPU utilization.
- ECS memory utilization.
- Application Load Balancer response time.
- HTTP 5xx error counts.
- Database connection utilization, where applicable.
Suppose the investigation identifies increased database connection utilization during the same period as the application failures.
It returns:
{ "agent": "metrics_analysis", "status": "completed", "findings": [ "Database connection utilization increased", "Application response latency increased" ], "severity": "high"}Step 4: Deployment Agent checks recent changes
The Deployment Agent reviews recent deployment information.
It can examine:
- ECS service deployment history.
- Task definition revisions.
- Container image versions.
- Configuration changes.
- Deployment timestamps.
Suppose a new application version was deployed shortly before the error rate increased.
The agent reports that the deployment and incident occurred close together.
This is useful evidence, but timing alone does not prove that the deployment caused the incident.
Step 5: Investigation Agent correlates the findings
Now the Investigation Agent receives the results from the previous agents.
It compares the log events, infrastructure metrics, and deployment history.
For example:
- Logs show repeated database connection timeouts.
- Metrics show increased database connection utilization.
- Deployment history shows a new application version shortly before the incident.
Together, these observations suggest that a recent application change may have increased database connection usage.
The Investigation Agent should identify this as a possible root cause and recommend additional validation rather than presenting correlation as confirmed causation.
Step 6: Resolution Agent recommends corrective actions
The Resolution Agent receives the investigation report.
It may recommend:
- Reviewing database connection pool settings.
- Checking application changes in the latest deployment.
- Investigating long-running database queries.
- Reviewing database connection limits.
- Considering a rollback if the deployment is confirmed to be responsible.
The agent generates a recommendation, not an unrestricted production command.
A human engineer reviews the evidence and approves any high-impact recovery action.
This distinction is important: AI can help investigate an incident without being given unrestricted control over production infrastructure.
4. Implementing Parallel Agent Execution with Strands Agents
Let's look at a practical Python implementation.
There are two separate activities in this workflow:
- Retrieving actual information from AWS.
- Asking specialized agents to analyze that information.
We should not replace real AWS data with manually written examples when demonstrating a production investigation.
The following example uses Boto3 to retrieve CloudWatch data and Strands Agents to analyze it.
Install dependencies
pip install strands-agents boto3Configure AWS credentials and ensure the execution role has the required permissions.
For this example, the role needs appropriate access to:
-
logs:StartQuery
-
logs:GetQueryResults
-
cloudwatch:GetMetricData
-
bedrock:InvokeModel
Use narrowly scoped IAM policies in production.
Step 1: Retrieve application logs from CloudWatch
import boto3import time
from datetime import datetime, timedelta, timezone
REGION = "us-east-1"
LOG_GROUP = "/aws/ecs/payment-service"
logs_client = boto3.client( "logs", region_name=REGION)
def fetch_recent_logs(minutes=30):
end_time = datetime.now(timezone.utc) start_time = end_time - timedelta(minutes=minutes)
response = logs_client.start_query( logGroupName=LOG_GROUP, startTime=int(start_time.timestamp()), endTime=int(end_time.timestamp()), queryString=""" fields @timestamp, @message | filter @message like /ERROR|Exception|timeout/ | sort @timestamp desc | limit 100 """ )
query_id = response["queryId"] deadline = time.monotonic() + 60
while time.monotonic() < deadline:
result = logs_client.get_query_results( queryId=query_id )
status = result["status"]
if status == "Complete": return result["results"]
if status in ("Failed", "Cancelled", "Timeout"): raise RuntimeError( f"CloudWatch query failed: {status}" )
time.sleep(2)
raise TimeoutError( "CloudWatch Logs Insights query exceeded 60 seconds" )This function submits a CloudWatch Logs Insights query and retrieves the matching records.
The time window is configurable, and the query has a bounded execution period.
Step 2: Retrieve infrastructure metrics
Next, retrieve ECS and database metrics from CloudWatch.
The metric dimensions must match the resources configured in your AWS environment.
import os
cloudwatch = boto3.client( "cloudwatch", region_name=REGION)
CLUSTER_NAME = os.environ["ECS_CLUSTER"]SERVICE_NAME = os.environ["ECS_SERVICE"]DB_INSTANCE = os.environ["DB_INSTANCE"]
def fetch_metrics(minutes=30):
end_time = datetime.now(timezone.utc) start_time = end_time - timedelta(minutes=minutes)
queries = [
{ "Id": "ecs_cpu", "MetricStat": { "Metric": { "Namespace": "AWS/ECS", "MetricName": "CPUUtilization", "Dimensions": [ { "Name": "ClusterName", "Value": CLUSTER_NAME }, { "Name": "ServiceName", "Value": SERVICE_NAME } ] }, "Period": 300, "Stat": "Average" }, "ReturnData": True },
{ "Id": "ecs_memory", "MetricStat": { "Metric": { "Namespace": "AWS/ECS", "MetricName": "MemoryUtilization", "Dimensions": [ { "Name": "ClusterName", "Value": CLUSTER_NAME }, { "Name": "ServiceName", "Value": SERVICE_NAME } ] }, "Period": 300, "Stat": "Average" }, "ReturnData": True },
{ "Id": "db_connections", "MetricStat": { "Metric": { "Namespace": "AWS/RDS", "MetricName": "DatabaseConnections", "Dimensions": [ { "Name": "DBInstanceIdentifier", "Value": DB_INSTANCE } ] }, "Period": 300, "Stat": "Average" }, "ReturnData": True } ]
response = cloudwatch.get_metric_data( MetricDataQueries=queries, StartTime=start_time, EndTime=end_time, ScanBy="TimestampAscending" )
return response["MetricDataResults"]This example retrieves three metric series.
For a complete incident investigation, additional queries can be added for Application Load Balancer metrics, including target response time and HTTP 5xx counts.
Make sure the resources publish the selected metrics and that the dimensions match the actual AWS resource identifiers.
Step 3: Create specialized agents
Strands Agents provides a simple Python interface for creating agents.
Amazon Bedrock can be used as the model provider.
from strands import Agent
log_agent = Agent( system_prompt=""" You are a production log analysis specialist.
Analyze the supplied CloudWatch log records.
Identify: - Repeated errors - Timeouts - Application exceptions - Relevant patterns
Include supporting evidence. Never invent log events. """)
metrics_agent = Agent( system_prompt=""" You are an AWS infrastructure metrics specialist.
Analyze the supplied CloudWatch metrics.
Identify: - Unusual resource utilization - Changes in database connections - Potential infrastructure bottlenecks - Metric trends during the incident
Separate observations from assumptions. """)
investigation_agent = Agent( system_prompt=""" You are a production incident investigation specialist.
Compare the findings from the log and metrics agents.
Identify possible root causes.
Return: 1. Confirmed observations 2. Supporting evidence 3. Possible root causes 4. Missing information 5. Recommended next investigation steps
Never claim causation without sufficient evidence. """)The default Strands model provider is Amazon Bedrock. The application must have suitable AWS credentials, model access, and regional configuration.
Step 4: Execute independent investigations in parallel
This is where parallel execution becomes useful.
The log and metrics investigations do not depend on each other. We can execute them concurrently using Python's
ThreadPoolExecutor .import json
from concurrent.futures import ThreadPoolExecutor
def investigate_incident():
with ThreadPoolExecutor(max_workers=2) as executor:
logs_future = executor.submit( fetch_recent_logs )
metrics_future = executor.submit( fetch_metrics )
log_data = logs_future.result( timeout=90 )
metrics_data = metrics_future.result( timeout=90 )
log_result = log_agent( json.dumps(log_data, default=str) )
metrics_result = metrics_agent( json.dumps(metrics_data, default=str) )
investigation_input = f""" LOG INVESTIGATION:
{log_result}
INFRASTRUCTURE METRICS INVESTIGATION:
{metrics_result}
Correlate the findings.
Identify confirmed observations, possible root causes, missing evidence, and recommended next steps. """
final_result = investigation_agent( investigation_input )
return final_result
if __name__ == "__main__":
result = investigate_incident()
print("Incident Investigation Report:") print(result)The first two AWS data retrieval operations execute concurrently. Once both have completed, their results are analyzed by specialized agents.
The agent analysis itself is sequential in this simplified example because the Investigation Agent depends on both results.
For a larger workflow, the Deployment Agent can also execute independently alongside the Log Analysis and Metrics Agents.
Important: This is an implementation example, not a complete production deployment. A production workflow should add bounded retries, explicit handling for partial failures, structured output validation, request tracing, and secure configuration. The example also assumes the CloudWatch queries return within their configured execution limits.
5. Why Not Use One Agent for Everything?
A natural question is why we need multiple agents when a single agent can already call several tools.
The answer depends on the complexity of the problem.
Single-agent approach | Multi-agent approach |
|---|---|
One agent handles multiple responsibilities | Responsibilities are distributed |
Larger collection of tools and instructions | Specialized toolsets |
One main reasoning workflow | Multiple collaborating workflows |
Simpler orchestration | More orchestration complexity |
Easier to start with | Useful for complex investigations |
A single agent may be sufficient for a simple task such as retrieving an S3 object and summarizing its contents.
However, when an application requires independent investigations, different access permissions, and multiple stages of reasoning, specialized agents can make the architecture easier to manage.
There is a trade-off.
More agents can mean more model invocations, additional latency, higher token consumption, and more complicated debugging.
Adding agents does not automatically make an AI application more accurate.
The architecture should justify every additional agent.
6. Production Challenges You Should Consider
A multi-agent demo can look impressive. Running it reliably in production requires a different level of engineering.
Here are some challenges worth considering.
Agent communication failures
What happens if the Metrics Agent fails while the Log Analysis Agent succeeds?
The coordinator needs to track the execution status of each agent.
Depending on the investigation, it can retry the failed task, continue with partial findings, or stop the workflow and request human intervention.
Infinite agent loops
Agents can repeatedly request additional information or delegate work without making progress.
Define maximum execution steps, timeouts, and explicit stopping conditions.
Conflicting conclusions
The Log Analysis Agent may identify database connection failures, while the Metrics Agent identifies high CPU utilization.
Both observations may be correct.
The Investigation Agent should preserve these findings and request additional evidence instead of selecting one explanation without justification.
Token consumption and infrastructure costs
Every model invocation has an associated cost.
Imagine five agents independently analyzing the same large collection of logs.
The system may spend unnecessary tokens processing duplicated information.
Some ways to reduce this include:
- Retrieve only relevant log records.
- Limit the amount of context passed between agents.
- Reuse validated investigation results.
- Use smaller models for straightforward classification tasks.
- Measure cost per completed investigation.
Security and IAM permissions
This is one of the most important parts of an AWS multi-agent architecture.
A Log Analysis Agent should not need permission to delete an S3 bucket.
A Metrics Agent should not need permission to modify ECS services.
Use narrowly scoped IAM roles and controlled tools. Where agents run as separate workloads, give each workload only the permissions it needs.
For high-impact production changes, require explicit human approval before execution.
7. Where Amazon Bedrock AgentCore Fits
Building agent logic is only one part of operating a production AI application.
As the number of agents increases, managing execution, identity, tools, memory, and observability becomes increasingly important.
This is where Amazon Bedrock AgentCore becomes relevant.
Some of its capabilities include:
AgentCore Runtime: Provides a managed environment for deploying and running agents.
AgentCore Gateway: Helps expose tools and services to agents through a managed gateway.
AgentCore Identity: Supports identity and authorization for agent access to resources.
AgentCore Memory: Provides capabilities for maintaining context across interactions.
AgentCore Observability: Helps monitor agent execution and behavior.
These capabilities address different operational requirements.
For example, Strands Agents can define the supervisor and specialist agents, while AgentCore Runtime can host them.
The architecture can then use AgentCore Observability to inspect execution traces and investigate agent failures.
Strands Agents and AgentCore are complementary: one provides the agent development framework, while the other provides production-oriented infrastructure and capabilities.
Not every application needs all AgentCore components. Select them according to the actual requirements.
8. When Should You Use Multi-Agent Architecture?
Multi-agent architecture is not the right solution for every AI application.
A single agent is often a better starting point when:
- The task has a straightforward workflow.
- Only a few tools are required.
- The context is relatively small.
- The task does not require independent investigations.
Multiple agents become useful when:
- Different tasks require specialized responsibilities.
- Independent investigations can run in parallel.
- Different agents need different tool permissions.
- The workflow involves several stages of reasoning.
- Investigation and execution need to be separated.
Before adding another agent, ask one question:
Does this responsibility genuinely need a separate agent, or can an existing agent handle it through a tool?
That question can prevent unnecessary complexity.
Conclusion
Multi-agent AI systems offer a practical way to break complex tasks into smaller responsibilities.
In our AWS production troubleshooting example, one agent examines application logs, another investigates infrastructure metrics, and another reviews deployment changes. An investigation agent brings the findings together before a resolution is recommended.
The interesting part is not simply having several AI agents running at the same time.
It is designing a system where each agent has a clear responsibility, receives relevant information, follows appropriate permissions, and produces findings that can be verified.
AWS services such as Amazon Bedrock, Strands Agents, AgentCore, Lambda, Step Functions, and CloudWatch provide building blocks for developing these architectures.
However, more agents do not automatically mean better results. Reliability, observability, security, and cost management still determine whether the system is useful in production.
A useful multi-agent architecture is not one where every task has an agent. It is one where every agent has a clear reason to exist.
References and Further Reading
- Amazon Bedrock: https://aws.amazon.com/bedrock/
- Amazon Bedrock AgentCore: https://aws.amazon.com/bedrock/agentcore/
- Strands Agents Documentation: https://strandsagents.com/
- AWS Multi-Agent Orchestration Guidance: https://docs.aws.amazon.com/solutions/multi-agent-orchestration-on-aws/
- AWS Step Functions: https://aws.amazon.com/step-functions/
- Amazon CloudWatch: https://aws.amazon.com/cloudwatch/
- Amazon EventBridge: https://aws.amazon.com/eventbridge/
The architecture and code in this article are illustrative. Validate AWS resource dimensions, model availability, SDK versions, IAM permissions, and service integrations in your environment before deploying.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article