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
update readme with bug bash issues and template validation (#54)
Restructures readme, adds quick deploy section. Addresses comments from bug bash and conforms with template validation.
Bug Bash readme issues (from chat template + agents template):
* Include additional details in the deployment section of the ReadMe file
* "Deployment options" could be added before "deployment" section in Read Me file
* #39
Code validation template issues:
* now includes `Features`, `Getting Started`, and `Guidance`
# Getting Started with Agents Using Azure AI Foundry
2
2
3
-
MENU: [**PREREQUISITES**](#prerequisites)\|[**DEVELOPMENT**](#development)\|[**DEPLOYMENT**](#deployment)\|[**TRACING AND MONITORING**](#tracing-and-monitoring)\|[**DEVELOPMENT OPTIONS**](#development-options)\|[**SUPPORTING DOCUMENTATION**](#supporting-documentation)\|[**TROUBLESHOOTING**](#troubleshooting)
4
-
<!-- TODO: rename repo azure-ai-agents-chat -->
3
+
MENU: [**FEATURES**](#features)\|[**QUICK DEPLOY**](#quick-deploy)\|[**GETTING STARTED**](#getting-started)\|[**DEVELOPMENT**](#development)\|[**DEPLOYMENT**](#deployment)\|[**TRACING AND MONITORING**](#tracing-and-monitoring)\|[**DEVELOPMENT OPTIONS**](#development-options)\|[**GUIDANCE**](#guidance)\|[**TROUBLESHOOTING**](#troubleshooting)
5
4
6
-
This project creates an Azure AI Foundry hub, project and connected resources including Azure AI Services, AI Search and more. It deploys an agent chat application to Azure Container Apps that uses Azure File Search with uploaded files and can provide citations.
5
+
## Features
7
6
7
+
This solution deploys a web-based chat application with an AI agent running in Azure Container Apps. The agent leverages the Azure AI Agent service and utilizes Azure AI Search for knowledge retrieval from uploaded files, enabling it to generate responses with citations. The solution also includes built-in monitoring capabilities with tracing to ensure easier troubleshooting and optimized performance.
8
+
9
+
This solution creates an Azure AI Foundry hub, project and connected resources including Azure AI Services, AI Search and more. For more details about the resources that are created, view the [resources](#resources) documentation. There are options to enable Retrieval-Augmented Generation (RAG) and use logging, tracing, and monitoring.
10
+
11
+
Instructions are provided for deployment through GitHub Codespaces, VS Code Dev Containers, and your local development environment.
12
+
13
+
#### Architecture diagram
8
14
9
15

10
16
17
+
## Quick Deploy
11
18
12
-
## Running the Template
19
+
|[](https://codespaces.new/Azure-Samples/get-started-with-ai-agents)|[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/Azure-Samples/get-started-with-ai-agents)||
20
+
|---|---|---|
21
+
22
+
## Getting Started
13
23
14
24
### Prerequisites
15
25
@@ -30,16 +40,7 @@ Make sure the following tools are installed:
30
40
1.[Azure Developer CLI (azd)](https://aka.ms/install-azd) Install or update to the latest version. Instructions can be found on the linked page.
The default for the model capacity in deployment is 50k tokens. For optimal performance, it is recommended to increase to 100k tokens. You can change the capacity by following the steps in [setting capacity and deployment SKU](docs/deploy_customization.md#customizing-model-deployments).
37
-
38
-
* Navigate to the [Azure AI Foundry Portal](https://ai.azure.com/)
39
-
* Select the AI Project you are using for this template if you are not already in the project.
40
-
* Select Management center from the bottom left navigation menu
41
-
* Select Quota, click the GlobalStandard dropdown and select the model and region you are using for this accelerator to see your available quota. Please note GPT-4o mini and text-embedding-ada-002 are used as default.
42
-
* Request more quota or delete any unused model deployments as needed.
At this point you could make changes to the code if required. However, no changes are needed to deploy and test the app as shown in the next step.
53
54
54
55
#### How to configure Agent model and version
55
-
<!-- TODO where do we want this? probably after downloading the code -->
56
+
56
57
By default, the template uses model `gpt-4o-mini`, version `2024-07-18` for text generation and `text-embedding-3-small` version `1` for embeddings. If you want to personalize your agent, you can change the default configuration for your agent. Additional details on changing your agent can be found in [customizing model deployments](docs/deploy_customization.md#customizing-model-deployments). For more information on the Azure OpenAI models and non-Microsoft models that can be used in your deployment, view the [list of models supported by Azure AI Agent Service](https://learn.microsoft.com/azure/ai-services/agents/concepts/model-region-support).
57
58
58
59
To specify the model (e.g. gpt-4o-mini, gpt-4o) that is deployed for the agent when `azd up` is called, set the following environment variables:
@@ -79,92 +80,82 @@ If you want to enable logging to a file, uncomment the following line in Dockerf
79
80
The provided file logging implementation is intended for development purposes only, specifically for testing with a single client/worker. It should not be used in production environments after the R&D phase.
80
81
81
82
#### Tracing to Azure Monitor
82
-
To enable tracing to Azure Monitor, modify the value of ENABLE_AZURE_MONITOR_TRACING environment variable to true in Dockerfile found in src directory:
83
+
To enable tracing to Azure Monitor, modify the value of `ENABLE_AZURE_MONITOR_TRACING` environment variable to true in `Dockerfile` found in src directory:
83
84
```code
84
85
ENV ENABLE_AZURE_MONITOR_TRACING=true
85
86
```
86
87
Note that the optional App Insights resource is required for tracing to Azure Monitor (it is created by default).
87
88
88
-
To enable message contents to be included in the traces, set the following environment variable to true in the same Dockerfile. Note that the messages may contain personally identifiable information.
89
+
To enable message contents to be included in the traces, set the following environment variable to true in the same `Dockerfile`. Note that the messages may contain personally identifiable information.
Once you've opened the project locally and made any desired adjustments, you can deploy it to Azure.
97
-
98
-
1. Login to Azure:
95
+
#### Quota Recommendations (Optional)
99
96
100
-
```shell
101
-
azd auth login
102
-
```
97
+
The default for the model capacity in deployment is 50k tokens. For optimal performance, it is recommended to increase to 100k tokens. You can change the capacity by following the steps in [setting capacity and deployment SKU](docs/deploy_customization.md#customizing-model-deployments).
103
98
104
-
2. (Optional) If you would like to customize the deployment to [disable resources](docs/deploy_customization.md#disabling-resources), [customize resource names](docs/deploy_customization.md#customizing-resource-names),
105
-
or [customize the models](docs/deploy_customization.md#customizing-model-deployments), you can follow those steps now.
99
+
* Navigate to the [Azure AI Foundry Portal](https://ai.azure.com/)
100
+
* Select the AI Project you are using for this template if you are not already in the project.
101
+
* Select Management center from the bottom left navigation menu
102
+
* Select Quota, click the GlobalStandard dropdown and select the model and region you are using for this accelerator to see your available quota. Please note GPT-4o mini and text-embedding-ada-002 are used as default.
103
+
* Request more quota or delete any unused model deployments as needed.
106
104
107
-
3. Provision and deploy all the resources:
105
+
## Deployment
108
106
109
-
```shell
110
-
azd up
111
-
```
107
+
### Deployment Options
112
108
113
-
It will prompt you to provide an `azd` environment name (like "azureaiapp"), selecta subscription from your Azure account, and selecta location which has quota forall the resources. Then it will provision the resourcesin your account and deploy the latest code. If you get an error or timeout with deployment, changing the location can help, as there may be availability constraints for the resources.
109
+
Pick from the options below to see step-by-step instructions for: GitHub Codespaces, VS Code Dev Containers, and Local Environments.
114
110
115
-
**NOTE!** If you get authorization failed and/or permission related errors during the deployment, please refer to the Azure account requirements in the [Prerequisites](#prerequisites) section.
111
+
<details>
112
+
<summary><b>GitHub Codespaces</b></summary>
116
113
114
+
#### GitHub Codespaces
117
115
118
-
4. When `azd` has finished deploying, you'll see an endpoint URI in the command output. Visit that URI, and you should see the app! 🎉
116
+
You can run this template virtually by using GitHub Codespaces. The button will open a web-based VS Code instance in your browser:
119
117
120
-
You can view information about your deployment with:
121
-
```shell
122
-
azd show
123
-
```
118
+
1. Open the template (this may take several minutes):
124
119
125
-
5. If you make further modification to the app code, you can deploy the updated version with:
120
+
[](https://codespaces.new/Azure-Samples/get-started-with-ai-agents)
126
121
127
-
```shell
128
-
azd deploy
129
-
```
130
-
You can get more detailed output with the ```--debug``` parameter.
131
-
```shell
132
-
azd deploy --debug
133
-
```
134
-
Check for any errors during the deployment, since updated app code will not get deployed if errors occur.
122
+
2. Open a terminal window
123
+
3. Continue with the [deploying steps](#deploying-steps)
135
124
136
-
⚠️ To avoid unnecessary costs, remember to take down your app if it's no longer in use,
137
-
either by deleting the resource group in the Portal or running `azd down`.
125
+
</details>
138
126
139
-
## Tracing and Monitoring
127
+
<details>
128
+
<summary><b>VS Code Dev Containers</b></summary>
140
129
141
-
You can view console logs in Azure portal. You can get the link to the resource group with the azd tool:
142
-
```shell
143
-
azd show
144
-
```
130
+
#### VS Code Dev Containers
145
131
146
-
Or if you want to navigate from the Azure portal main page, selectyour resource group from the 'Recent' list, or by clicking the 'Resource groups' and searching your resource group there.
132
+
A related option is VS Code Dev Containers, which will open the project in your local VS Code using the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers):
147
133
148
-
After accessing you resource group in Azure portal, choose your container app from the list of resources. Then open 'Monitoring' and 'Log Stream'. Choose the 'Application' radio button to view application logs. You can choose between real-time and historical using the corresponding radio buttons. Note that it may take some timefor the historical view to be updated with the latest logs.
134
+
1. Start Docker Desktop (install it if not already installed [Docker Desktop](https://www.docker.com/products/docker-desktop/))
135
+
2. Open the project:
149
136
150
-
If you enabled logging to a file, you can view the log file by choosing 'Console' under the 'Monitoring' (same location as above forthe console traces), opening the default console and thenfor example running the following command (replace app.log with the actual name of your log file):
137
+
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/Azure-Samples/get-started-with-ai-agents)
151
138
152
-
```shell
153
-
more app.log
154
-
```
139
+
3. In the VS Code window that opens, once the project files show up (this may take several minutes), open a terminal window.
140
+
4. Continue with the [deploying steps](#deploying-steps)
141
+
</details>
155
142
156
-
You can view the App Insights tracing in Azure AI Foundry. Select your project on the Azure AI Foundry page and then click 'Tracing'.
143
+
<details>
144
+
<summary><b>Local Environment</b></summary>
157
145
158
-
## Development Options
146
+
#### Local Environment
159
147
160
-
In addition to the development setup documented above, the following development environment options can be used.
148
+
1. Confirm that you have the required tools installed from the [prerequisites](#prerequisites) section and the code downloaded from the [code](#code) section
149
+
2. Open the project folder in your terminal or editor
150
+
3. Continue with the [deploying steps](#deploying-steps)
151
+
</details>
161
152
162
153
<details>
163
154
<summary><b>Local Development Server</b></summary>
164
155
165
156
#### Local Development Server
166
157
167
-
You can optionally use a local development server to test app changes locally. Make sure you first [deployed the app](#deployment) to Azure before running the development server.
158
+
You can optionally use a local development server to test app changes locally. Make sure you first [deployed the app](#deploying-steps) to Azure before running the development server.
168
159
169
160
1. Create a [Python virtual environment](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments) and activate it.
170
161
@@ -205,39 +196,78 @@ You can optionally use a local development server to test app changes locally. M
205
196
6. Enter your message in the box.
206
197
</details>
207
198
208
-
<details>
209
-
<summary><b>GitHub Codespaces</b></summary>
199
+
### Deploying Steps
210
200
211
-
#### Deploy in GitHub Codespaces
201
+
Once you've opened the project in [Codespaces](#github-codespaces) or in [Dev Containers](#vs-code-dev-containers) or [locally](#local-environment), you can deploy it to Azure following the following steps.
212
202
213
-
You can run this template virtually by using GitHub Codespaces. The button will open a web-based VS Code instance in your browser:
203
+
1. Login to Azure:
214
204
215
-
1. Open the template (this may take several minutes):
205
+
```shell
206
+
azd auth login
207
+
```
216
208
217
-
[](https://codespaces.new/Azure-Samples/get-started-with-ai-agents)
209
+
2. (Optional) If you would like to customize the deployment to [disable resources](docs/deploy_customization.md#disabling-resources), [customize resource names](docs/deploy_customization.md#customizing-resource-names), [customize the models](docs/deploy_customization.md#customizing-model-deployments) or [increase quota](docs/deploy_customization.md#customizing-model-deployments), you can follow those steps now.
218
210
219
-
2. Open a terminal window
220
-
3. Continue with the [deploying steps](#deployment)
211
+
3. Provision and deploy all the resources by running the following in get-started-with-ai-agents directory:
221
212
222
-
</details>
213
+
```shell
214
+
azd up
215
+
```
223
216
224
-
<details>
225
-
<summary><b>VS Code Dev Containers</b></summary>
217
+
4. You will be prompted to provide an `azd` environment name (like "azureaiapp"), select a subscription from your Azure account, and select a location which has quota for all the resources. Then, it will provision the resources in your account and deploy the latest code.
226
218
227
-
#### VS Code Dev Containers
219
+
* This deployment will take 8-12 minutes to provision the resources in your account and set up the solution with sample data.
220
+
* If you get an error or timeout with deployment, changing the location can help, as there may be availability constraints for the resources.
228
221
229
-
A related option is VS Code Dev Containers, which will open the project inyour local VS Code using the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers):
222
+
**NOTE!** If you get authorization failed and/or permission related errors during the deployment, please refer to the Azure account requirements in the [Prerequisites](#prerequisites) section. If you were recently granted these permissions, it may take a few minutes for the authorization to apply.
230
223
231
-
1. Start Docker Desktop (install it if not already installed [Docker Desktop](https://www.docker.com/products/docker-desktop/))
232
-
2. Open the project:
224
+
5. When `azd` has finished deploying, you'll see an endpoint URI in the command output. Visit that URI, and you should see the app! 🎉
233
225
234
-
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/Azure-Samples/get-started-with-ai-agents)
226
+
You can view information about your deployment with:
227
+
```shell
228
+
azd show
229
+
```
235
230
236
-
3. In the VS Code window that opens, once the project files show up (this may take several minutes), open a terminal window.
237
-
4. Continue with the [deploying steps](#deployment)
238
-
</details>
231
+
6. If you make further modification to the app code, you can deploy the updated version with:
232
+
233
+
```shell
234
+
azd deploy
235
+
```
236
+
You can get more detailed output with the ```--debug``` parameter.
237
+
```shell
238
+
azd deploy --debug
239
+
```
240
+
>**Important:**
241
+
>
242
+
>Check carefully for any errors during deployment and the startup phase of the Azure Container App. If the container fails to start correctly after deployment, the application changes you made will not take effect, and Azure Container Apps will continue serving requests from the previous stable revision.
243
+
244
+
7. You can optionally use a local development server to test app changes locally. To do so, follow the steps in [local deployment server](#local-development-server) after your app is deployed.
245
+
246
+
8. When you are done using your application, you can now delete the resources by running `azd down`. This may take up to 20 minutes.
247
+
248
+
⚠️ To avoid unnecessary costs, remember to take down your app if it's no longer in use,
249
+
either by deleting the resource group in the Portal or running `azd down`.
250
+
251
+
## Tracing and Monitoring
252
+
253
+
You can view console logs in Azure portal. You can get the link to the resource group with the azd tool:
254
+
```shell
255
+
azd show
256
+
```
257
+
258
+
Or if you want to navigate from the Azure portal main page, select your resource group from the 'Recent' list, or by clicking the 'Resource groups' and searching your resource group there.
259
+
260
+
After accessing you resource group in Azure portal, choose your container app from the list of resources. Then open 'Monitoring' and 'Log Stream'. Choose the 'Application' radio button to view application logs. You can choose between real-time and historical using the corresponding radio buttons. Note that it may take some time for the historical view to be updated with the latest logs.
261
+
262
+
If you enabled logging to a file, you can view the log file by choosing 'Console' under the 'Monitoring' (same location as above for the console traces), opening the default console and then for example running the following command (replace app.log with the actual name of your log file):
263
+
264
+
```shell
265
+
more app.log
266
+
```
267
+
268
+
You can view the App Insights tracing in Azure AI Foundry. Select your project on the Azure AI Foundry page and then click 'Tracing'.
0 commit comments