Skip to content

Commit 35e1935

Browse files
Merge branch 'main' into hotfix
2 parents 8bacf52 + 86bbc73 commit 35e1935

File tree

9 files changed

+219
-195
lines changed

9 files changed

+219
-195
lines changed

README.md

Lines changed: 89 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Multi-Agent -Custom Automation Engine Solution Accelerator
1+
# Multi-Agent: Custom Automation Engine Solution Accelerator
22

3-
MENU: [**USER STORY**](#user-story) \| [**SIMPLE DEPLOY**](#simple-deploy) \| [**SUPPORTING DOCUMENTATION**](#supporting-documentation) \|
3+
MENU: [**USER STORY**](#user-story) \| [**QUICK DEPLOY**](#quick-deploy) \| [**SUPPORTING DOCUMENTATION**](#supporting-documentation) \|
44

55
<h2><img src="./documentation/images/readme/userStory.png" width="64">
66
<br/>
@@ -41,7 +41,7 @@ This application is an AI-driven orchestration system that manages a group of AI
4141
- Incorporate human feedback into the workflow.
4242
- Maintain state across sessions with persistent storage.
4343

44-
This system is intended for developing and deploying custom AI solutions for specific customers. This code has not been tested as an end-to-end, reliable, RAI compliant production application- it is a foundation to help accelerate building out multi-agent systems. You are encouraged to add your own data and functions to the agents, and then you must apply your own performance and safety evaluation testing frameworks to this system before deploying it.
44+
This system is intended for developing and deploying custom AI solutions for specific customers. This code has not been tested as an end-to-end, reliable production application- it is a foundation to help accelerate building out multi-agent systems. You are encouraged to add your own data and functions to the agents, and then you must apply your own performance and safety evaluation testing frameworks to this system before deploying it.
4545

4646
\
4747
![image](./documentation/images/readme/macae-application.png)
@@ -71,7 +71,7 @@ This guide provides step-by-step instructions for deploying your application usi
7171

7272
There are several ways to deploy the solution. You can deploy to run in Azure in one click, or manually, or you can deploy locally.
7373

74-
## One Click Azure Deployment
74+
## Quick Deploy
7575

7676
<h2><img src="./documentation/images/readme/oneClickDeploy.png" width="64"></h2>
7777

@@ -80,106 +80,140 @@ There are several ways to deploy the solution. You can deploy to run in Azure i
8080
When Deployment is complete, follow steps in [Set Up Authentication in Azure App Service](./documentation/azure_app_service_auth_setup.md) to add app authentication to your web app running on Azure App Service
8181

8282
## Local Deployment
83-
To run the solution site and API backend locally, See the [local deployment guide](./documentation/LocalDeployment.md).
83+
To run the solution site and API backend only locally for development and debugging purposes, See the [local deployment guide](./documentation/LocalDeployment.md).
8484

8585
## Manual Azure Deployment
86+
Manual Deployment differs from the ‘Quick Deploy’ option in that it will install an Azure Container Registry (ACR) service, and relies on the installer to build and push the necessary containers to this ACR. This allows you to build and push your own code changes and provides a sample solution you can customize based on your requirements.
87+
8688
### Prerequisites
8789

88-
- Azure CLI installed
90+
- Current Azure CLI installed
91+
You can update to the latest version using ```az upgrade```
8992
- Azure account with appropriate permissions
9093
- Docker installed
91-
- Azure Container Registry installed
9294

93-
### Get Admin Credentials from ACR
95+
### Deploy the Azure Services
96+
All of the necessary Azure services can be deployed using the /deploy/macae.bicep script. This script will require the following parameters:
97+
98+
```
99+
az login
100+
az account set --subscription <SUBSCRIPTION_ID>
101+
az group create --name <RG_NAME> --location <RG_LOCATION>
102+
```
103+
To deploy the script you can use the Azure CLI.
104+
```
105+
az deployment group create \
106+
--resource-group <RG_NAME> \
107+
--template-file <BICEP_FILE> \
108+
--name <DEPLOYMENT_NAME>
109+
```
110+
111+
Note: if you are using windows with PowerShell, the continuation character (currently ‘\’) should change to the tick mark (‘`’).
112+
113+
The template will require you fill in locations for Cosmos and OpenAI services. This is to avoid the possibility of regional quota errors for either of these resources.
114+
115+
### Create the Containers
116+
#### Get admin credentials from ACR
94117

95118
Retrieve the admin credentials for your Azure Container Registry (ACR):
96119

97120
```sh
98121
az acr credential show \
99-
--name acrcontoso7wx5mg43sbnl4 \
100-
--resource-group rg-ssattiraju
122+
--name <e.g. macaeacr2t62qyozi76bs> \
123+
--resource-group <rg-name>
101124
```
102125

103-
### Login to ACR
126+
#### Login to ACR
104127

105128
Login to your Azure Container Registry:
106129

107130
```sh
108-
az acr login --name acrcontoso7wx5mg43sbnl4
131+
az acr login --name <e.g. macaeacr2t62qyozi76bs>
109132
```
110133

111-
### Build Image
134+
#### Build and push the image
112135

113-
Build the Docker image and push it to your Azure Container Registry:
136+
Build the frontend and backend Docker images and push them to your Azure Container Registry. Run the following from the src/backend and the src/frontend directory contexts:
114137

115138
```sh
116139
az acr build \
117-
--registry acrcontoso7wx5mg43sbnl4 \
118-
--resource-group rg-name \
119-
--image macae:latest .
140+
--registry <e.g. macaeacr2t62qyozi76bs> \
141+
--resource-group <rg-name> \
142+
--image <e.g. backendmacae:latest> .
120143
```
121144

122-
### List the Image Created
145+
### Add images to the Container APP and Web App services
123146

124-
List the images in your Azure Container Registry:
147+
To add your newly created backend image:
148+
- Navigate to the Container App Service in the Azure portal
149+
- Click on Application/Containers in the left pane
150+
- Click on the "Edit and deploy" button in the upper left of the containers pane
151+
- In the "Create and deploy new revision" page, click on your container image 'backend'. This will give you the option of reconfiguring the container image, and also has an Environment variables tab
152+
- Change the properties page to
153+
- point to your Azure Container registry with a private image type and your image name (e.g. backendmacae:latest)
154+
- under "Authentication type" select "Managed Identity" and choose the 'mace-containerapp-pull'... identity setup in the bicep template
155+
- In the environment variables section add the following (each with a 'Manual entry' source):
125156

126-
```sh
127-
az acr repository list --name acrcontoso7wx5mg43sbnl4
128-
```
157+
name: 'COSMOSDB_ENDPOINT'
158+
value: \<Cosmos endpoint>
129159

130-
### Upgrade Container App Extension
160+
name: 'COSMOSDB_DATABASE'
161+
value: 'autogen'
162+
Note: To change the default, you will need to create the database in Cosmos
163+
164+
name: 'COSMOSDB_CONTAINER'
165+
value: 'memory'
131166

132-
Ensure you have the latest version of the Azure Container Apps extension:
133-
`az extension add --name containerapp --upgrade`
167+
name: 'AZURE_OPENAI_ENDPOINT'
168+
value: <Azure OpenAI endpoint>
134169

135-
### Get List of Available Locations
170+
name: 'AZURE_OPENAI_DEPLOYMENT_NAME'
171+
value: 'gpt-4o'
136172

137-
Retrieve a list of available Azure locations:
138-
`az account list-locations -o table`
173+
name: 'AZURE_OPENAI_API_VERSION'
174+
value: '2024-08-01-preview'
175+
Note: Version should be updated based on latest available
139176

140-
### Create Apps Environment
177+
name: 'FRONTEND_SITE_NAME'
178+
value: 'https://<website Name>.azurewebsites.net'
141179

142-
Create an environment for your Azure Container Apps:
180+
- Click 'Save' and deploy your new revision
181+
182+
To add the new container to your website run the following:
143183

144-
```sh
145-
az containerapp env create \
146-
--name python-container-env \
147-
--resource-group rg-name \
148-
--location southeastasia
184+
```
185+
az webapp config container set --resource-group macae_full_deploy2_rg \
186+
--name macae-frontend-2t62qyozi76bs \
187+
--container-image-name macaeacr2t62qyozi76bs.azurecr.io/frontendmacae:latest \
188+
--container-registry-url https://macaeacr2t62qyozi76bs.azurecr.io
149189
```
150190

151-
### Get Credentials
152191

153-
```sh
154-
az acr credential show -n acrcontoso7wx5mg43sbnl4
155-
```
192+
### Add the Entra identity provider to the Azure Web App
193+
To add the identity provider, please follow the steps outlined in [Set Up Authentication in Azure App Service](./documentation/azure_app_service_auth_setup.md)
156194

157-
### Create container app
195+
### Run locally and debug
158196

159-
create the container app with the config
197+
To debug the solution, you can use the Cosmos and OpenAI services you have manually deployed. To do this, you need to ensure that your Azure identity has the required permissions on the Cosmos and OpenAI services.
160198

161-
```sh
162-
az containerapp create \
163-
--name python-container-app \
164-
--resource-group rg-name \
165-
--image acrcontoso7wx5mg43sbnl4.azurecr.io/macae:latest \
166-
--environment python-container-env \
167-
--ingress external --target-port 8000 \
168-
--registry-server acrcontoso7wx5mg43sbnl4.azurecr.io \
169-
--registry-username password \
170-
--registry-password REGISTRY_PASSWORD \
171-
--query properties.configuration.ingress.fqdn
199+
- For OpeAI service, you can add yourself to the ‘Cognitive Services OpenAI User’ permission in the Access Control (IAM) pane of the Azure portal.
200+
- Cosmos is a little more difficult as it requires permissions be added through script. See these examples for more information:
201+
- [Use data plane role-based access control - Azure Cosmos DB for NoSQL | Microsoft Learn](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/security/how-to-grant-data-plane-role-based-access?tabs=built-in-definition%2Cpython&pivots=azure-interface-cli)
202+
- [az cosmosdb sql role assignment | Microsoft Learn](https://learn.microsoft.com/en-us/cli/azure/cosmosdb/sql/role/assignment?view=azure-cli-latest#az-cosmosdb-sql-role-assignment-create)
203+
204+
Add the appropriate endpoints from Cosmos and OpenAI services to your .env file.
205+
Note that you can configure the name of the Cosmos database in the configuration. This can be helpful if you wish to separate the data messages generated in local debugging from those associated with the cloud based solution. If you choose to use a different database, you will need to create that database in the Cosmos instance as this is not done automatically.
206+
207+
If you are using VSCode, you can use the debug configuration shown in the [local deployment guide](./documentation/LocalDeployment.md).
172208

173-
```
174-
<br></br>
175209
## Supporting documentation
176210

177211

178212
###
179213

180214
### How to customize
181215

182-
This solution is designed to be easily customizable. You can modify the front end site, or even build your own front end and attach to the backend API. You can further customize the backend by adding your own agents with their own specific capabilities. Deeper technical information to aid in this customization can be found in this [document](.\documentation\CustomizeSolution.md).
216+
This solution is designed to be easily customizable. You can modify the front end site, or even build your own front end and attach to the backend API. You can further customize the backend by adding your own agents with their own specific capabilities. Deeper technical information to aid in this customization can be found in this [document](./documentation/CustomizeSolution.md).
183217

184218
### Additional resources
185219

deploy/macae-continer-oc.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.32.4.45862",
9-
"templateHash": "13409532170922983631"
9+
"templateHash": "17567587246932458853"
1010
}
1111
},
1212
"parameters": {
@@ -363,10 +363,6 @@
363363
"name": "AZURE_OPENAI_API_VERSION",
364364
"value": "[variables('aoaiApiVersion')]"
365365
},
366-
{
367-
"name": "DEV_BYPASS_AUTH",
368-
"value": "true"
369-
},
370366
{
371367
"name": "FRONTEND_SITE_NAME",
372368
"value": "[format('https://{0}.azurewebsites.net', format(variables('uniqueNameFormat'), 'frontend'))]"

deploy/macae-continer.bicep

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,6 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
275275
name: 'AZURE_OPENAI_API_VERSION'
276276
value: aoaiApiVersion
277277
}
278-
{
279-
name: 'DEV_BYPASS_AUTH'
280-
value: 'true'
281-
}
282278
{
283279
name: 'FRONTEND_SITE_NAME'
284280
value: 'https://${format(uniqueNameFormat, 'frontend')}.azurewebsites.net'

deploy/macae-dev.bicep

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
@description('Location for all resources.')
2-
param location string = 'EastUS2' //Fixed for model availability, change back to resourceGroup().location
2+
param location string = resourceGroup().location
3+
4+
@description('location for Cosmos DB resources.')
5+
// prompt for this as there is often quota restrictions
6+
param cosmosLocation string
37

48
@description('Location for OpenAI resources.')
5-
param azureOpenAILocation string = 'EastUS' //Fixed for model availability
9+
// prompt for this as there is often quota restrictions
10+
param azureOpenAILocation string
611

712
@description('A prefix to add to the start of all resource names. Note: A "unique" suffix will also be added')
813
param prefix string = 'macae'
@@ -60,7 +65,7 @@ resource devAoaiRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-
6065

6166
resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
6267
name: format(uniqueNameFormat, 'cosmos')
63-
location: location
68+
location: cosmosLocation
6469
tags: tags
6570
kind: 'GlobalDocumentDB'
6671
properties: {
@@ -69,7 +74,7 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
6974
locations: [
7075
{
7176
failoverPriority: 0
72-
locationName: location
77+
locationName: cosmosLocation
7378
}
7479
]
7580
}
@@ -126,5 +131,3 @@ output AZURE_OPENAI_ENDPOINT string = openai.properties.endpoint
126131
output AZURE_OPENAI_DEPLOYMENT_NAME string = openai::gpt4o.name
127132
output AZURE_OPENAI_API_VERSION string = aoaiApiVersion
128133

129-
// For legacy purposes, output the CLI commands to assign the roles
130-
//output cosmosAssignCli string = 'az cosmosdb sql role assignment create --resource-group "${resourceGroup().name}" --account-name "${cosmos.name}" --role-definition-id "${cosmos::contributorRoleDefinition.id}" --scope "${cosmos.id}" --principal-id "fill-in"'

0 commit comments

Comments
 (0)