AWS Builder Center
Building a Multi-Agent Product Recommendation Chatbot with Amazon Bedrock

Building a Multi-Agent Product Recommendation Chatbot with Amazon Bedrock

Create two specialized agents that work together through a supervisor agent to provide a complete shopping experience. It explores Amazon Bedrock agent collaboration patterns, integrating serverless components with AWS Lambda and Amazon DynamoDB to create a scalable, intelligent shopping assistant.

Sharing, Learning, Growing Together

Multi-Agent Collaboration with a Supervisor Agent

The most powerful part of this workshop is multi-agent collaboration.

Specialized Agents

  • Product Recommendation Agent – Handles discovery and recommendations
  • Cart Management Agent – Manages cart operations

Creating the Supervisor Agent

You’ll create a new agent named:
shopping-supervisor-agent

Key Configuration

  • Enable Multi-Agent Collaboration
  • This designates the agent as a supervisor
  • The supervisor coordinates tasks between specialized agents

Create the Product Recommendation Agent

Create a new Agent from Amazon Bedrock Console -> Agents, name it product-details-agent
Select Anthropic Claude Sonnet 4.5 as the model, and deselect the ‘Bedrock Agent Optimized’ checkbox to see.
Select Use an existing service role and choose the role starting with producttableandapi-ws-IAMRole00AmazonBedrock
Use the following as the instructions for the agent:
1
2
3
4
5
6
7
you are a specialized product recommendation agent that focuses on getting product details.
Always start by getting the full list of products from the API so you can know the proper filter values to be used in the API parameters.
Help identify the best products based on the filters in the action groups by asking questions to identify at least one of the input filters: gender, category or occasion.
do not recommend any products that are not retrieved from the products API.
do not ask about the gender if it is obvious from the user input already.
always use a single value for each filter field, and adhere to the filtration values based on the first API call.
And never tell the user about the API and its details.
In Additional Setting section Enable User input
Important Choose “Save” on the top of the page before you proceed to next steps.
Add the get-product-recommendations action group as done in the previous sections, using the GetProductDetailsFunction Lambda function.

Add an Action group

Navigate to the Action Groups section, then choose “Add” to add an Action Group to enable the Agent to invoke the Lambda Function, put the name as get-product-recommendations and choose Action Group Type “Define with API Schemas”:
Select the ‘GetProductDetailsFunction’ Lambda function for Action Group Invocation and Choose ‘Define Via inline schema editor’ for Action Group Schema:
Use the following OpenAPI schema in the in-line OpenAPI schema section:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
"openapi": "3.0.0",
"info": {
"title": "Product Details API",
"version": "1.0.0",
"description": "This API retrieves product information. Filtering parameters are passed as query strings. If query strings are empty, it performs a full scan and retrieves the full product list."
},
"paths": {
"/products": {
"get": {
"summary": "Retrieve product details",
"description": "Retrieves a list of products based on the provided query string parameters. If no parameters are provided, it returns the full list of products.",
"operationId":"getProducts",
"parameters": [
{
"name": "product_name",
"in": "query",
"description": "Retrieve details for a specific product",
"schema": {
"type": "string"
}
},
{
"name": "category",
"in": "query",
"description": "Filter products by category",
"schema": {
"type": "string"
}
},
{
"name": "gender",
"in": "query",
"description": "Filter products by gender",
"schema": {
"type": "string"
}
},
{
"name": "occasion",
"in": "query",
"description": "Filter products by occasion",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"product_name": {
"type": "string"
},
"category": {
"type": "string"
},
"gender": {
"type": "string"
},
"occasion": {
"type": "string"
},
"product_description": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
}
Choose “Create” to create the action group, then on the Agent builder page, choose “Save” and then “Prepare” on the top of the page. Choose “Save and exit”
Choose “Create Alias” to create an Alias for the agent, name it get-product-alias

Create the Cart Management Agent

Create another agent and name it cart-management-agent. Select Anthropic Claude Sonnet 4.5 as the model, Select Use an existing service role and choose the role starting with producttableandapi-ws-IAMRole00AmazonBedrock
Use the following as the instructions for the agent:
1
2
3
4
5
6
7
8
Use the following as the instructions for the agent:

you are a specialized cart management agent that handles cart operations.
you help users add items to their cart and retrieve cart details.
ask the user about their email to use as user id for cart operations if not provided.
after adding items to cart, always show the cart contents using the get cart API.
And never tell the user about the API and its details.

In Additional Setting section Enable User input
Important Choose “Save” on the top of the page before you proceed to next steps.
Add both the add-item-to-cart and get-cart action groups as done in the previous sections.

Add new Action groups

Navigate to the Action Groups section, then choose “Add” to add an Action Group to enable the Agent to invoke the GetCartFunction Lambda Function, put the name in, get-cart and choose Action Group Type “Define with API Schemas”. Select the ‘GetCartFunction’ Lambda function for Action Group Invocation.
Select ‘Define Via Inline Schema Editor' for Action Group Schema:

schema for get cart

Use the following OpenAPI schema in the in-line OpenAPI schema section:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
"openapi": "3.0.0",
"info": {
"title": "Get Cart API",
"version": "1.0.0",
"description": "This API retrieves the items in a user's cart."
},
"paths": {
"/cart": {
"get": {
"summary": "Get the user's cart",
"description": "Retrieves the list of products in the user's cart.",
"operationId":"getCart",
"parameters": [
{
"name": "userId",
"in": "query",
"description": "The ID of the user",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"product_name": {
"type": "string"
}
}
}
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
}
}
Choose “Create” to create the action group.
Add another Action Group in the Action Groups section, Choose “Add” to add an Action Group to enable the Agent to invoke the AddToCartFunction Lambda function, put the name as add-item-to-cart and choose Action Group Type “Define with API Schemas”. Select the ‘AddToCartFunction’ Lambda function for Action Group Invocation

schema for add item to cart

Use the following OpenAPI schema in the in-line OpenAPI schema section and select ‘Define Via inline schema editor’ for Action Group Schema.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
"openapi": "3.0.0",
"info": {
"title": "Add to Cart API",
"version": "1.0.0",
"description": "This API adds a product to a user's cart."
},
"paths": {
"/cart": {
"post": {
"summary": "Add a product to the cart",
"description": "Adds a product to the user's cart. If the product already exists in the cart, it returns an error.",
"operationId":"postCart",
"parameters": [
{
"name": "userId",
"in": "query",
"description": "The ID of the user",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "productName",
"in": "query",
"description": "The name of the product to add to the cart",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
}
}
Choose “Create” to create the action group. then on the Agent builder page, Choose “Save” and then “Prepare” on the top of the page. Choose “Save and exit”
Created to an Alias for the agent; name it cart-agent-alias

Create the Supervisor Agent

Create a new Agent to act as the supervisor, name it shopping-supervisor-agent In the Multi-agent collaboration section, turn on the checkbox to Enable multi-agent collaboration. This is crucial as it identifies this agent as a supervisor that can coordinate with other agents.
Select Anthropic Claude Sonnet 4.5 as the model, Select Use an existing service role and choose the role starting with producttableandapi-ws-IAMRole00AmazonBedrock
Use the following as the instructions for the agent:
1
2
3
you are a product recommendation agent, you help users get gifts for their loved ones.
you collaborate agents to do that, one agent helps get product details and recommendations call that first to know what are the product categories and occasions, get info about the products first and don't ask about any attribute that are not in the product information.
the other agent helps you to do actions on cart, to add product to cart and get cart details, respect exact product name while adding to cart.
In Additional Setting section Enable User input
Important Choose “Save” on the top of the page before you proceed to next steps.
Now you can add both agents created above as collaborator agents in the Collaborator agents section.

Configure Multi-Agent Collaboration

After creating the supervisor agent, you need to properly configure how it will collaborate with the specialized agents.

Add the Product Recommendation Collaborator

In the supervisor agent configuration, navigate to the Multi-gent collaboration section and choose “Edit”
Expand the Agent Collaborator section, and from the Collaborator agent dropdown, select the product-details-agent and its latest alias
For Collaborator name, enter product-recommender
In the Collaboration instructions field, enter:
1
Invoke this agent when the user needs product recommendations or information about available products. This agent should be called first to understand the product catalog and get recommendations based on user preferences.
Enable Enable conversation history to allow the supervisor to share context from previous conversations. This helps maintain a coherent conversation flow when discussing products.
Click Add collaborator
From the Collaborator agent dropdown, select the cart-management-agent and its latest alias
For Collaborator name, enter cart-manager
In the Collaboration instructions field,
1
Invoke this agent when the user wants to add items to their cart or view cart contents. This agent should be called after the user has selected products they want to purchase.
Enable Enable conversation history to ensure the cart manager understands which products the user selected during their conversation with the product recommender.
Choose 'Save and exit' at the top of the page to add the agents to your collaboration team.
Then on the Agent Builder page, choose “Save” and then “Prepare” at the top of the page.

Managing Conversation History

Conversation history is critical for a seamless shopping experience.

Why Enable Conversation History?

  • Preserves context across agents
  • Prevents repetitive questions
  • Enables smooth transitions between product selection and cart management
  • Helps agents understand prior user intent and selections

How It Works

  • The supervisor shares the full conversation context
  • Includes both user inputs and agent responses
  • Collaborator agents receive relevant conversation history automatically

Best Practices

  • Enable conversation history for both collaborators
  • Let the supervisor manage context flow
  • Ensure a cohesive, natural user journey from browsing to checkout

Test the Agent

Test the Multi-Agent Setup

Now you can test how the supervisor agent coordinates between the two specialized agents:
  1. The supervisor will first engage the product recommendation agent to understand available products and get recommendations based on user preferences
  2. Once the user decides on products, the supervisor will engage the cart management agent to handle the cart operations
  3. The supervisor maintains context throughout the conversation and ensures a smooth experience
Show Trace and see in the Multi-agent collaboration trace timeline how the supervisor agent collaborates with the team of agents to fulfill the user requests
I will implement multi-agent collaboration, creating specialised agents for product recommendations and cart management, coordinated by a supervisor agent to provide a more efficient shopping experience.

Supervisor Agent

A new agent shopping-supervisor-agent acts as the orchestrator:
  • Coordinates tasks between agents
  • Determines which agent should respond
  • Maintains a unified user experience

Conversation History Matters

By enabling conversation history:
  • Context is shared across agents
  • Repetitive questions are avoided
  • The shopping journey feels seamless and intelligent
This design pattern is critical for building production-grade AI agents.

Thank you for taking the time to read my article! If you found it helpful, feel free to like, share, and drop your thoughts in the comments; I’d love to hear from you.
If you want to connect or dive deeper into cloud, AI and DevOps, feel free to follow me on my socials:
👨‍💻 DEV Community 
🛡️Medium 
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article