Skip to content

Commit e2c9d4f

Browse files
authored
Merge pull request #181 from Azure-Samples/howie/resolve-feedback
Improved doc and fixed query AI Search in Azure Portal has missing roles
2 parents c63e138 + 0b87b4b commit e2c9d4f

File tree

6 files changed

+49
-9
lines changed

6 files changed

+49
-9
lines changed

azure.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
name: azd-get-started-with-ai-agents
66
metadata:
7-
template: [email protected].1
7+
template: [email protected].2
88
requiredVersions:
99
azd: ">=1.14.0"
1010

205 KB
Loading
228 KB
Loading

docs/images/tracing_tab.png

283 KB
Loading

docs/other_features.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,53 @@
22

33
## Tracing and Monitoring
44

5-
You can view console logs in Azure portal. You can get the link to the resource group with the azd tool:
5+
**First, if tracing isn't enabled yet, enable tracing by setting the environment variable:**
6+
7+
```shell
8+
azd env set ENABLE_AZURE_MONITOR_TRACING true
9+
azd deploy
10+
```
11+
12+
You can view console logs in the Azure portal. You can get the link to the resource group with the azd tool:
613

714
```shell
815
azd show
916
```
1017

1118
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.
1219

13-
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.
20+
After accessing your 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.
21+
22+
You can view the App Insights tracing in Azure AI Foundry. Select your project on the Azure AI Foundry page and then click 'Tracing'.
1423

15-
You can view the App Insights tracing in Azure AI Foundry. Select your project on the Azure AI Foundry page and then click 'Tracing'.
24+
![Tracing Tab](../docs/images/tracing_tab.png)
1625

1726
## Agent Evaluation
1827

19-
AI Foundry offers a number of [built-in evaluators](https://learn.microsoft.com/en-us/azure/ai-foundry/how-to/develop/agent-evaluate-sdk) to measure the quality, efficiency, risk and safety of your agents. For example, intent resolution, tool call accuracy, and task adherence evaluators are targeted to assess the performance of agent workflow, while content safety evaluator checks for inappropriate content in the responses such as violence or hate.
28+
**First, make sure tracing is working by following the steps in the [Tracing and Monitoring](#tracing-and-monitoring) section above.**
2029

21-
In this template, we show how these evaluations can be performed during different phases of your development cycle.
30+
AI Foundry offers a number of [built-in evaluators](https://learn.microsoft.com/azure/ai-foundry/how-to/develop/agent-evaluate-sdk) to measure the quality, efficiency, risk and safety of your agents. For example, intent resolution, tool call accuracy, and task adherence evaluators are targeted to assess the performance of agent workflow, while content safety evaluator checks for inappropriate content in the responses such as violence or hate. (screenshot)
31+
32+
In this template, we show how these evaluations can be performed during different phases of your development cycle.
2233

2334
- **Local development**: You can use this [local evaluation script](../evals/evaluate.py) to get performance and evaluation metrics based on a set of [test queries](../evals/eval-queries.json) for a sample set of built-in evaluators.
2435

2536
The script reads the following environment variables:
2637
- `AZURE_EXISTING_AIPROJECT_ENDPOINT`: AI Project endpoint
2738
- `AZURE_EXISTING_AGENT_ID`: AI Agent Id, with fallback logic to look up agent Id by name `AZURE_AI_AGENT_NAME`
2839
- `AZURE_AI_AGENT_DEPLOYMENT_NAME`: Deployment model used by the AI-assisted evaluators, with fallback logic to your agent model
40+
41+
** (Optional) All of these are generated locally in [`.env`](../src/.env) after executing `azd up` except `AZURE_EXISTING_AGENT_ID` which is generated remotely. To find this variables remotely in Container App, follow this:
42+
43+
1. Go to [Azure AI Foundry Portal](https://ai.azure.com/) and sign in
44+
2. Click on your project from the homepage
45+
3. In the left-hand menu, select Agents
46+
4. Choose the agent you want to inspect
47+
5. The Agent ID will be shown in the agent’s detail panel—usually near the top or under the “Properties” or “Overview” tab [Entra Agent ID Spec]
48+
![Agent ID in Foundry UI](./images/agent_id_in_foundry_ui.png)
49+
2950

30-
To install required packages and run the script:
51+
To install required packages and run the script:
3152

3253
```shell
3354
python -m pip install -r src/requirements.txt
@@ -38,7 +59,14 @@ AI Foundry offers a number of [built-in evaluators](https://learn.microsoft.com/
3859

3960
- **Monitoring**: When tracing is enabled, the [application code](../src/api/routes.py) sends an asynchronous evaluation request after processing a thread run, allowing continuous monitoring of your agent. You can view results from the AI Foundry Tracing tab.
4061
![Tracing](./images/tracing_eval_screenshot.png)
41-
Alternatively, you can go to your Application Insights logs for an interactive experience. Here is an example query to see logs on thread runs and related events.
62+
Alternatively, you can go to your Application Insights logs for an interactive experience. To access Application Insights logs in the Azure portal:
63+
64+
1. Navigate to your resource group (use `azd show` to get the link)
65+
2. Find and click on the Application Insights resource (usually named starts with `appi-`)
66+
3. In the left menu, click on **Logs** under the **Monitoring** section
67+
4. You can now run KQL queries in the query editor
68+
69+
Here is an example query to see logs on thread runs and related events:
4270

4371
```kql
4472
let thread_run_events = traces
@@ -50,6 +78,8 @@ AI Foundry offers a number of [built-in evaluators](https://learn.microsoft.com/
5078
| project timestamp, thread_run_id, name, success, duration, event_message = message, event_dimensions=customDimensions1
5179
```
5280

81+
![Application Insight Logs Query](../docs/images/app_insight_logs_query.png)
82+
5383
- **Continuous Integration**: You can try the [AI Agent Evaluation GitHub action](https://github.com/microsoft/ai-agent-evals) using the [sample GitHub workflow](../.github/workflows/ai-evaluation.yaml) in your CI/CD pipeline. This GitHub action runs a set of queries against your agent, performs evaluations with evaluators of your choice, and produce a summary report. It also supports a comparison mode with statistical test, allowing you to iterate agent changes on your production environment with confidence. See [documentation](https://github.com/microsoft/ai-agent-evals) for more details.
5484

5585
## AI Red Teaming Agent
@@ -58,7 +88,7 @@ The [AI Red Teaming Agent](https://learn.microsoft.com/azure/ai-foundry/concepts
5888

5989
In this [script](../airedteaming/ai_redteaming.py), you will be able to set up an AI Red Teaming Agent to run an automated scan of your agent in this sample. No test dataset or adversarial LLM is needed as the AI Red Teaming Agent will generate all the attack prompts for you.
6090

61-
To install required extra package from Azure AI Evaluation SDK and run the script in your local development environment:
91+
To install required extra packages from Azure AI Evaluation SDK and run the script in your local development environment:
6292

6393
```shell
6494
python -m pip install -r src/requirements.txt

infra/core/search/search-services.bicep

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ resource search 'Microsoft.Search/searchServices@2024-06-01-preview' = {
6666
}
6767
}
6868

69+
module aiSearchCognitiveServicesUser '../security/role.bicep' = {
70+
name: 'aisearch-role-cognitive-services-user'
71+
scope: resourceGroup()
72+
params: {
73+
principalType: 'ServicePrincipal'
74+
principalId: search.identity.principalId
75+
roleDefinitionId: 'a97b65f3-24c7-4388-baec-2e87135dc908'
76+
}
77+
}
78+
6979
resource aiServices 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' existing = {
7080
name: serviceName
7181

0 commit comments

Comments
 (0)