Skip to content

Commit 2d48f21

Browse files
ferantiverockittel
andauthored
feat (orchestrator): [update] use Azure AI Agent Services + ChatUI SDK changes (#45)
Co-authored-by: Chad Kittel <chad.kittel@gmail.com>
1 parent 096e6e7 commit 2d48f21

28 files changed

Lines changed: 673 additions & 1556 deletions

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
2-
"name": "Azure OpenAI end-to-end basic reference implementation",
2+
"name": "AI Agent service chat basic reference implementation",
33
"image": "mcr.microsoft.com/devcontainers/dotnet:dev-8.0-jammy",
44
"runArgs": ["--network=host"],
55
"remoteUser": "vscode",
66
"features": {
7+
"ghcr.io/devcontainers/features/azure-cli:1": {}
78
},
89
"customizations": {
910
"vscode": {

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to Azure OpenAI end-to-end basic reference implementation
1+
# Contributing to the Azure OpenAI and AI Agent service chat basic reference implementatio
22

33
This project welcomes contributions and suggestions. Most contributions require you to agree to a
44
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us

README.md

Lines changed: 82 additions & 103 deletions
Large diffs are not rendered by default.

agents/chat-with-bing.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "Basic Chatbot Agent",
3+
"description": "Example Azure AI Agent agent that uses the Bing Search tool to answer questions. Used in the Microsoft Learn AI chat reference architecture. https://learn.microsoft.com/azure/architecture/ai-ml/architecture/basic-openai-e2e-chat",
4+
"model": "MODEL_CONNECTION_NAME",
5+
"instructions": "You are a helpful Chatbot agent. You'll consult the Bing Search tool to answer questions. Always search the web for information.",
6+
"tools": [
7+
{
8+
"type": "bing_grounding",
9+
"bing_grounding": {
10+
"search_configurations": [
11+
{
12+
"connection_id": "BING_CONNECTION_ID",
13+
"count": 5,
14+
"freshness": "Week"
15+
}
16+
]
17+
}
18+
}
19+
],
20+
"tool_resources": {},
21+
"temperature": 1,
22+
"top_p": 1,
23+
"metadata": {
24+
"createdBy": "Microsoft Learn Baseline Architecture",
25+
"version": "1.0.0"
26+
},
27+
"response_format": "auto"
28+
}

infra-as-code/bicep/acr.bicep

Lines changed: 0 additions & 78 deletions
This file was deleted.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
targetScope = 'resourceGroup'
2+
3+
@description('The region in which this architecture is deployed. Should match the region of the resource group.')
4+
@minLength(1)
5+
param location string = resourceGroup().location
6+
7+
@description('The existing Azure AI Foundry account. This project will become a child resource of this account.')
8+
@minLength(2)
9+
param existingAiFoundryName string
10+
11+
@description('The existing Bing grounding data account that is available to Azure AI Agent agents in this project.')
12+
@minLength(1)
13+
param existingBingAccountName string
14+
15+
@description('The existing Application Insights instance to log token usage in this project.')
16+
@minLength(1)
17+
param existingWebApplicationInsightsResourceName string
18+
19+
// ---- Existing resources ----
20+
21+
#disable-next-line BCP081
22+
resource bingAccount 'Microsoft.Bing/accounts@2025-05-01-preview' existing = {
23+
name: existingBingAccountName
24+
}
25+
26+
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing = {
27+
name: existingWebApplicationInsightsResourceName
28+
}
29+
30+
// ---- New resources ----
31+
32+
@description('Existing Azure AI Foundry account. The project will be created as a child resource of this account.')
33+
resource aiFoundry 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' existing = {
34+
name: existingAiFoundryName
35+
36+
resource project 'projects' = {
37+
name: 'projchat'
38+
location: location
39+
identity: {
40+
type: 'SystemAssigned'
41+
}
42+
properties: {
43+
description: 'Chat using internet data in your Azure AI Agent.'
44+
displayName: 'Chat with Internet Data'
45+
}
46+
47+
@description('Connect this project to application insights for visualization of token usage.')
48+
resource applicationInsightsConnection 'connections' = {
49+
name:'appInsights-connection'
50+
properties: {
51+
authType: 'ApiKey'
52+
category: 'AppInsights'
53+
credentials: {
54+
key: applicationInsights.properties.ConnectionString
55+
}
56+
isSharedToAll: false
57+
target: applicationInsights.id
58+
metadata: {
59+
ApiType: 'Azure'
60+
ResourceId: applicationInsights.id
61+
location: applicationInsights.location
62+
}
63+
}
64+
}
65+
66+
@description('Create project connection to Bing grounding data. Useful for future agents that get created.')
67+
resource bingGroundingConnection 'connections' = {
68+
name: replace(existingBingAccountName, '-', '')
69+
properties: {
70+
authType: 'ApiKey'
71+
target: bingAccount.properties.endpoint
72+
category: 'GroundingWithBingSearch'
73+
metadata: {
74+
type: 'bing_grounding'
75+
ApiType: 'Azure'
76+
ResourceId: bingAccount.id
77+
location: bingAccount.location
78+
}
79+
credentials: {
80+
key: bingAccount.listKeys().key1
81+
}
82+
isSharedToAll: false
83+
}
84+
dependsOn: [
85+
applicationInsightsConnection // Single thread changes to the project, else conflict errors tend to happen
86+
]
87+
}
88+
}
89+
}
90+
91+
// ---- Outputs ----
92+
93+
output aiAgentProjectName string = aiFoundry::project.name
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
targetScope = 'resourceGroup'
2+
3+
@description('The region in which this architecture is deployed. Should match the region of the resource group.')
4+
@minLength(1)
5+
param location string = resourceGroup().location
6+
7+
@description('This is the base name for each Azure resource name (6-8 chars)')
8+
@minLength(6)
9+
@maxLength(8)
10+
param baseName string
11+
12+
@description('The name of the workload\'s existing Log Analytics workspace.')
13+
@minLength(4)
14+
param logAnalyticsWorkspaceName string
15+
16+
@description('Your principal ID. Allows you to access the Azure AI Foundry portal for post-deployment verification of functionality.')
17+
@maxLength(36)
18+
@minLength(36)
19+
param aiFoundryPortalUserPrincipalId string
20+
21+
var aiFoundryName = 'aif${baseName}'
22+
23+
// ---- Existing resources ----
24+
25+
@description('Existing: Built-in Cognitive Services User role.')
26+
resource cognitiveServicesUserRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
27+
name: 'a97b65f3-24c7-4388-baec-2e87135dc908'
28+
scope: subscription()
29+
}
30+
31+
@description('Existing: Log sink for Azure Diagnostics.')
32+
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2025-02-01' existing = {
33+
name: logAnalyticsWorkspaceName
34+
}
35+
36+
// ---- New resources ----
37+
38+
@description('Deploy Azure AI Foundry (account) with Azure AI Agent service capability.')
39+
resource aiFoundry 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' = {
40+
name: aiFoundryName
41+
location: location
42+
kind: 'AIServices'
43+
sku: {
44+
name: 'S0'
45+
}
46+
identity: {
47+
type: 'SystemAssigned'
48+
}
49+
properties: {
50+
customSubDomainName: aiFoundryName
51+
allowProjectManagement: true // Azure AI Foundry account
52+
disableLocalAuth: true
53+
networkAcls: {
54+
bypass: 'AzureServices'
55+
ipRules: []
56+
defaultAction: 'Allow'
57+
virtualNetworkRules: []
58+
}
59+
publicNetworkAccess: 'Enabled'
60+
}
61+
62+
@description('Models are managed at the account level. Deploy the GPT model that will be used for the Azure AI Agent logic.')
63+
resource model 'deployments' = {
64+
name: 'agent-model'
65+
sku: {
66+
capacity: 50
67+
name: 'GlobalStandard'
68+
}
69+
properties: {
70+
model: {
71+
format: 'OpenAI'
72+
name: 'gpt-4o'
73+
version: '2024-11-20' // Use a model version available in your region.
74+
}
75+
versionUpgradeOption: 'NoAutoUpgrade' // Production deployments should not auto-upgrade models. Testing compatibility is important.
76+
}
77+
}
78+
}
79+
80+
// Role assignments
81+
82+
@description('Assign yourself to have access to the Azure AI Foundry portal.')
83+
resource cognitiveServicesUser 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
84+
name: guid(aiFoundry.id, cognitiveServicesUserRole.id, aiFoundryPortalUserPrincipalId)
85+
scope: aiFoundry
86+
properties: {
87+
roleDefinitionId: cognitiveServicesUserRole.id
88+
principalId: aiFoundryPortalUserPrincipalId
89+
principalType: 'User'
90+
}
91+
}
92+
93+
// Azure diagnostics
94+
95+
@description('Enable logging on the Azure AI Foundry account.')
96+
resource azureDiagnostics 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
97+
name: 'default'
98+
scope: aiFoundry
99+
properties: {
100+
workspaceId: logAnalyticsWorkspace.id
101+
logs: [
102+
{
103+
category: 'Audit'
104+
enabled: true
105+
retentionPolicy: {
106+
enabled: false
107+
days: 0
108+
}
109+
}
110+
{
111+
category: 'RequestResponse'
112+
enabled: true
113+
retentionPolicy: {
114+
enabled: false
115+
days: 0
116+
}
117+
}
118+
{
119+
category: 'AzureOpenAIRequestUsage'
120+
enabled: true
121+
retentionPolicy: {
122+
enabled: false
123+
days: 0
124+
}
125+
}
126+
{
127+
category: 'Trace'
128+
enabled: true
129+
retentionPolicy: {
130+
enabled: false
131+
days: 0
132+
}
133+
}
134+
]
135+
}
136+
}
137+
138+
// ---- Outputs ----
139+
140+
@description('The name of the Azure AI Foundry account.')
141+
output aiFoundryName string = aiFoundry.name

0 commit comments

Comments
 (0)