Skip to content

Commit f47084a

Browse files
Merge branch 'hotfix' into psl-us18890-vs
2 parents f61234f + 421b6e7 commit f47084a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+384
-839
lines changed

.github/workflows/deploy-waf.yml

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
name: Validate WAF Deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
schedule:
8+
- cron: '0 11,23 * * *' # Runs at 11:00 AM and 11:00 PM GMT
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Code
15+
uses: actions/checkout@v3
16+
17+
- name: Run Quota Check
18+
id: quota-check
19+
run: |
20+
export AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }}
21+
export AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}
22+
export AZURE_CLIENT_SECRET=${{ secrets.AZURE_CLIENT_SECRET }}
23+
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
24+
export GPT_MIN_CAPACITY="50"
25+
export AZURE_REGIONS="${{ vars.AZURE_REGIONS }}"
26+
27+
chmod +x infra/scripts/checkquota.sh
28+
if ! infra/scripts/checkquota.sh; then
29+
# If quota check fails due to insufficient quota, set the flag
30+
if grep -q "No region with sufficient quota found" infra/scripts/checkquota.sh; then
31+
echo "QUOTA_FAILED=true" >> $GITHUB_ENV
32+
fi
33+
exit 1 # Fail the pipeline if any other failure occurs
34+
fi
35+
36+
- name: Send Notification on Quota Failure
37+
if: env.QUOTA_FAILED == 'true'
38+
run: |
39+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
40+
EMAIL_BODY=$(cat <<EOF
41+
{
42+
"body": "<p>Dear Team,</p><p>The quota check has failed, and the pipeline cannot proceed.</p><p><strong>Build URL:</strong> ${RUN_URL}</p><p>Please take necessary action.</p><p>Best regards,<br>Your Automation Team</p>"
43+
}
44+
EOF
45+
)
46+
47+
curl -X POST "${{ secrets.AUTO_LOGIC_APP_URL }}" \
48+
-H "Content-Type: application/json" \
49+
-d "$EMAIL_BODY" || echo "Failed to send notification"
50+
51+
- name: Fail Pipeline if Quota Check Fails
52+
if: env.QUOTA_FAILED == 'true'
53+
run: exit 1
54+
55+
- name: Set Deployment Region
56+
run: |
57+
echo "Selected Region: $VALID_REGION"
58+
echo "AZURE_LOCATION=$VALID_REGION" >> $GITHUB_ENV
59+
60+
- name: Setup Azure CLI
61+
run: |
62+
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
63+
az --version # Verify installation
64+
65+
- name: Login to Azure
66+
run: |
67+
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
68+
69+
- name: Install Bicep CLI
70+
run: az bicep install
71+
72+
- name: Generate Resource Group Name
73+
id: generate_rg_name
74+
run: |
75+
echo "Generating a unique resource group name..."
76+
ACCL_NAME="macae" # Account name as specified
77+
SHORT_UUID=$(uuidgen | cut -d'-' -f1)
78+
UNIQUE_RG_NAME="arg-${ACCL_NAME}-${SHORT_UUID}"
79+
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
80+
echo "Generated Resource_GROUP_PREFIX: ${UNIQUE_RG_NAME}"
81+
82+
83+
- name: Check and Create Resource Group
84+
id: check_create_rg
85+
run: |
86+
set -e
87+
echo "Checking if resource group exists..."
88+
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
89+
if [ "$rg_exists" = "false" ]; then
90+
echo "Resource group does not exist. Creating..."
91+
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location ${{ env.AZURE_LOCATION }} || { echo "Error creating resource group"; exit 1; }
92+
else
93+
echo "Resource group already exists."
94+
fi
95+
96+
97+
- name: Deploy Bicep Template
98+
id: deploy
99+
run: |
100+
set -e
101+
az deployment group create \
102+
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
103+
--template-file infra/main.bicep \
104+
--parameters infra/main.waf-aligned.bicepparam \
105+
--parameters azureOpenAILocation=${{ env.AZURE_LOCATION }}
106+
107+
108+
- name: Send Notification on Failure
109+
if: failure()
110+
run: |
111+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
112+
113+
# Construct the email body
114+
EMAIL_BODY=$(cat <<EOF
115+
{
116+
"body": "<p>Dear Team,</p><p>We would like to inform you that the Multi-Agent-Custom-Automation-Engine-Solution-Accelerator Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
117+
}
118+
EOF
119+
)
120+
121+
# Send the notification
122+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
123+
-H "Content-Type: application/json" \
124+
-d "$EMAIL_BODY" || echo "Failed to send notification"
125+
126+
127+
- name: Get OpenAI Resource from Resource Group
128+
id: get_openai_resource
129+
run: |
130+
131+
132+
set -e
133+
echo "Fetching OpenAI resource from resource group ${{ env.RESOURCE_GROUP_NAME }}..."
134+
135+
# Run the az resource list command to get the OpenAI resource name
136+
openai_resource_name=$(az resource list --resource-group ${{ env.RESOURCE_GROUP_NAME }} --resource-type "Microsoft.CognitiveServices/accounts" --query "[0].name" -o tsv)
137+
138+
if [ -z "$openai_resource_name" ]; then
139+
echo "No OpenAI resource found in resource group ${{ env.RESOURCE_GROUP_NAME }}."
140+
exit 1
141+
else
142+
echo "OPENAI_RESOURCE_NAME=${openai_resource_name}" >> $GITHUB_ENV
143+
echo "OpenAI resource name: ${openai_resource_name}"
144+
fi
145+
146+
147+
148+
149+
- name: Delete Bicep Deployment
150+
if: always()
151+
run: |
152+
set -e
153+
echo "Checking if resource group exists..."
154+
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
155+
if [ "$rg_exists" = "true" ]; then
156+
echo "Resource group exist. Cleaning..."
157+
az group delete \
158+
--name ${{ env.RESOURCE_GROUP_NAME }} \
159+
--yes \
160+
--no-wait
161+
echo "Resource group deleted... ${{ env.RESOURCE_GROUP_NAME }}"
162+
else
163+
echo "Resource group does not exists."
164+
fi
165+
166+
167+
- name: Wait for resource deletion to complete
168+
run: |
169+
170+
171+
# Add resources to the array
172+
resources_to_check=("${{ env.OPENAI_RESOURCE_NAME }}")
173+
174+
echo "List of resources to check: ${resources_to_check[@]}"
175+
176+
# Maximum number of retries
177+
max_retries=3
178+
179+
# Retry intervals in seconds (30, 60, 120)
180+
retry_intervals=(30 60 120)
181+
182+
# Retry mechanism to check resources
183+
retries=0
184+
while true; do
185+
resource_found=false
186+
187+
# Get the list of resources in YAML format again on each retry
188+
resource_list=$(az resource list --resource-group ${{ env.RESOURCE_GROUP_NAME }} --output yaml)
189+
190+
# Iterate through the resources to check
191+
for resource in "${resources_to_check[@]}"; do
192+
echo "Checking resource: $resource"
193+
if echo "$resource_list" | grep -q "name: $resource"; then
194+
echo "Resource '$resource' exists in the resource group."
195+
resource_found=true
196+
else
197+
echo "Resource '$resource' does not exist in the resource group."
198+
fi
199+
done
200+
201+
# If any resource exists, retry
202+
if [ "$resource_found" = true ]; then
203+
retries=$((retries + 1))
204+
if [ "$retries" -gt "$max_retries" ]; then
205+
echo "Maximum retry attempts reached. Exiting."
206+
break
207+
else
208+
# Wait for the appropriate interval for the current retry
209+
echo "Waiting for ${retry_intervals[$retries-1]} seconds before retrying..."
210+
sleep ${retry_intervals[$retries-1]}
211+
fi
212+
else
213+
echo "No resources found. Exiting."
214+
break
215+
fi
216+
done
217+
218+
219+
- name: Purging the Resources
220+
if: always()
221+
run: |
222+
223+
set -e
224+
echo "Azure OpenAI: ${{ env.OPENAI_RESOURCE_NAME }}"
225+
226+
# Purge OpenAI Resource
227+
echo "Purging the OpenAI Resource..."
228+
if ! az resource delete --ids /subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/providers/Microsoft.CognitiveServices/locations/eastus/resourceGroups/${{ env.RESOURCE_GROUP_NAME }}/deletedAccounts/${{ env.OPENAI_RESOURCE_NAME }} --verbose; then
229+
echo "Failed to purge openai resource: ${{ env.OPENAI_RESOURCE_NAME }}"
230+
else
231+
echo "Purged the openai resource: ${{ env.OPENAI_RESOURCE_NAME }}"
232+
fi
233+
234+
echo "Resource purging completed successfully"

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
export AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}
2222
export AZURE_CLIENT_SECRET=${{ secrets.AZURE_CLIENT_SECRET }}
2323
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
24-
export GPT_MIN_CAPACITY="50"
24+
export GPT_MIN_CAPACITY="140"
2525
export AZURE_REGIONS="${{ vars.AZURE_REGIONS }}"
2626
2727
chmod +x infra/scripts/checkquota.sh

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ The Multi-Agent Custom Automation Engine solution accelerator allows users to sp
1515
</div>
1616
<br/>
1717

18-
<h2><img src="./documentation/images/readme/solution-overview.png" width="48" />
18+
<h2><img src="./docs/images/readme/solution-overview.png" width="48" />
1919
Solution overview
2020
</h2>
2121

2222
The solution leverages Azure OpenAI Service, Azure Container Apps, Azure Cosmos DB, and Azure Container Registry to create an intelligent automation pipeline. It uses a multi-agent approach where specialized AI agents work together to plan, execute, and validate tasks based on user input.
2323

2424
### Solution architecture
25-
|![image](./documentation/images/readme/macae-architecture.png)|
25+
|![image](./docs/images/readme/macae-architecture.png)|
2626
|---|
2727

2828

2929

3030
### How to customize
3131
If you'd like to customize the solution accelerator, here are some common areas to start:
3232

33-
[Custom scenario](./documentation/CustomizeSolution.md)
33+
[Custom scenario](./docs/CustomizeSolution.md)
3434

3535
<br/>
3636

@@ -63,14 +63,14 @@ If you'd like to customize the solution accelerator, here are some common areas
6363
</details>
6464

6565
<br /><br />
66-
<h2><img src="./documentation/images/readme/quick-deploy.png" width="48" />
66+
<h2><img src="./docs/images/readme/quick-deploy.png" width="48" />
6767
Quick deploy
6868
</h2>
6969

7070
### How to install or deploy
7171
Follow the quick deploy steps on the deployment guide to deploy this solution to your own Azure subscription.
7272

73-
[Click here to launch the deployment guide](./documentation/DeploymentGuide.md)
73+
[Click here to launch the deployment guide](./docs/DeploymentGuide.md)
7474
<br/><br/>
7575

7676
| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/Multi-Agent-Custom-Automation-Engine-Solution-Accelerator) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/Multi-Agent-Custom-Automation-Engine-Solution-Accelerator) |
@@ -79,13 +79,13 @@ Follow the quick deploy steps on the deployment guide to deploy this solution to
7979
<br/>
8080

8181
> ⚠️ **Important: Check Azure OpenAI Quota Availability**
82-
<br/>To ensure sufficient quota is available in your subscription, please follow [quota check instructions guide](./documentation/quota_check.md) before you deploy the solution.
82+
<br/>To ensure sufficient quota is available in your subscription, please follow [quota check instructions guide](./docs/quota_check.md) before you deploy the solution.
8383
8484
<br/>
8585

8686
### Prerequisites and Costs
8787

88-
To deploy this solution accelerator, ensure you have access to an [Azure subscription](https://azure.microsoft.com/free/) with the necessary permissions to create **resource groups and resources**. Follow the steps in [Azure Account Set Up](./documentation/AzureAccountSetUp.md).
88+
To deploy this solution accelerator, ensure you have access to an [Azure subscription](https://azure.microsoft.com/free/) with the necessary permissions to create **resource groups and resources**. Follow the steps in [Azure Account Set Up](./docs/AzureAccountSetUp.md).
8989

9090
Check the [Azure Products by Region](https://azure.microsoft.com/en-us/explore/global-infrastructure/products-by-region/table) page and select a **region** where the following services are available: Azure OpenAI Service, Azure AI Search, and Azure Semantic Search.
9191

@@ -107,11 +107,11 @@ Use the [Azure pricing calculator](https://azure.microsoft.com/en-us/pricing/cal
107107
either by deleting the resource group in the Portal or running `azd down`.
108108

109109
<br /><br />
110-
<h2><img src="./documentation/images/readme/business-scenario.png" width="48" />
110+
<h2><img src="./docs/images/readme/business-scenario.png" width="48" />
111111
Business Scenario
112112
</h2>
113113

114-
|![image](./documentation/images/readme/macae-application.png)|
114+
|![image](./docs/images/readme/macae-application.png)|
115115
|---|
116116

117117
<br/>
@@ -148,7 +148,7 @@ By using the *Multi-Agent Custom Automation Engine* solution accelerator, users
148148

149149
<br /><br />
150150

151-
<h2><img src="./documentation/images/readme/supporting-documentation.png" width="48" />
151+
<h2><img src="./docs/images/readme/supporting-documentation.png" width="48" />
152152
Supporting documentation
153153
</h2>
154154

@@ -185,7 +185,7 @@ Have questions, find a bug, or want to request a feature? [Submit a new issue](h
185185
<br/>
186186

187187
## Responsible AI Transparency FAQ
188-
Please refer to [Transparency FAQ](./documentation/TRANSPARENCY_FAQ.md) for responsible AI transparency details of this solution accelerator.
188+
Please refer to [Transparency FAQ](./docs/TRANSPARENCY_FAQ.md) for responsible AI transparency details of this solution accelerator.
189189

190190
<br/>
191191

File renamed without changes.
File renamed without changes.

docs/CustomizeSolution.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Table of Contents
2+
3+
- [Table of Contents](#table-of-contents)
4+
- [Accelerating your own Multi-Agent - Custom Automation Engine MVP](#accelerating-your-own-multi-agent---custom-automation-engine-mvp)
5+
- [Technical Overview](#technical-overview)
6+
- [Adding a New Agent to the Multi-Agent System](#adding-a-new-agent-to-the-multi-agent-system)
7+
- [API Reference](#api-reference)
8+
- [Models and Datatypes](#models-and-datatypes)
9+
- [Application Flow](#application-flow)
10+
- [Agents Overview](#agents-overview)
11+
- [Persistent Storage with Cosmos DB](#persistent-storage-with-cosmos-db)
12+
- [Utilities](#utilities)
13+
- [Summary](#summary)
14+
15+
116
# Accelerating your own Multi-Agent - Custom Automation Engine MVP
217

318
As the name suggests, this project is designed to accelerate development of Multi-Agent solutions in your environment. The example solution presented shows how such a solution would be implemented and provides example agent definitions along with stubs for possible tools those agents could use to accomplish tasks. You will want to implement real functions in your own environment, to be used by agents customized around your own use cases. Users can choose the LLM that is optimized for responsible use. The default LLM is GPT-4o which inherits the existing responsible AI mechanisms and filters from the LLM provider. We encourage developers to review [OpenAI’s Usage policies](https://openai.com/policies/usage-policies/) and [Azure OpenAI’s Code of Conduct](https://learn.microsoft.com/en-us/legal/cognitive-services/openai/code-of-conduct) when using GPT-4o. This document is designed to provide the in-depth technical information to allow you to add these customizations. Once the agents and tools have been developed, you will likely want to implement your own real world front end solution to replace the example in this accelerator.
@@ -15,21 +30,6 @@ This application is an AI-driven orchestration system that manages a group of AI
1530
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.
1631

1732
Below, we'll dive into the details of each component, focusing on the endpoints, data types, and the flow of information through the system.
18-
# Table of Contents
19-
20-
- [Table of Contents](#table-of-contents)
21-
- [Accelerating your own Multi-Agent - Custom Automation Engine MVP](#accelerating-your-own-multi-agent---custom-automation-engine-mvp)
22-
- [Technical Overview](#technical-overview)
23-
- [Adding a New Agent to the Multi-Agent System](#adding-a-new-agent-to-the-multi-agent-system)
24-
- [API Reference](#api-reference)
25-
- [Models and Datatypes](#models-and-datatypes)
26-
- [Application Flow](#application-flow)
27-
- [Agents Overview](#agents-overview)
28-
- [Persistent Storage with Cosmos DB](#persistent-storage-with-cosmos-db)
29-
- [Utilities](#utilities)
30-
- [Summary](#summary)
31-
32-
3333
## Adding a New Agent to the Multi-Agent System
3434

3535
This guide details the steps required to add a new agent to the Multi-Agent Custom Automation Engine. The process includes registering the agent, defining its capabilities through tools, and ensuring the PlannerAgent includes the new agent when generating activity plans.
@@ -41,7 +41,6 @@ Every agent is equipped with a set of tools (functions) that it can call to perf
4141

4242
Example (for a `BakerAgent`):
4343
```python
44-
from autogen_core.components.tools import FunctionTool, Tool
4544
from typing import List
4645

4746
async def bake_cookies(cookie_type: str, quantity: int) -> str:
@@ -615,4 +614,4 @@ This application orchestrates a group of AI agents to accomplish user-defined ta
615614

616615
Understanding the flow of data through the endpoints, agents, and persistent storage is key to grasping the logic of the application. Each component plays a specific role in ensuring tasks are planned, executed, and adjusted based on feedback, providing a robust and interactive system.
617616

618-
For instructions to setup a local development environment for the solution, please see [local deployment guide](./LocalDeployment.md).
617+
For instructions to setup a local development environment for the solution, please see [deployment guide](./DeploymentGuide.md).
File renamed without changes.

0 commit comments

Comments
 (0)