Skip to content

Commit d4c5788

Browse files
authored
Merge pull request #1997 from MicrosoftDocs/main
12/13/2024 PM Publish
2 parents 3c837a2 + 43268fc commit d4c5788

File tree

64 files changed

+3220
-24
lines changed

Some content is hidden

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

64 files changed

+3220
-24
lines changed

.openpublishing.publish.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@
104104
"branch": "master",
105105
"branch_mapping": {}
106106
},
107+
{
108+
"path_to_root": "azureai-samples-main",
109+
"url": "https://github.com/Azure-Samples/azureai-samples",
110+
"branch": "main",
111+
"branch_mapping": {}
112+
},
107113
{
108114
"path_to_root": "azureai-samples-nov2024",
109115
"url": "https://github.com/Azure-Samples/azureai-samples",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
- name: Azure
2+
tocHref: /azure/
3+
topicHref: /azure/index
4+
items:
5+
- name: Azure AI services
6+
tocHref: /azure/ai-services/
7+
topicHref: /azure/ai-services/index
8+
items:
9+
- name: Azure AI Agent Service
10+
tocHref: /azure/ai-services/
11+
topicHref: /azure/ai-services/agents/index
12+
- name: Azure
13+
tocHref: /legal/
14+
topicHref: /azure/index
15+
items:
16+
- name: Azure AI services # Original doc set name
17+
tocHref: /legal/cognitive-services/openai # Destination doc set route
18+
topicHref: /azure/ai-services/agents/index # Original doc set route
19+
items:
20+
- name: Azure AI Agent Service # Destination doc set name
21+
tocHref: /legal/cognitive-services/openai # Destination doc set route
22+
topicHref: /azure/ai-services/agents/index # Original doc set route
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
title: What are agents?
3+
titleSuffix: Azure AI services
4+
description: Learn about using agents in the Azure AI Agent Service.
5+
manager: nitinme
6+
author: aahill
7+
ms.author: aahi
8+
ms.service: azure
9+
ms.topic: conceptual
10+
ms.date: 12/11/2024
11+
ms.custom: azure-ai-agents
12+
---
13+
14+
# What are agents?
15+
16+
Azure AI Agent Service is now available in public preview. The service makes it easier for developers to create applications with sophisticated copilot-like experiences that can sift through data, suggest solutions, and automate tasks.
17+
18+
* Agents can call Azure OpenAI and other [models](./model-region-support.md) with specific instructions to tune their personality and capabilities.
19+
* Agents can access **multiple tools in parallel**. These can be both tools like [code interpreter](../how-to/tools/code-interpreter.md) <!--and [file search](../how-to/tools/file-search.md),--> or tools you build, host, and access through [function calling](../how-to/tools/function-calling.md).
20+
* Agents can access **persistent Threads**. Threads simplify AI application development by storing message history and truncating it when the conversation gets too long for the model's context length. You create a thread once, and append messages to it as your users reply.
21+
* Agents can access files in several formats. Either as part of their creation or as part of threads between agents and users. When using tools, agents can also create files (such as images or spreadsheets) and cite files they reference in the messages they create.
22+
23+
## Overview
24+
25+
Previously, building custom AI agents needed heavy lifting even for experienced developers. While many APIs are lightweight and powerful like Azure OpenAI's chat completions API, it's inherently stateless which means that developers had to manage conversation state and chat threads, tool integrations, retrieval documents and indexes, and execute code manually.
26+
27+
Azure AI Agents Service, as the evolution of the chat completion API and Assistants, provides a solution for these challenges. Agents support persistent automatically managed threads. This means that as a developer you no longer need to develop conversation state management systems and work around a model’s context window constraints. Agents will automatically handle the optimizations to keep the thread below the max context window of your chosen model. Once you create a thread, you can append new messages to it as users respond. Agents can also access multiple [tools](../how-to/tools/overview.md) in parallel.
28+
29+
Azure AI Agents Service is built on the same capabilities that power Azure OpenAI's assistants. Some possible use cases range from AI-powered product recommender, sales analyst app, coding assistant, employee Q&A chatbot, and more.
30+
31+
> [!IMPORTANT]
32+
> Retrieving untrusted data using Function Calling, Code Interpreter or File Search with file input, and agent threads functionalities could compromise the security of your agent, or the application that uses the agent.
33+
34+
## Agents components
35+
36+
<!-- :::image type="content" source="../media/agents/agents-overview.png" alt-text="A diagram showing the components of an agent." lightbox="../media/agents/agents-overview.png"::: -->
37+
38+
| **Component** | **Description** |
39+
|---|---|
40+
| **Agent** | Custom AI that uses models in conjunction with tools. |
41+
|**Thread** | A conversation session between an agent and a user. Threads store Messages and automatically handle truncation to fit content into a model’s context.|
42+
| **Message** | A message created by an agent or a user. Messages can include text, images, and other files. Messages are stored as a list on the Thread. |
43+
|**Run** | Activation of an agent to begin running based on the contents of the Thread. The agent uses its configuration and the Thread’s Messages to perform tasks by calling models and tools. As part of a Run, the agent appends Messages to the Thread.|
44+
|**Run Step** | A detailed list of steps the agent took as part of a Run. An agent can call tools or create Messages during it’s run. Examining Run Steps allows you to understand how the agent is getting to its final results. |
45+
46+
<!--## Agents data access
47+
48+
Currently, agents, threads, messages, and files created for agents are scoped at the resource level. Therefore, anyone with access to the resource or API key access is able to read/write agents, threads, messages, and files.
49+
50+
We strongly recommend the following data access controls:
51+
52+
- Implement authorization. Before performing reads or writes on agents, threads, messages, and files, ensure that the end-user is authorized to do so.
53+
- Restrict resource and API key access. Carefully consider who has access to resources where agents are being used, and the associated API keys.
54+
- Routinely audit which accounts/individuals have access to the resource. API keys and resource level access enable a wide range of operations including reading and modifying messages and files.
55+
- If you're using Azure OpenAI models, enabling [diagnostic settings](../../openai/how-to/monitor-openai.md#configure-diagnostic-settings) to allow long-term tracking of certain aspects of the Azure OpenAI resource's activity log.
56+
-->
57+
58+
## Parameters
59+
60+
The agents API has support for several parameters that let you customize the agents' output. The `tool_choice` parameter lets you force the agent to use a specified tool. You can also create messages with the `assistant` role to create custom conversation histories in Threads. `temperature`, `top_p`, `response_format` let you further tune responses. <!-- For more information, see the [reference](../agents-reference.md#create-an-assistant) documentation. -->
61+
62+
## Context window management
63+
64+
Agents automatically truncate text to ensure it stays within the model's maximum context length. You can customize this behavior by specifying the maximum tokens you'd like a run to utilize and/or the maximum number of recent messages you'd like to include in a run.
65+
66+
### Max completion and max prompt tokens
67+
68+
To control the token usage in a single Run, set `max_prompt_tokens` and `max_completion_tokens` when you create the Run. These limits apply to the total number of tokens used in all completions throughout the Run's lifecycle.
69+
70+
For example, initiating a Run with `max_prompt_tokens` set to 500 and `max_completion_tokens` set to 1000 means the first completion will truncate the thread to 500 tokens and cap the output at 1,000 tokens. If only 200 prompt tokens and 300 completion tokens are used in the first completion, the second completion will have available limits of 300 prompt tokens and 700 completion tokens.
71+
72+
If a completion reaches the `max_completion_tokens` limit, the run will terminate with a status of incomplete, and details will be provided in the `incomplete_details` field of the run object.
73+
74+
When using the File Search tool, we recommend setting the `max_prompt_tokens` to no less than 20,000. For longer conversations or multiple interactions with File Search, consider increasing this limit to 50,000, or ideally, removing the `max_prompt_tokens` limits altogether to get the highest quality results.
75+
76+
## Truncation strategy
77+
78+
You can also specify a truncation strategy to control how your thread should be rendered into the model's context window. Using a truncation strategy of type `auto` will use OpenAI's default truncation strategy. Using a truncation strategy of type `last_messages` will allow you to specify the number of the most recent messages to include in the context window.
79+
80+
## See also
81+
* Learn more about [agents](../overview.md). <!--and [File Search](../how-to/tools/file-search.md)-->
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: Supported models in Azure AI Agent Service
3+
titleSuffix: Azure AI services
4+
description: Learn about the models you can use with Azure AI Agent Service.
5+
manager: nitinme
6+
author: aahill
7+
ms.author: aahi
8+
ms.service: azure
9+
ms.topic: conceptual
10+
ms.date: 12/11/2024
11+
ms.custom: azure-ai-agents
12+
---
13+
14+
# Models supported by Azure AI Agent Service
15+
16+
Agents are powered by a diverse set of models with different capabilities and price points. Model availability varies by region and cloud. Certain tools and capabilities require the latest models. The following models are available in the available SDKs. The following table is for pay-as-you-go. For information on Provisioned Throughput Unit (PTU) availability, see [provisioned throughput](../../openai/concepts/provisioned-throughput.md) in the OpenAI documentation. You can use [global standard models](../../openai/concepts/models.md#global-standard-model-availability) if they're supported in the regions listed here.
17+
18+
## Azure OpenAI models
19+
20+
Azure AI Agent service supports the same models as the chat completions API in Azure OpenAI, in the following regions.
21+
22+
| **Region** | **o1-preview**, **2024-09-12** | **o1-mini**, **2024-09-12** | **gpt-4o**, **2024-05-13** | **gpt-4o**, **2024-08-06** | **gpt-4o-mini**, **2024-07-18** | **gpt-4**, **0613** | **gpt-4**, **1106-Preview** | **gpt-4**, **0125-Preview** | **gpt-4**, **vision-preview** | **gpt-4**, **turbo-2024-04-09** | **gpt-4-32k**, **0613** | **gpt-35-turbo**, **0301** | **gpt-35-turbo**, **0613** | **gpt-35-turbo**, **1106** | **gpt-35-turbo**, **0125** | **gpt-35-turbo-16k**, **0613** |
23+
|:-----------------|:------------------------------:|:---------------------------:|:--------------------------:|:--------------------------:|:-------------------------------:|:-------------------:|:---------------------------:|:---------------------------:|:-----------------------------:|:-------------------------------:|:-----------------------:|:--------------------------:|:--------------------------:|:--------------------------:|:--------------------------:|:------------------------------:|
24+
| eastus |||||| - | - || - || - ||| - |||
25+
| francecentral | - | - | - | - | - ||| - | - | - ||||| - ||
26+
| japaneast | - | - | - | - | - | - | - | - || - | - | - || - |||
27+
| uksouth | - | - | - | - | - | - ||| - | - | - ||||||
28+
| westus |||||| - || - ||| - | - | - ||| - |
29+
30+
31+
## Additional models
32+
33+
In addition to the supported Azure OpenAI models, you can also use the following 3rd party models with Azure AI Agent Service.
34+
35+
* Llama 3.1-70B-instruct
36+
* Mistral-large-2407
37+
* Cohere command R+
38+
39+
To use these models, you can use Azure AI Foundry portal to make a deployment, and then reference it in your agent.
40+
41+
1. Go to the [Azure AI Foundry portal](https://ai.azure.com/) and select **Model catalog** in the left navigation menu, and scroll down to **Meta-Llama-3-70B-Instruct**. You can also find and use one of the models listed above.
42+
43+
1. Select **Deploy**.
44+
45+
1. In the Deployment options screen that appears, select **Serverless API** with Azure AI Content Safety.
46+
47+
:::image type="content" source="../media/llama/llama-deployment.png" alt-text="An image of the llama model project selection screen.":::
48+
49+
1. Select your project and click **Subscribe and deploy**.
50+
51+
:::image type="content" source="../media/llama/llama-deployment-2.png" alt-text="An image of the llama model deployment screen.":::
52+
53+
1. Add the serverless connection to your hub/project. The deployment name you choose will be the one you reference in your code.
54+
55+
1. When calling agent creation API, set the `models` parameter to your deployment name. For example:
56+
57+
# [Python](#tab/python)
58+
59+
```python
60+
agent = project_client.agents.create_agent( model="llama-3", name="my-agent", instructions="You are a helpful agent" )
61+
```
62+
63+
# [C#](#tab/csharp)
64+
65+
```csharp
66+
Response<Agent> agentResponse = await client.CreateAgentAsync(
67+
model: "llama-3",
68+
name: "My agent",
69+
instructions: "You are a helpful agent"
70+
```
71+
---
72+
73+
74+
## Next steps
75+
76+
[Create a new Agent project](../quickstart.md)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: 'How to enable tracing in Azure AI Agents'
3+
titleSuffix: Azure AI services
4+
description: Learn how to trace your AI agent's executions for debugging and evaluation.
5+
services: cognitive-services
6+
manager: nitinme
7+
ms.service: azure
8+
ms.topic: conceptual
9+
ms.date: 12/11/2024
10+
author: aahill
11+
ms.author: aahi
12+
---
13+
14+
# Tracing using Application Insights
15+
16+
Determining the reasoning behind your agent's executions is important for troubleshooting and debugging. However, it can be difficult for complex agents for a number of reasons:
17+
* There could be a high number of steps involved in generating a response, making it hard to keep track of all of them.
18+
* The sequence of steps might vary based on user input.
19+
* The inputs/outputs at each stage might be long and deserve more detailed inspection.
20+
* Each step of an agent's runtime might also involve nesting. For example, an agent might invoke a tool, which uses another process, which then invokes another tool. If you notice strange or incorrect output from a top-level agent run, it might be difficult to determine exactly where in the execution the issue was introduced.
21+
22+
Tracing solves this by allowing you to clearly see the inputs and outputs of each primitive involved in a particular agent run, in the order in which they were invoked.
23+
24+
## Creating an Application Insights resource
25+
26+
Tracing lets you analyze your agent's performance and behavior by using OpenTelemetry and adding an Application Insights resource to your Azure AI Foundry project.
27+
28+
To add an Application Insights resource, navigate to the **Tracing** tab in the [AI Foundry portal](https://ai.azure.com/), and create a new resource if you don't already have one.
29+
30+
:::image type="content" source="../media/ai-foundry-tracing.png" alt-text="A screenshot of the tracing screen in the AI Foundry portal." lightbox="../media/ai-foundry-tracing.png":::
31+
32+
Once created, you can get an Application Insights connection string, configure your agents, and observe the full execution path of your agent through Azure Monitor. Typically you want to enable tracing before you create an agent.
33+
34+
## Trace an agent
35+
36+
First, use `pip install` to install OpenTelemetry and the Azure SDK tracing plugin.
37+
38+
```bash
39+
pip install opentelemetry
40+
pip install azure-core-tracing-opentelemetry
41+
```
42+
43+
You will also need an exporter to send results to your observability backend. You can print traces to the console or use a local viewer such as [Aspire Dashboard](/dotnet/aspire/fundamentals/dashboard/standalone?tabs=bash). To connect to Aspire Dashboard or another OpenTelemetry compatible backend, install the OpenTelemetry Protocol (OTLP) exporter.
44+
45+
```bash
46+
pip install opentelemetry-exporter-otlp
47+
```
48+
49+
Once you have the packages installed, you can use one the following Python samples to implement tracing with your agents. Samples that use console tracing display the results locally in the console. Samples that use Azure Monitor send the traces to the Azure Monitor in the [AI Foundry portal](https://ai.azure.com/), in the **Tracing** tab in the left navigation menu for the portal.
50+
51+
> [!NOTE]
52+
> There is a known bug in the agents tracing functionality. The bug will cause the agent's function tool to call related info (function names and parameter values, which could contain sensitive information) to be included in the traces even when content recording is not enabled.
53+
54+
55+
**Using Azure Monitor**
56+
* [Basic agent example](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_basics_with_azure_monitor_tracing.py)
57+
* [Agent example with function calling](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_functions_with_azure_monitor_tracing.py)
58+
* [Example with a stream event handler](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_stream_eventhandler_with_azure_monitor_tracing.py)
59+
60+
**Using console tracing**
61+
* [Basic agent example](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_basics_with_console_tracing.py)
62+
* [Agent example with function calling](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_functions_with_console_tracing.py)
63+
* [Example with a stream event handler](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_stream_eventhandler_with_console_tracing.py)
64+
65+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### YamlMime: ContextObject
2+
brand: azure
3+
breadcrumb_path: ../breadcrumb/toc.yml
4+
toc_rel: ../toc.yml

0 commit comments

Comments
 (0)