You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Understanding What Queries Work](#-understanding-what-queries-work-and-why)
16
16
17
-
18
17
## App Scenario: Personalized E-Commerce with GenAI Agents
19
18
20
19
**AgenticShop** is a GenAI-powered e-commerce demo that showcases how multi-agent systems and in-database intelligence can deliver personalized shopping experiences.
@@ -71,6 +70,7 @@ The following image shows the high-level architecture of the solution, highlight
71
70
### 🏗️ Infrastructure Summary
72
71
73
72
The solution is deployed entirely within a single **Azure Resource Group** and uses the following core infrastructure:
73
+
74
74
-**Azure Container Apps Environment**
75
75
-**Azure OpenAI**
76
76
-**Azure Flexible PostgreSQL Server**
@@ -80,83 +80,101 @@ The solution is deployed entirely within a single **Azure Resource Group** and u
80
80
## 🚀 Solution Accelerator Deployment
81
81
82
82
### 🧰 Prerequisites
83
+
83
84
The following are prerequisites for deploying this solution:
6. Appropriate roles attached to user for solution deployment (`Contributor` role and `Role Based Admin Control Administrator` role for the subscription)
5. Appropriate roles attached to user for solution deployment (`Contributor` role and `Role Based Admin Control Administrator` role for the subscription)
91
+
6.[Git](https://git-scm.com/)
91
92
92
93
### 🛠️ Deployment Steps
93
94
94
95
#### Clone the Repository
96
+
95
97
Clone the repository. Once done, navigate to the repository:
To log in to Azure CLI, use the following command. You can use the `--use-device-code` flag if the command fails.
107
+
103
108
```sh
104
109
az login
105
110
```
111
+
106
112
To log in to Azure Developer CLI, use this command. You can use the `--use-device-code` flag if the command fails.
113
+
107
114
```sh
108
115
azd auth login
109
116
```
110
117
111
118
#### Create a new Azure Developer environment
119
+
112
120
In the root of the project, execute the following command to create a new `azd` environment. Provide a name for your `azd` environment:
121
+
113
122
```sh
114
123
azd env new
115
124
```
116
125
117
-
#### Grant permissions to azd hook scripts
118
-
If you are deploying the solution from **Windows**, run the following command to grant permissions to the current session to execute `pwsh` scripts located in the `azd-hooks` directory:
119
-
```sh
126
+
#### **Windows Users Only – Grant permissions to azd hook scripts**
127
+
128
+
> **⚠️ IMPORTANT:** This step is **only** required if you are deploying from **Windows**.
129
+
> **Mac** and **Linux** users can skip this — nothing needs to be done.
130
+
131
+
If you are on **Windows**, run the following command in your current terminal session to allow execution of `pwsh` scripts located in the `azd-hooks` directory:
132
+
133
+
```powershell
120
134
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
121
-
```
122
135
123
-
If you are deploying the solution from **Unix-like environment on Windows OS** (for instance Cygwin, MinGW), grant the following permissions for execution of scripts in the `azd-hooks` directory:
**NOTE** that this solution uses postgres authentication for creating connection to database. It is recommended to change the `ADMINISTRATOR_LOGIN_USER` and `ADMINISTRATOR_LOGIN_PASSWORD` parameters in `main.parameters.json` file in `infra` directory before deployment as best security practice.
130
139
131
-
1. Run the following command to provision the resources.
132
-
```sh
133
-
azd up
134
-
```
135
-
Once the above command is executed, the `azd` workflow prompts user to select the subscription for deployment, two locations (one for the solution accelerator resources and another for Azure OpenAI models), and the resource group to create.
140
+
> **NOTE:** This solution uses PostgreSQL username/password authentication. During deployment, the admin login and password are **autogenerated** and written to your project’s `.env` file.
141
+
> Keep your `.env` file out of version control.
142
+
143
+
1. Run the following command to provision the resources:
144
+
145
+
```sh
146
+
azd up
147
+
```
148
+
149
+
Once the above command is executed, the `azd` workflow prompts user to selectthe subscription for deployment, location and the resource group to create.
136
150
137
151
2. Make sure that you have enough Azure OpenAI model quota in the region of deployment. **The `azd` workflow automatically filters and shows the region where the Azure OpenAI quota is available.** The Azure OpenAI quota required for`GlobalStandard` **deployment type** for this solution is listed below. This configuration can be changed from the `main.parameters.json` filein the `infra` directory using the following parameters:
If you have changed the above parameters from the `main.parameters.json` file, you **must change** the following configuration in `main.bicep` file so that the changes are reflected in automatic Azure OpenAI region filtering as well:
If you have changed the above parameters from the `main.parameters.json` file, you **must change** the following configuration in`main.bicep` file so that the changes are reflected in automatic Azure OpenAI region filtering as well:
3. Before the `azd` workflow proceeds, checks are performed in the selected infra region and recommendations are generated on failure for following cases to ensure that the deployment is successful.
155
-
- Azure Flexible Server for PostgreSQL SKU
172
+
- Azure Flexible Server forPostgreSQL SKU [we recommend avoiding burstable instances as they might resultin"Illegal Instruction" error in certain regions for vector queries]
156
173
- Azure Container Apps quota
157
174
- azd env name
158
175
159
-
4. After creating the resource group, the workflow prompts the user for the Azure Container Apps deployment. Input `yes` as shown below. The deployment might take some time and will provide progress updates in the terminal as well as on the Azure Portal.
176
+
4. After creating the resource group, the workflow prompts the user for the Azure Container Apps deployment. Input `yes` as shown below -- this will build the docker images and deploy to Azure Container Apps. The docker image build can take 15+ mins.
177
+
160
178
```sh
161
179
Do you want to deploy Azure Container Apps? (y/n): yes
162
180
```
@@ -168,23 +186,27 @@ Once the deployment is complete, `azd` will output the **application URLs** for
168
186
>**Note:** Make sure to **copy the frontend URL** displayed in the output and open it in your browser to access the application.
169
187
170
188
### 🧹 Tear Down
189
+
171
190
To destroy all the resources that have been created in the steps above, as well as remove any accounts deployed by the solution accelerator, use the following command:
191
+
172
192
```sh
173
193
azd down --purge
174
194
```
195
+
175
196
The `--purge` flag deletes all the accounts permanently.
176
197
177
198
### 🛟 Troubleshooting
178
-
1. The troubleshooting guide for `azd cli` is [here](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/troubleshoot?tabs=Browser).
179
-
2. A validation error occurs when unsupported characters, such as `_`, `#` etc. are used while initializing or creating a new environment or resources. Refer to [rules and restrictions](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules) for naming conventions.
199
+
200
+
1. The [troubleshooting guide](https://learn.microsoft.com/azure/developer/azure-developer-cli/troubleshoot?tabs=Browser) for`azd cli`.
201
+
2. A validation error occurs when unsupported characters, such as `_`, `#` etc. are used while initializing or creating a new environment or resources. Refer to [rules and restrictions](https://learn.microsoft.com/azure/azure-resource-manager/management/resource-name-rules) for naming conventions.
180
202
3. A scope error occurs when the user does not have appropriate permissions when deploying resources through `azd` workflow. Attach `Contributor` role and `Role Based Access Control Administrator` role to user permissions before deploying the solution accelerator.
181
203
4. When `The resource entity provisioning state is not terminal. Please waitfor the provisioning state to become terminal and then retry the request` error occurs, restart the deployment using the `azd up` command.
182
204
183
205
### 📝 Additional Notes
184
206
185
207
- Ensure all services are running and accessible at their respective ports.
186
208
- If you encounter issues, check the logs for each service and verify your environment variables.
187
-
- For troubleshooting Azure deployments, refer to the [Azure Developer CLI troubleshooting guide](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/troubleshoot).
209
+
- For troubleshooting Azure deployments, refer to the [Azure Developer CLI troubleshooting guide](https://learn.microsoft.com/azure/developer/azure-developer-cli/troubleshoot).
188
210
- Make sure Docker has sufficient resources allocated for smooth operation.
189
211
190
212
## 🤖 Multi-Agent Personalization Workflow
@@ -205,8 +227,9 @@ These agents are orchestrated via LlamaIndex’s `Workflow` module, providing tr
205
227
### 🧬 Personalization & Memory
206
228
207
229
The system uses **mem0** to persist user preferences across sessions. This memory influences agent behavior in real time:
230
+
208
231
- Past interactions are retrieved at workflow start
209
-
- New preferences (e.g., “I care about portability”) are stored dynamically
232
+
- New preferences (e.g., “I want always see critical reviews about durability”) are stored dynamically
210
233
- All memory is stored in the `mem0_chatstore` table in PostgreSQL
211
234
212
235
> Agent prompts can be modified in [`backend/src/agents/prompts.py`](backend/src/agents/prompts.py) to customize tone, structure, or output logic.
@@ -240,39 +263,31 @@ Experience how AgenticShop delivers tailored product suggestions through multi-a
- On the top right is the **Agentic Flow** drawer which provides an under-the-hood look at the multi-agent flow. Open the **Agentic Flow** panel to inspect how each agent participates in this multi-agent flow. Note that all agents are not always triggered. For example, in this case the review agent is not triggered.
- Now, open a different product whose personalization hasn’t been generated yet. You should see a new section highlighting **critical reviews about durability** as part of the personalized output.
> ⚠️ Note: Personalizations are cached for performance. If a product’s personalization was generated *before* the new memory was saved, it may not reflect the updated preference. Personalization workflow typically takes **~10 seconds** to complete.
277
292
278
293
This walkthrough showcases how AgenticShop delivers a responsive, transparent, and memory-driven shopping experience.
@@ -303,7 +318,6 @@ This agent is equipped with **three tools**, each designed to handle a distinct
303
318
Query (on a product detail page): `"Always show if red color is available in stock"`
304
319
→ The agent invokes the `query_about_product` tool, launching the multi-agent personalization workflow.
305
320
306
-
307
321
### 🛰️ Inspect Tool Execution
308
322
309
323
- Open the **Agentic Flow** panel to see how the system:
@@ -314,7 +328,6 @@ This agent is equipped with **three tools**, each designed to handle a distinct
> ⚠️ If a sentiment-based query fails to map to a known feature or lacks reviews, the system gracefully falls back to a general vector search and displays a notice.
319
332
320
333
## 🔍 Understanding What Queries Work (and Why)
@@ -412,7 +425,8 @@ If no reviews discuss a feature for a product, it won’t affect the ranking—e
412
425
Use the examples below to test how different tools behave:
413
426
414
427
### 🧍 Product-Specific Query Handling
415
-
_(Used when you're on a product page)_
428
+
429
+
(*Used when you're on a product page*)
416
430
417
431
- "Show critical reviews about durability"
418
432
- "Always show a summary of critical reviews"
@@ -421,7 +435,8 @@ _(Used when you're on a product page)_
421
435
- "Always highlight the product’s availability in red"
422
436
423
437
### 🧭 Standard Vector Search
424
-
_(General product discovery with semantic matching)_
438
+
439
+
(*General product discovery with semantic matching*)
425
440
426
441
- "Wireless headphones"
427
442
- "Waterproof smartwatches"
@@ -430,7 +445,8 @@ _(General product discovery with semantic matching)_
430
445
- "Smartwatches with step tracking"
431
446
432
447
### 💬 Sentiment-Aware Search
433
-
_(Feature-based preference queries)_
448
+
449
+
(*Feature-based preference queries*)
434
450
435
451
- "Headphones with great noise cancellation"
436
452
- "Smartwatches with accurate heart rate monitoring"
0 commit comments