How to Build Multi-Agent Collaboration on AWS Bedrock: A Financial Assistant Tutorial

How to Build Multi-Agent Collaboration on AWS Bedrock: A Financial Assistant Tutorial

๐Ÿ’ฐ Discover How AWS Bedrock Allows Multiple AI Agents to Collaborate Effectively, Highlighted by a Financial Assistant Example

ยท

8 min read

๐Ÿ“Œ Introduction

Why Multi-Agent AI is the Future?

At AWS re:Invent 2024, AWS introduced Multi-Agent Collaboration for Bedrock, enabling developers to build AI systems where multiple agents work together to tackle complex tasks. Instead of relying on a single AI model, specialized agents can now interact, delegate tasks, and optimize workflows dynamically. Read the announcement here.

Traditional AI models often struggle with multi-step workflows, requiring manual orchestration to delegate tasks. With Multi-Agent Collaboration, AI-powered workflows become more scalable, efficient, and adaptive, allowing specialized AI agents to seamlessly collaborate for better decision-making and automation.

๐Ÿš€ Whatโ€™s in This Blog?

In this blog, we will explore:

1๏ธโƒฃ What is AWS Bedrock & Multi-Agent Collaboration?
2๏ธโƒฃ Why Multi-Agent AI is More Effective Than Single-Agent AI?
3๏ธโƒฃ A Practical Example: Building a Multi-Agent Financial Assistant
4๏ธโƒฃ Step-by-Step Guide to Creating Agents in AWS Bedrock
5๏ธโƒฃ Architecture & Technical Details

To showcase Multi-Agent Collaboration, weโ€™ll build an AI-powered financial assistant with three specialized agents:

๐Ÿ‘จโ€๐Ÿ’ผ Supervisor Agent โ€“ Orchestrates workflows, delegates tasks, and consolidates responses.
๐Ÿ’ณ Expense Analyzer โ€“ Fetches user transactions from DynamoDB and categorizes spending.
๐Ÿ“Š Budget Optimizer โ€“ Retrieves budgeting strategies from a Knowledge Base and suggests plans.
๐Ÿ’ฐ Investment Advisor โ€“ Uses market insights from a Knowledge Base to provide investment recommendations.

By the end of this blog, you'll know how to build and deploy multi-agent AI systems using AWS Bedrock.

๐Ÿ“Œ What is AWS Bedrock?

AWS Bedrock is a fully managed service for developers to build and scale AI applications using Foundation Models (FMs) without managing infrastructure.

๐Ÿ’ก Key Features of AWS Bedrock

โœ… Access to top Foundation Models (Claude, Nova, Titan, Llama, etc.).
โœ… No infrastructure management โ€“ No need for GPU provisioning.
โœ… Multi-Agent Collaboration โ€“ Agents can dynamically interact to complete tasks.
โœ… Seamless AWS integration โ€“ Works with Lambda, DynamoDB, S3, and more.

A core feature is Multi-Agent Collaboration, enabling AI agents to:

โœ… Collaborate on complex tasks in real-time.
โœ… Use a Supervisor Agent for task delegation and orchestration.
โœ… Access external APIs and databases for real-time information retrieval.

๐Ÿ“Œ Why Multi-Agent AI?

Traditional AI models handle one task at a time, but real-world problems require multiple specialized AI agents working together.

๐Ÿ’ก Key Benefits of Multi-Agent AI

โœ… Scalability โ€“ Easily expand capabilities by adding/removing agents.
โœ… Efficiency โ€“ Specialized agents optimize workflow execution.
โœ… Resilience โ€“ If one agent fails, others can adapt and recover.
โœ… Modularity โ€“ Each agent can evolve independently.

These advantages make Multi-Agent Collaboration ideal for complex AI workflows, from finance and business automation to healthcare and customer support.

๐Ÿ“Œ Multi-Agent Collaboration in AWS Bedrock

AWS Bedrock natively supports multi-agent workflows, allowing agents to:
1๏ธโƒฃ Work together to solve complex tasks.
2๏ธโƒฃ Communicate via a Supervisor Agent that delegates work.
3๏ธโƒฃ Access external APIs (Lambda, DynamoDB, etc.) for real-time data.

๐Ÿ“Œ Step-by-Step: Creating Multi-Agent Collaboration in AWS Bedrock

Note: This blog does not include all screenshots to keep it concise. For a detailed step-by-step guide with images, please refer to the attached PDF.

๐Ÿ“„ Download Full Step-by-Step Guide (PDF) ๐Ÿ“ฅ

๐Ÿ’ก
I used AWS Nova - Micro - New Foundation models (FMs) introduced in Reinvent 2024 by AWS , available exclusively in Amazon Bedrock

โœ… Go to AWS Bedrock Console โ†’ Agents โ†’ Create Agent

Below are the all 4 Agents after creation.

Supervisor Agent and it's Sub Agent

1๏ธโƒฃStep 1: Create Sub-Agents - 3 individual Agent

โœ… Expense Analyzer โ†’ Fetches transactions from DynamoDB using AWS Lambda.

โžก๏ธExpense Analyzer Agent details

This is the Instructions for the Expense Analyzer Agent

You are an expense tracking assistant.
- Fetch user transactions from DynamoDB using the provided user name.
- If the user provides their name (e.g., "I am Sam") , use it directly as the user ID don't ask for user ID explicitly.
- If no name is provided, ask for clarification before proceeding.
- Categorize expenses into essential and non-essential spending from data.
- Provide a structured response with transaction details.
- Ensure responses are easy to read and summarize spending trends.

Model used : Amazon Nova Micro

โžก๏ธThis is mapped to action group which uses the Lambda which fetches Data from DynamoDB

โœ… Budget Optimizer โ†’ Retrieves budgeting strategies from Bedrock Knowledge Base.

โžก๏ธBudget Optimizer Agent details

This is the Instructions for the Budget Optimizer Agent

You are a financial budget optimization expert.
- Retrieve budgeting frameworks from the Knowledge Base.
- Apply financial rules such as 50/30/20 allocation for expenses.
- Suggest areas where users can cut costs.
- Provide estimated savings based on income and expenses.

Model used : Amazon Nova Micro

โžก๏ธThis is mapped to the Knowledge base which is created in Bedrock

โœ… Investment Advisor โ†’ Uses financial data in Knowledge Base for investment planning.

โžก๏ธInvestment Advisor agent details

This is the Instructions for the Investment Advisor agent

You are an AI-powered investment advisor.
- Retrieve investment strategies from the Knowledge Base.
- Recommend asset allocation based on risk profile.
- Suggest stocks, bonds, mutual funds, or fixed deposits.
- Provide estimated ROI based on historical market trends.

โžก๏ธThis is mapped to a Knoweledge base (Data source)

2๏ธโƒฃStep 2: Create the Supervisor Agent

โœ…Supervisor Agent โ€“ The orchestrator that delegates tasks and consolidates responses. Details below,

This is the Instructions for the Investment Advisor agent

You are a financial assistant managing budgets and investments.
- Use the provided user name to retrieve transaction history.
- Invoke the Expense Analyzer to analyze past spending trends.
- Invoke the Budget Optimizer to suggest budget recommendations based on spending patterns.
- Invoke the Investment Advisor to provide investment strategies using estimated savings.
- If the user does not specify their savings, estimate it based on income and expense patterns.
- Assume a moderate risk profile if no risk preference is provided.
- Consolidate responses into a structured financial plan.

Model used : Amazon Nova Micro

โœ…Enable Multi-Agent Collaboration

โœ… Set up agent Collaborator

An agent in the multi-agent collaboration that orchestrates and returns a final response.

3๏ธโƒฃStep 3: Prepare & Test all the Agents individually

4๏ธโƒฃ Deploy and Test

Run test queries to validate agent interactions.

๐Ÿ“Œ About Data : Understanding the Datasets Used by Sub-Agents

Each sub-agent in this Multi-Agent Collaboration project relies on different datasets to function effectively:

โœ… Expense Analyzer (DynamoDB Transactions Data) โ€“ Fetches user transactions from DynamoDB, including details like amount, category, date, merchant, and payment method.

โœ… Budget Optimizer (Knowledge Base PDFs) โ€“ Retrieves budgeting strategies from an Amazon S3-based Knowledge Base, containing guides on budgeting models like the 50/30/20 Rule.

โœ… Investment Advisor (Knowledge Base PDFs) โ€“ Uses investment research, risk profiles, and asset allocation strategies stored in Amazon S3 to provide investment recommendations.

By integrating DynamoDB for transactional data and S3-based Knowledge Bases for financial insights, AWS Bedrock agents can deliver accurate budgeting and investment strategies, making AI-driven financial decision-making seamless.

S3 Bucket data :

DyanmoDB data :

๐Ÿ“Œ Example Queries & Expected Results

๐Ÿ“Œ Trying these queries in AWS Bedrock Console:

Query 1: Expense Analysis Only

๐Ÿ“ Question: I am Sam. Analyze my spending, show top 5.

Since the query only asks for top 5 expenses, Uses only Expense Analyzer to fetch and categorize transactions.

Query 2: Full Financial Insights (All Three Agents)

๐Ÿ“ Question: I am Sam. Show my top 5 expenses, analyze my spending, and suggest a budget. Also, recommend investments based on my savings.

This query engages all three agents:
โœ… Expense Analyzer โ†’ Fetches spending data.
โœ… Budget Optimizer โ†’ Suggests budget recommendations.
โœ… Investment Advisor โ†’ Provides investment strategies based on savings.

๐Ÿ” Multi-Agent Collaboration Trace: This scenario demonstrates how AWS Bedrock enables agents to communicate efficiently, delegating tasks and consolidating insights into a structured financial response.

Query 3: Expense & Budget Optimization (Without Investment Advice)

**๐Ÿ“ Question:**I am John. Show my top 5 expenses, analyze my spending, and suggest a budget.

This query engages only two agents:
โœ… Expense Analyzer โ†’ Retrieves and categorizes expenses.
โœ… Budget Optimizer โ†’ Uses financial best practices to suggest budget allocations.

Since investment recommendations are not requested, the Investment Advisor Agent is not invoked, showing how Bedrock dynamically optimizes agent interactions based on user intent.

๐Ÿ’ก Why These Queries Matter?

  • Showcases how AWS Bedrock dynamically selects relevant agents based on query complexity.

  • Highlights multi-agent orchestration in real-world financial scenarios.

  • Provides clear trace insights into agent collaboration efficiency.

๐Ÿš€Key Takeaways

๐Ÿ’ก Learnings from This Project

โœ… Multi-Agent Collaboration in AWS Bedrock improves scalability, efficiency, and automation by dynamically distributing tasks across specialized agents.
โœ… A Supervisor Agent streamlines complex workflows by managing Expense Analyzer, Budget Optimizer, and Investment Advisor interactions.
โœ… DynamoDB and S3-based Knowledge Bases provide structured, real-time financial data for accurate recommendations.
โœ… AWS Lambda and API Gateway enable seamless integration, allowing agents to be accessed via external APIs.
โœ… Testing and trace analysis help fine-tune agent collaboration, ensuring optimal task delegation.

This project highlights how Multi-Agent AI can automate financial decision-making while maintaining flexibility and adaptability. ๐Ÿš€

๐Ÿš€ Conclusion

AWS Bedrockโ€™s Multi-Agent Collaboration streamlines complex workflows by enabling specialized agents to work together efficiently. This project demonstrated how AI agents can automate financial decision-making, integrating Bedrock, Lambda, and S3 into a scalable AI system.

๐Ÿ’ก Start exploring AWS Bedrockโ€™s Multi-Agent AI today! ๐Ÿš€

๐Ÿ”— Letโ€™s Connect!

๐Ÿ“Œ GitHub Repo: https://github.com/SridharSampath/multi-agent-collaboration.git
๐Ÿ“Œ LinkedIn: Connect with me

๐Ÿ“Œ References: (Include AWS Blogs, YouTube Videos, etc.)

๐Ÿ”น AWS Blog: Multi-Agent Orchestration with AWS Bedrock & Open Source Frameworks
๐Ÿ”— https://aws.amazon.com/blogs/machine-learning/design-multi-agent-orchestration-with-reasoning-using-amazon-bedrock-and-open-source-frameworks/

๐Ÿ”นAWS Announcement: Multi-Agent Collaboration for AWS Bedrock
๐Ÿ”— https://aws.amazon.com/blogs/aws/introducing-multi-agent-collaboration-capability-for-amazon-bedrock/

๐Ÿ”น YouTube: Multi-Agent AI for Scalable Generative AI
๐Ÿ”— https://www.youtube.com/watch?v=7pvEYLW1yZw&t=3151s

๐Ÿ”น YouTube: AWS Bedrock Multi-Agent Demo
๐Ÿ”— https://www.youtube.com/watch?v=tMqTy1HR974&t=67s

๐Ÿ’ฌ Let me know your thoughts in the comments! ๐Ÿ‘‡

ย