Skip to content

Commit 134c6bb

Browse files
authored
Merge pull request #738 from jozkee/docs_agent_types
Suggestions for user-guide/agents/agent-types C# sections
2 parents 26a6691 + 44201cf commit 134c6bb

11 files changed

Lines changed: 145 additions & 36 deletions

agent-framework/user-guide/agents/agent-types/TOC.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
href: index.md
33
- name: Azure AI Foundry Agents
44
href: azure-ai-foundry-agent.md
5-
- name: Azure AI Foundry Models Agents
6-
href: azure-ai-foundry-models.md
5+
- name: Azure AI Foundry Models Agents via ChatCompletion
6+
href: azure-ai-foundry-models-chat-completion-agent.md
7+
- name: Azure AI Foundry Models Agents via Responses
8+
href: azure-ai-foundry-models-responses-agent.md
79
- name: Azure OpenAI ChatCompletion Agents
810
href: azure-openai-chat-completion-agent.md
911
- name: Azure OpenAI Responses Agents

agent-framework/user-guide/agents/agent-types/azure-ai-foundry-agent.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ ms.service: agent-framework
1111

1212
# Azure AI Foundry Agents
1313

14-
The Microsoft Agent Framework supports creating agents that use the [Azure AI Foundry Agents](/azure/ai-foundry/agents/overview) service.
14+
The Microsoft Agent Framework supports creating agents that use the [Azure AI Foundry Agents](/azure/ai-foundry/agents/overview) service, you can create persistent service-based agent instances with service-managed conversation threads.
1515

1616
::: zone pivot="programming-language-csharp"
1717

1818
## Getting Started
1919

20-
Add the Agents Azure AI NuGet package to your project.
20+
Add the required NuGet packages to your project.
2121

2222
```powershell
2323
dotnet add package Azure.Identity
@@ -55,6 +55,9 @@ var agentMetadata = await persistentAgentsClient.Administration.CreateAgentAsync
5555

5656
// Retrieve the agent that was just created as an AIAgent using its ID
5757
AIAgent agent1 = await persistentAgentsClient.GetAIAgentAsync(agentMetadata.Value.Id);
58+
59+
// Invoke the agent and output the text result.
60+
Console.WriteLine(await agent1.RunAsync("Tell me a joke about a pirate."));
5861
```
5962

6063
### Using the Agent Framework helpers
@@ -341,4 +344,4 @@ See the [Agent getting started tutorials](../../../tutorials/overview.md) for mo
341344
## Next steps
342345

343346
> [!div class="nextstepaction"]
344-
> [Azure AI Foundry Models based Agents](./azure-ai-foundry-models.md)
347+
> [Azure AI Foundry Models based Agents](./azure-ai-foundry-models-chat-completion-agent.md)

agent-framework/user-guide/agents/agent-types/azure-ai-foundry-models.md renamed to agent-framework/user-guide/agents/agent-types/azure-ai-foundry-models-chat-completion-agent.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Azure AI Foundry Models Agents
3-
description: Learn how to use the Microsoft Agent Framework with Azure AI Foundry Models service.
2+
title: Azure AI Foundry Models ChatCompletion Agents
3+
description: Learn how to use the Microsoft Agent Framework with Azure AI Foundry Models service via OpenAI ChatCompletion API.
44
zone_pivot_groups: programming-languages
55
author: westey-m
66
ms.topic: tutorial
@@ -11,8 +11,9 @@ ms.service: agent-framework
1111

1212
# Azure AI Foundry Models Agents
1313

14+
The Microsoft Agent Framework supports creating agents using models deployed with Azure AI Foundry Models via an OpenAI Chat Completion compatible API, and therefore the OpenAI client libraries can be used to access Foundry models.
15+
1416
[Azure AI Foundry supports deploying](/azure/ai-foundry/foundry-models/how-to/create-model-deployments?pivots=ai-foundry-portal) a wide range of models, including open source models.
15-
Microsoft Agent Framework can create agents that use these models.
1617

1718
> [!NOTE]
1819
> The capabilities of these models may limit the functionality of the agents. For example, many open source models do not support function calling and therefore any agent based on such models will not be able to use function tools.
@@ -21,11 +22,10 @@ Microsoft Agent Framework can create agents that use these models.
2122

2223
## Getting Started
2324

24-
Foundry supports accessing models via an OpenAI Chat Completion compatible API, and therefore the OpenAI client libraries can be used to access Foundry models.
25-
2625
Add the required NuGet packages to your project.
2726

2827
```powershell
28+
dotnet add package Azure.Identity
2929
dotnet add package Microsoft.Agents.AI.OpenAI --prerelease
3030
```
3131

@@ -37,24 +37,18 @@ Since the code is not using the default OpenAI service, the URI of the OpenAI co
3737

3838
```csharp
3939
using System;
40+
using System.ClientModel.Primitives;
41+
using Azure.Identity;
4042
using Microsoft.Agents.AI;
4143
using OpenAI;
4244

43-
var clientOptions = new OpenAIClientOptions() { Endpoint = new Uri("https://ai-foundry-<your-resource>.services.ai.azure.com/openai/v1/") };
44-
```
45-
46-
There are different options for constructing the `OpenAIClient` depending on the desired authentication method. Let's look at two common options.
47-
48-
The first option uses an API key.
45+
var clientOptions = new OpenAIClientOptions() { Endpoint = new Uri("https://<myresource>.services.ai.azure.com/openai/v1/") };
4946

50-
```csharp
51-
OpenAIClient client = new OpenAIClient(new ApiKeyCredential("<your_api_key>"), clientOptions);
52-
```
53-
54-
The second option uses token based authentication, and here it is using the Azure CLI credential to get a token.
55-
56-
```csharp
47+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
5748
OpenAIClient client = new OpenAIClient(new BearerTokenPolicy(new AzureCliCredential(), "https://ai.azure.com/.default"), clientOptions);
49+
#pragma warning restore OPENAI001
50+
// You can optionally authenticate with an API key
51+
// OpenAIClient client = new OpenAIClient(new ApiKeyCredential("<your_api_key>"), clientOptions);
5852
```
5953

6054
A client for chat completions can then be created using the model deployment name.
@@ -69,13 +63,16 @@ Finally, the agent can be created using the `CreateAIAgent` extension method on
6963
AIAgent agent = chatCompletionClient.CreateAIAgent(
7064
instructions: "You are good at telling jokes.",
7165
name: "Joker");
66+
67+
// Invoke the agent and output the text result.
68+
Console.WriteLine(await agent.RunAsync("Tell me a joke about a pirate."));
7269
```
7370

7471
## Using the Agent
7572

7673
The agent is a standard `AIAgent` and supports all standard `AIAgent` operations.
7774

78-
For more information on how to run and interact with agents, see the [Agent getting started tutorials](../../../tutorials/overview.md)
75+
See the [Agent getting started tutorials](../../../tutorials/overview.md) for more information on how to run and interact with agents.
7976

8077
::: zone-end
8178
::: zone pivot="programming-language-python"
@@ -87,4 +84,4 @@ More docs coming soon.
8784
## Next steps
8885

8986
> [!div class="nextstepaction"]
90-
> [Azure OpenAI ChatCompletion Agents](./azure-openai-chat-completion-agent.md)
87+
> [Azure OpenAI ChatCompletion Agents](./azure-ai-foundry-models-responses-agent.md)
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: Azure AI Foundry Models Responses Agents
3+
description: Learn how to use the Microsoft Agent Framework with Azure AI Foundry Models service via OpenAI Responses API.
4+
zone_pivot_groups: programming-languages
5+
author: jozkee
6+
ms.topic: tutorial
7+
ms.author: dacantu
8+
ms.date: 10/22/2025
9+
ms.service: agent-framework
10+
---
11+
12+
# Azure AI Foundry Models Responses Agents
13+
14+
The Microsoft Agent Framework supports creating agents using models deployed with Azure AI Foundry Models via an OpenAI Responses compatible API, and therefore the OpenAI client libraries can be used to access Foundry models.
15+
16+
::: zone pivot="programming-language-csharp"
17+
18+
## Getting Started
19+
20+
Add the required NuGet packages to your project.
21+
22+
```powershell
23+
dotnet add package Azure.Identity
24+
dotnet add package Microsoft.Agents.AI.OpenAI --prerelease
25+
```
26+
27+
## Creating an OpenAI Responses Agent with Foundry Models
28+
29+
As a first step you need to create a client to connect to the OpenAI service.
30+
31+
Since the code is not using the default OpenAI service, the URI of the OpenAI compatible Foundry service, needs to be provided via `OpenAIClientOptions`.
32+
33+
```csharp
34+
using System;
35+
using System.ClientModel.Primitives;
36+
using Azure.Identity;
37+
using Microsoft.Agents.AI;
38+
using OpenAI;
39+
40+
var clientOptions = new OpenAIClientOptions() { Endpoint = new Uri("https://<myresource>.services.ai.azure.com/openai/v1/") };
41+
42+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
43+
OpenAIClient client = new OpenAIClient(new BearerTokenPolicy(new AzureCliCredential(), "https://ai.azure.com/.default"), clientOptions);
44+
#pragma warning restore OPENAI001
45+
// You can optionally authenticate with an API key
46+
// OpenAIClient client = new OpenAIClient(new ApiKeyCredential("<your_api_key>"), clientOptions);
47+
```
48+
49+
A client for responses can then be created using the model deployment name.
50+
51+
```csharp
52+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
53+
var responseClient = client.GetOpenAIResponseClient("gpt-4o-mini");
54+
#pragma warning restore OPENAI001
55+
```
56+
57+
Finally, the agent can be created using the `CreateAIAgent` extension method on the `ResponseClient`.
58+
59+
```csharp
60+
AIAgent agent = responseClient.CreateAIAgent(
61+
instructions: "You are good at telling jokes.",
62+
name: "Joker");
63+
64+
// Invoke the agent and output the text result.
65+
Console.WriteLine(await agent.RunAsync("Tell me a joke about a pirate."));
66+
```
67+
68+
## Using the Agent
69+
70+
The agent is a standard `AIAgent` and supports all standard `AIAgent` operations.
71+
72+
See the [Agent getting started tutorials](../../../tutorials/overview.md) for more information on how to run and interact with agents.
73+
74+
::: zone-end
75+
::: zone pivot="programming-language-python"
76+
77+
More docs coming soon.
78+
79+
::: zone-end
80+
81+
## Next steps
82+
83+
> [!div class="nextstepaction"]
84+
> [Azure OpenAI Responses Agents](./azure-openai-responses-agent.md)

agent-framework/user-guide/agents/agent-types/azure-openai-chat-completion-agent.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ The Microsoft Agent Framework supports creating agents that use the [Azure OpenA
2020
Add the required NuGet packages to your project.
2121

2222
```powershell
23-
dotnet add package Microsoft.Agents.AI.OpenAI --prerelease
24-
dotnet add package Azure.AI.OpenAI
23+
dotnet add package Azure.AI.OpenAI --prerelease
2524
dotnet add package Azure.Identity
25+
dotnet add package Microsoft.Agents.AI.OpenAI --prerelease
2626
```
2727

2828
## Creating an Azure OpenAI ChatCompletion Agent
@@ -99,6 +99,7 @@ Get responses as they are generated using streaming:
9999
AIAgent agent = chatCompletionClient.CreateAIAgent(
100100
instructions: "You are good at telling jokes.",
101101
name: "Joker");
102+
102103
// Invoke the agent with streaming support.
103104
await foreach (var update in agent.RunStreamingAsync("Tell me a joke about a pirate."))
104105
{

agent-framework/user-guide/agents/agent-types/azure-openai-responses-agent.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.service: agent-framework
1111

1212
# Azure OpenAI Responses Agents
1313

14-
The Microsoft Agent Framework supports creating agents that use the [Azure OpenAI responses](/azure/ai-foundry/openai/how-to/responses) service.
14+
The Microsoft Agent Framework supports creating agents that use the [Azure OpenAI Responses](/azure/ai-foundry/openai/how-to/responses) service.
1515

1616
::: zone pivot="programming-language-csharp"
1717

@@ -20,9 +20,9 @@ The Microsoft Agent Framework supports creating agents that use the [Azure OpenA
2020
Add the required NuGet packages to your project.
2121

2222
```powershell
23-
dotnet add package Microsoft.Agents.AI.OpenAI --prerelease
24-
dotnet add package Azure.AI.OpenAI
23+
dotnet add package Azure.AI.OpenAI --prerelease
2524
dotnet add package Azure.Identity
25+
dotnet add package Microsoft.Agents.AI.OpenAI --prerelease
2626
```
2727

2828
## Creating an Azure OpenAI Responses Agent
@@ -37,15 +37,17 @@ using Microsoft.Agents.AI;
3737
using OpenAI;
3838

3939
AzureOpenAIClient client = new AzureOpenAIClient(
40-
new Uri("https://<myresource>.openai.azure.com"),
40+
new Uri("https://<myresource>.openai.azure.com/openai/v1/"),
4141
new AzureCliCredential());
4242
```
4343

4444
Azure OpenAI supports multiple services that all provide model calling capabilities.
4545
We need to pick the Responses service to create a Responses based agent.
4646

4747
```csharp
48+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
4849
var responseClient = client.GetOpenAIResponseClient("gpt-4o-mini");
50+
#pragma warning restore OPENAI001
4951
```
5052

5153
Finally, create the agent using the `CreateAIAgent` extension method on the `ResponseClient`.
@@ -54,6 +56,9 @@ Finally, create the agent using the `CreateAIAgent` extension method on the `Res
5456
AIAgent agent = responseClient.CreateAIAgent(
5557
instructions: "You are good at telling jokes.",
5658
name: "Joker");
59+
60+
// Invoke the agent and output the text result.
61+
Console.WriteLine(await agent.RunAsync("Tell me a joke about a pirate."));
5762
```
5863

5964
## Using the Agent

agent-framework/user-guide/agents/agent-types/chat-client-agent.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ AIAgent agent = new ChatClientAgent(
5353
chatClient,
5454
instructions: "You are good at telling jokes.",
5555
name: "Joker");
56+
57+
// Invoke the agent and output the text result.
58+
Console.WriteLine(await agent.RunAsync("Tell me a joke about a pirate."));
5659
```
5760

5861
> [!IMPORTANT]

agent-framework/user-guide/agents/agent-types/index.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ These agents support a wide range of functionality out of the box:
3434
1. Custom service provided tools (e.g. MCP, Code Execution)
3535
1. Structured output
3636

37-
To create one of these agents, simply construct a `ChatClientAgent` using the ChatClient implementation of your choice.
37+
To create one of these agents, simply construct a `ChatClientAgent` using the `IChatClient` implementation of your choice.
3838

3939
```csharp
4040
using Microsoft.Agents.AI;
@@ -48,17 +48,18 @@ See the documentation for each service, for more information:
4848
|Underlying Inference Service|Description|Service Chat History storage supported|Custom Chat History storage supported|
4949
|---|---|---|---|
5050
|[Azure AI Foundry Agent](./azure-ai-foundry-agent.md)|An agent that uses the Azure AI Foundry Agents Service as its backend.|Yes|No|
51-
|[Azure AI Foundry Models](./azure-ai-foundry-models.md)|An agent that uses any of the models deployed in the Azure AI Foundry Service as its backend.|No|Yes|
51+
|[Azure AI Foundry Models ChatCompletion](./azure-ai-foundry-models-chat-completion-agent.md)|An agent that uses any of the models deployed in the Azure AI Foundry Service as its backend via ChatCompletion.|No|Yes|
52+
|[Azure AI Foundry Models Responses](./azure-ai-foundry-models-responses-agent.md)|An agent that uses any of the models deployed in the Azure AI Foundry Service as its backend via Responses.|No|Yes|
5253
|[Azure OpenAI ChatCompletion](./azure-openai-chat-completion-agent.md)|An agent that uses the Azure OpenAI ChatCompletion service.|No|Yes|
5354
|[Azure OpenAI Responses](./azure-openai-responses-agent.md)|An agent that uses the Azure OpenAI Responses service.|Yes|Yes|
5455
|[OpenAI ChatCompletion](./openai-chat-completion-agent.md)|An agent that uses the OpenAI ChatCompletion service.|No|Yes|
5556
|[OpenAI Responses](./openai-responses-agent.md)|An agent that uses the OpenAI Responses service.|Yes|Yes|
5657
|[OpenAI Assistants](./openai-assistants-agent.md)|An agent that uses the OpenAI Assistants service.|Yes|No|
57-
|[Any other ChatClient](./chat-client-agent.md)|You can also use any other [`Microsoft.Extensions.AI.IChatClient`](/dotnet/ai/microsoft-extensions-ai#the-ichatclient-interface) implementation to create an agent.|Varies|Varies|
58+
|[Any other `IChatClient`](./chat-client-agent.md)|You can also use any other [`Microsoft.Extensions.AI.IChatClient`](/dotnet/ai/microsoft-extensions-ai#the-ichatclient-interface) implementation to create an agent.|Varies|Varies|
5859

5960
## Complex custom agents
6061

61-
It is also possible to create fully custom agents, that are not just wrappers around a ChatClient.
62+
It is also possible to create fully custom agents, that are not just wrappers around an `IChatClient`.
6263
The agent framework provides the `AIAgent` base type.
6364
This base type is the core abstraction for all agents, which when subclassed allows for complete control over the agent's behavior and capabilities.
6465

agent-framework/user-guide/agents/agent-types/openai-assistants-agent.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ OpenAIClient client = new OpenAIClient("<your_api_key>");
3939
```
4040

4141
OpenAI supports multiple services that all provide model calling capabilities.
42-
We need to pick the Assistants service to create an Assistants based agent.
42+
We will use the Assistants client to create an Assistants based agent.
4343

4444
```csharp
45+
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates.
4546
var assistantClient = client.GetAssistantClient();
47+
#pragma warning restore OPENAI001
4648
```
4749

4850
To use the OpenAI Assistants service, you need create an assistant resource in the service.
@@ -60,6 +62,9 @@ var createResult = await assistantClient.CreateAssistantAsync(
6062

6163
// Retrieve the assistant as an AIAgent
6264
AIAgent agent1 = await assistantClient.GetAIAgentAsync(createResult.Value.Id);
65+
66+
// Invoke the agent and output the text result.
67+
Console.WriteLine(await agent1.RunAsync("Tell me a joke about a pirate."));
6368
```
6469

6570
### Using the Agent Framework helpers

agent-framework/user-guide/agents/agent-types/openai-chat-completion-agent.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Finally, create the agent using the `CreateAIAgent` extension method on the `Cha
4848
AIAgent agent = chatCompletionClient.CreateAIAgent(
4949
instructions: "You are good at telling jokes.",
5050
name: "Joker");
51+
52+
// Invoke the agent and output the text result.
53+
Console.WriteLine(await agent.RunAsync("Tell me a joke about a pirate."));
5154
```
5255

5356
## Using the Agent

0 commit comments

Comments
 (0)