Skip to content

Commit b7884ad

Browse files
authored
.NET: Add GA computer tool support to Foundry and Foundry hosting (#8756)
* feat(dotnet): add GA computer tool factory - Parameterless FoundryAITool.CreateComputerTool() emits the GA {"type":"computer"} tool; the (env, w, h) overload stays preview - OpenAI .NET 2.13/2.14 has no GA factory, so the tool is read from its wire JSON via ModelReaderWriter as a stopgap - Both overloads use OPENAICUA001 through a shared DiagnosticIds const * feat(dotnet): map computer items in Foundry hosting Hosting dropped computer_call and computer_call_output from input and history, and never emitted the model's computer_call to the caller. - Convert items between AgentServer and OpenAI models through JSON, stripping AgentServer envelope fields and using builder item ids - Rebuild AgentServer calls without pending_safety_checks, which otherwise throw NullReferenceException on serialization (beta.8) Known blocker, not worked around: OpenAI .NET replays a GA call with "action": null and "pending_safety_checks": [], both rejected by the Responses API, so hosted turns after a computer call fail. * docs(dotnet): add GA computer use sample Foundry project endpoint rejects {"type":"computer"} today, so the sample targets public OpenAI with the Foundry setup commented out. * chore(dotnet): drop stale OPENAICUA001 pragmas OpenAI .NET 2.13.0 gates its computer use types with OPENAI001 (openai/openai-dotnet#1245), so the pragmas in hosting code and its converter tests were no-ops. OPENAICUA001 now only marks MAF's own computer tool factories. * refactor(dotnet): gate computer tool factories with OPENAI001 OpenAI .NET 2.13.0 retired OPENAICUA001 in favor of OPENAI001 (openai/openai-dotnet#1245). Both FoundryAITool.CreateComputerTool overloads now use the shared OPENAI001 id, so callers need no extra suppression; remaining OPENAICUA001 pragmas and NoWarn entries go. * docs(dotnet): rename computer use samples GA computer tool is the default going forward, so it takes the unsuffixed name (Agent_Step27_ComputerUse) and the existing preview sample becomes Agent_Step15_ComputerUsePreview. * docs(dotnet): renumber GA computer use sample to Step15.2 Keeps the GA sample next to its preview counterpart, following the existing Step02.1/Step02.2 numbering. * docs(dotnet): narrow computer call replay caveat to action The service rejects a resent GA computer_call for its "action": null, which is what the known limitation now describes; the known-issue test asserts only that key. * fix(dotnet): resend GA computer calls without action OpenAI .NET models only the preview computer_call and writes "action": null next to "actions" when a GA call is sent back, which the Responses API rejects. Foundry hosting resends history on every turn, so the turn after a computer call failed. Replayed calls now use a ComputerCallResponseItem subclass that writes the call JSON as received; typed properties stay available. * docs(dotnet): move GA computer use sample to Azure providers The Foundry project Responses endpoint does not accept the GA computer tool yet, so the GA sample now targets the Azure OpenAI endpoint with Entra ID as Agent_With_AzureOpenAIResponses_ComputerUse. The Foundry sample keeps the preview tool as Agent_Step15_ComputerUsePreview. * style: Simplify JsonElement qualification * fix(dotnet): run GA computer sample through Foundry * fix(dotnet): isolate computer sample assets
1 parent 4d1674b commit b7884ad

27 files changed

Lines changed: 1454 additions & 19 deletions

File tree

‎dotnet/agent-framework-dotnet.slnx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<Project Path="samples/02-agents/AgentProviders/azure/Agent_With_AzureFoundryModel/Agent_With_AzureFoundryModel.csproj" />
2828
<Project Path="samples/02-agents/AgentProviders/azure/Agent_With_AzureOpenAIChatCompletion/Agent_With_AzureOpenAIChatCompletion.csproj" />
2929
<Project Path="samples/02-agents/AgentProviders/azure/Agent_With_AzureOpenAIResponses/Agent_With_AzureOpenAIResponses.csproj" />
30+
<Project Path="samples/02-agents/AgentProviders/azure/Agent_With_AzureOpenAIResponses_ComputerUse/Agent_With_AzureOpenAIResponses_ComputerUse.csproj" />
3031
<Project Path="samples/02-agents/AgentProviders/custom/Agent_With_CustomImplementation/Agent_With_CustomImplementation.csproj" />
3132
<Project Path="samples/02-agents/AgentProviders/dapr/Agent_With_Dapr/Agent_With_Dapr.csproj" />
3233
<Project Path="samples/02-agents/AgentProviders/github-copilot/Agent_With_GitHubCopilot/Agent_With_GitHubCopilot.csproj" />
@@ -157,7 +158,7 @@
157158
<Project Path="samples/02-agents/AgentProviders/foundry/Agent_Step12_Middleware/Agent_Step12_Middleware.csproj" />
158159
<Project Path="samples/02-agents/AgentProviders/foundry/Agent_Step13_Plugins/Agent_Step13_Plugins.csproj" />
159160
<Project Path="samples/02-agents/AgentProviders/foundry/Agent_Step14_CodeInterpreter/Agent_Step14_CodeInterpreter.csproj" />
160-
<Project Path="samples/02-agents/AgentProviders/foundry/Agent_Step15_ComputerUse/Agent_Step15_ComputerUse.csproj" />
161+
<Project Path="samples/02-agents/AgentProviders/foundry/Agent_Step15_ComputerUsePreview/Agent_Step15_ComputerUsePreview.csproj" />
161162
<Project Path="samples/02-agents/AgentProviders/foundry/Agent_Step16_FileSearch/Agent_Step16_FileSearch.csproj" />
162163
<Project Path="samples/02-agents/AgentProviders/foundry/Agent_Step17_OpenAPITools/Agent_Step17_OpenAPITools.csproj" />
163164
<Project Path="samples/02-agents/AgentProviders/foundry/Agent_Step18_BingCustomSearch/Agent_Step18_BingCustomSearch.csproj" />

‎dotnet/eng/verify-samples/AgentsSamples.cs‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ internal static class AgentsSamples
5050
],
5151
},
5252

53+
new SampleDefinition
54+
{
55+
Name = "Agent_With_AzureOpenAIResponses_ComputerUse",
56+
ProjectPath = "samples/02-agents/AgentProviders/azure/Agent_With_AzureOpenAIResponses_ComputerUse",
57+
RequiredEnvironmentVariables = ["AZURE_OPENAI_ENDPOINT"],
58+
OptionalEnvironmentVariables = ["AZURE_OPENAI_DEPLOYMENT_NAME"],
59+
ExpectedOutputDescription =
60+
[
61+
"The output should show a computer automation session running batched actions (such as click, type or keypress) against simulated browser screenshots, followed by a final response describing search results.",
62+
"The output should not contain error messages or stack traces.",
63+
],
64+
},
65+
5366
new SampleDefinition
5467
{
5568
Name = "Agent_With_AzureAIProject",
@@ -1188,8 +1201,8 @@ internal static class AgentsSamples
11881201

11891202
new SampleDefinition
11901203
{
1191-
Name = "FoundryAgent_Step15_ComputerUse",
1192-
ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step15_ComputerUse",
1204+
Name = "FoundryAgent_Step15_ComputerUsePreview",
1205+
ProjectPath = "samples/02-agents/AgentProviders/foundry/Agent_Step15_ComputerUsePreview",
11931206
RequiredEnvironmentVariables = ["FOUNDRY_PROJECT_ENDPOINT", "AZURE_AI_COMPUTER_USE_DEPLOYMENT_NAME"],
11941207
OptionalEnvironmentVariables = [],
11951208
ExpectedOutputDescription = ["The output should show a computer automation session processing simulated browser screenshots with iteration steps and a final response describing search results."],

‎dotnet/samples/02-agents/AgentProviders/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ See the README.md for each sample for the prerequisites for that sample.
3737
| [Azure Foundry Model](./azure/Agent_With_AzureFoundryModel/) | Use any model deployed to Microsoft Foundry |
3838
| [Azure OpenAI ChatCompletion](./azure/Agent_With_AzureOpenAIChatCompletion/) | Create an AIAgent using Azure OpenAI ChatCompletion |
3939
| [Azure OpenAI Responses](./azure/Agent_With_AzureOpenAIResponses/) | Create an AIAgent using Azure OpenAI Responses |
40+
| [Microsoft Foundry Responses computer use](./azure/Agent_With_AzureOpenAIResponses_ComputerUse/) | Use the GA computer tool with a Microsoft Foundry project Responses agent |
4041

4142
### [Custom](./custom/)
4243

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFrameworks>net10.0</TargetFrameworks>
6+
7+
<Nullable>enable</Nullable>
8+
<ImplicitUsings>enable</ImplicitUsings>
9+
<NoWarn>$(NoWarn);MEAI001</NoWarn>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Azure.Identity" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<!-- Provides the Foundry project client and FoundryAITool.CreateComputerTool(). -->
18+
<ProjectReference Include="..\..\..\..\..\src\Microsoft.Agents.AI.Foundry\Microsoft.Agents.AI.Foundry.csproj" />
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<None Update="Assets\*.jpg" CopyToOutputDirectory="Always" />
23+
</ItemGroup>
24+
25+
</Project>

dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step15_ComputerUse/Assets/cua_browser_search.jpg renamed to dotnet/samples/02-agents/AgentProviders/azure/Agent_With_AzureOpenAIResponses_ComputerUse/Assets/cua_browser_search.jpg

File renamed without changes.

dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step15_ComputerUse/Assets/cua_search_results.jpg renamed to dotnet/samples/02-agents/AgentProviders/azure/Agent_With_AzureOpenAIResponses_ComputerUse/Assets/cua_search_results.jpg

File renamed without changes.

dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step15_ComputerUse/Assets/cua_search_typed.jpg renamed to dotnet/samples/02-agents/AgentProviders/azure/Agent_With_AzureOpenAIResponses_ComputerUse/Assets/cua_search_typed.jpg

File renamed without changes.
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
3+
using System.ClientModel.Primitives;
4+
using System.Text.Json;
5+
using Microsoft.Extensions.AI;
6+
using OpenAI.Responses;
7+
8+
namespace Demo.ComputerUse;
9+
10+
/// <summary>
11+
/// Enum for tracking the state of the simulated web search flow.
12+
/// </summary>
13+
internal enum SearchState
14+
{
15+
Initial, // Browser search page
16+
Typed, // Text entered in search box
17+
PressedEnter // Search submitted, showing results
18+
}
19+
20+
/// <summary>
21+
/// One action of a computer call batch, reduced to the fields this simulation needs.
22+
/// </summary>
23+
internal sealed record ComputerActionRequest(string Type, string? Text, IReadOnlyList<string> Keys);
24+
25+
internal static class ComputerUseUtil
26+
{
27+
internal static async Task<Dictionary<string, string>> UploadScreenshotAssetsAsync(IHostedFileClient fileClient)
28+
{
29+
string assetsDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Assets");
30+
31+
(string Key, string FileName)[] files =
32+
[
33+
("browser_search", "cua_browser_search.jpg"),
34+
("search_typed", "cua_search_typed.jpg"),
35+
("search_results", "cua_search_results.jpg")
36+
];
37+
38+
Dictionary<string, string> screenshots = [];
39+
40+
foreach ((string key, string fileName) in files)
41+
{
42+
HostedFileContent result = await fileClient.UploadAsync(
43+
Path.Combine(assetsDir, fileName),
44+
new HostedFileClientOptions { Purpose = "assistants" });
45+
screenshots[key] = result.FileId;
46+
}
47+
48+
return screenshots;
49+
}
50+
51+
internal static async Task DeleteScreenshotAssetsAsync(
52+
IHostedFileClient fileClient,
53+
Dictionary<string, string> screenshots)
54+
{
55+
foreach ((string key, string fileId) in screenshots)
56+
{
57+
try
58+
{
59+
await fileClient.DeleteAsync(fileId);
60+
}
61+
catch (Exception exception)
62+
{
63+
// Continue so one failed deletion does not leave every remaining sample asset behind.
64+
Console.Error.WriteLine($"Failed to delete screenshot '{key}' ({fileId}): {exception.Message}");
65+
}
66+
}
67+
}
68+
69+
/// <summary>
70+
/// Reads the ordered actions of a computer call.
71+
/// </summary>
72+
/// <remarks>
73+
/// The OpenAI .NET SDK does not expose the GA <c>actions</c> batch as a typed property yet, so the call is
74+
/// re-serialized and the batch is read from its JSON. A preview call carries a single <c>action</c> instead.
75+
/// </remarks>
76+
internal static IReadOnlyList<ComputerActionRequest> GetActions(ComputerCallResponseItem computerCall)
77+
{
78+
using JsonDocument json = JsonDocument.Parse(ModelReaderWriter.Write(computerCall, ModelReaderWriterOptions.Json));
79+
80+
if (json.RootElement.TryGetProperty("actions", out JsonElement actions) && actions.ValueKind == JsonValueKind.Array)
81+
{
82+
return [.. actions.EnumerateArray().Select(ToActionRequest)];
83+
}
84+
85+
if (json.RootElement.TryGetProperty("action", out JsonElement action) && action.ValueKind == JsonValueKind.Object)
86+
{
87+
return [ToActionRequest(action)];
88+
}
89+
90+
return [];
91+
}
92+
93+
/// <summary>
94+
/// Simulates executing a computer action by advancing the state.
95+
/// </summary>
96+
internal static async Task<SearchState> ApplyAsync(ComputerActionRequest action, SearchState currentState)
97+
{
98+
if (action.Type == "wait")
99+
{
100+
await Task.Delay(TimeSpan.FromSeconds(1));
101+
}
102+
103+
return action.Type switch
104+
{
105+
"click" when currentState == SearchState.Typed => SearchState.PressedEnter,
106+
"type" when action.Text is not null => SearchState.Typed,
107+
"keypress" when IsEnterKey(action) => SearchState.PressedEnter,
108+
_ => currentState
109+
};
110+
}
111+
112+
/// <summary>
113+
/// Returns the key of the screenshot that shows the given state.
114+
/// </summary>
115+
internal static string GetScreenshotKey(SearchState state) => state switch
116+
{
117+
SearchState.PressedEnter => "search_results",
118+
SearchState.Typed => "search_typed",
119+
_ => "browser_search"
120+
};
121+
122+
private static ComputerActionRequest ToActionRequest(JsonElement action)
123+
{
124+
string type = action.TryGetProperty("type", out JsonElement typeElement) ? typeElement.GetString() ?? string.Empty : string.Empty;
125+
string? text = action.TryGetProperty("text", out JsonElement textElement) ? textElement.GetString() : null;
126+
IReadOnlyList<string> keys = action.TryGetProperty("keys", out JsonElement keysElement) && keysElement.ValueKind == JsonValueKind.Array
127+
? [.. keysElement.EnumerateArray().Select(k => k.GetString() ?? string.Empty)]
128+
: [];
129+
130+
return new ComputerActionRequest(type, text, keys);
131+
}
132+
133+
private static bool IsEnterKey(ComputerActionRequest action) =>
134+
action.Keys.Contains("Return", StringComparer.OrdinalIgnoreCase) ||
135+
action.Keys.Contains("Enter", StringComparer.OrdinalIgnoreCase);
136+
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
3+
// This sample shows how to use the generally available (GA) computer tool, created with the parameterless
4+
// FoundryAITool.CreateComputerTool(), with an AIAgent backed by the Microsoft Foundry project Responses endpoint.
5+
// Each computer call returned by the model carries an ordered batch of actions; the application runs all of them and
6+
// then sends back a single screenshot.
7+
8+
using Azure.AI.Projects;
9+
using Azure.Identity;
10+
using Demo.ComputerUse;
11+
using Microsoft.Agents.AI;
12+
using Microsoft.Agents.AI.Foundry;
13+
using Microsoft.Extensions.AI;
14+
using OpenAI.Responses;
15+
16+
string endpoint = Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT")
17+
?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set.");
18+
string deploymentName = Environment.GetEnvironmentVariable("FOUNDRY_MODEL") ?? "gpt-5.4";
19+
20+
// WARNING: DefaultAzureCredential is convenient for development but requires careful consideration in production.
21+
// In production, consider using a specific credential (e.g., ManagedIdentityCredential) to avoid
22+
// latency issues, unintended credential probing, and potential security risks from fallback mechanisms.
23+
AIProjectClient projectClient = new(new Uri(endpoint), new DefaultAzureCredential());
24+
using IHostedFileClient fileClient = projectClient.GetProjectOpenAIClient().AsIHostedFileClient();
25+
26+
AIAgent agent = projectClient
27+
.GetProjectOpenAIClient()
28+
.GetResponsesClient()
29+
.AsIChatClient(deploymentName)
30+
.AsAIAgent(
31+
name: "ComputerAgent",
32+
instructions: "You are a computer automation assistant.",
33+
tools: [FoundryAITool.CreateComputerTool()]);
34+
35+
Dictionary<string, string> screenshots = [];
36+
37+
try
38+
{
39+
// Foundry rejects large inline data URIs in computer_call_output, so upload the simulated screenshots once and
40+
// reference their file IDs throughout the loop.
41+
screenshots = await ComputerUseUtil.UploadScreenshotAssetsAsync(fileClient);
42+
43+
// Send the initial request with a screenshot of the browser.
44+
ChatMessage message = new(ChatRole.User, [
45+
new TextContent("Search for 'OpenAI news'. Type it and submit. Once you see results, the task is complete."),
46+
new AIContent
47+
{
48+
RawRepresentation = ResponseContentPart.CreateInputImagePart(
49+
imageFileId: screenshots["browser_search"],
50+
imageDetailLevel: ResponseImageDetailLevel.High)
51+
}
52+
]);
53+
54+
Console.WriteLine("Starting computer use session...");
55+
56+
AgentSession session = await agent.CreateSessionAsync();
57+
AgentResponse response = await agent.RunAsync(message, session: session);
58+
59+
SearchState currentState = SearchState.Initial;
60+
61+
for (int i = 0; i < 10; i++)
62+
{
63+
// Find the next computer call.
64+
ComputerCallResponseItem? computerCall = response.Messages
65+
.SelectMany(m => m.Contents)
66+
.Select(c => c.RawRepresentation as ComputerCallResponseItem)
67+
.FirstOrDefault(item => item is not null);
68+
69+
if (computerCall is null)
70+
{
71+
if (currentState == SearchState.PressedEnter)
72+
{
73+
Console.WriteLine("No more computer actions. Done.");
74+
Console.WriteLine(response);
75+
break;
76+
}
77+
78+
// The model may ask for confirmation before acting. Answer and continue.
79+
if (response.Text.Contains('?'))
80+
{
81+
Console.WriteLine($"Model asked: {response.Text}");
82+
response = await agent.RunAsync("Please proceed.", session);
83+
continue;
84+
}
85+
86+
Console.WriteLine(response);
87+
break;
88+
}
89+
90+
// Run every action of the batch in order, then capture a single screenshot.
91+
foreach (ComputerActionRequest action in ComputerUseUtil.GetActions(computerCall))
92+
{
93+
Console.WriteLine($"[{i + 1}] Action: {action.Type}");
94+
currentState = await ComputerUseUtil.ApplyAsync(action, currentState);
95+
}
96+
97+
ComputerCallOutputResponseItem callOutput = new(
98+
computerCall.CallId,
99+
ComputerCallOutput.CreateScreenshotOutput(
100+
screenshotImageFileId: screenshots[ComputerUseUtil.GetScreenshotKey(currentState)]));
101+
102+
// The model can flag an action as risky with pending safety checks. A real application must show them to the
103+
// user and acknowledge them only after the user confirms; this simulation acknowledges them automatically.
104+
foreach (ComputerCallSafetyCheck safetyCheck in computerCall.PendingSafetyChecks)
105+
{
106+
Console.WriteLine($"Acknowledging safety check: {safetyCheck.Code}");
107+
callOutput.AcknowledgedSafetyChecks.Add(safetyCheck);
108+
}
109+
110+
// Send the screenshot back as the computer call output.
111+
response = await agent.RunAsync([new ChatMessage(ChatRole.User, [new AIContent { RawRepresentation = callOutput }])], session);
112+
}
113+
}
114+
finally
115+
{
116+
await ComputerUseUtil.DeleteScreenshotAssetsAsync(fileClient, screenshots);
117+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Computer use with Microsoft Foundry Responses
2+
3+
This sample shows how to use the generally available (GA) computer tool with an `AIAgent` backed by a Microsoft Foundry project Responses endpoint.
4+
5+
## What this sample demonstrates
6+
7+
- Using the parameterless `FoundryAITool.CreateComputerTool()` to add the GA `computer` tool (`{"type":"computer"}`)
8+
- Running every action of a batched `computer_call` (the GA call returns an ordered `actions` list) before sending back one screenshot
9+
- Uploading screenshots to Foundry Files and returning file IDs from the computer loop
10+
11+
For the preview `computer_use_preview` tool with a Microsoft Foundry project, which takes an environment and display size and returns a single `action` per call, see [Agent_Step15_ComputerUsePreview](../../foundry/Agent_Step15_ComputerUsePreview/).
12+
13+
| | GA tool (this sample) | Preview tool (Agent_Step15_ComputerUsePreview) |
14+
| --- | --- | --- |
15+
| Factory | `FoundryAITool.CreateComputerTool()` | `FoundryAITool.CreateComputerTool(environment, width, height)` |
16+
| Wire tool | `{"type":"computer"}` | `{"type":"computer_use_preview", ...}` |
17+
| Actions per call | ordered `actions` batch | single `action` |
18+
19+
For more information, see the OpenAI [computer use guide](https://developers.openai.com/api/docs/guides/tools-computer-use).
20+
21+
## Known limitation
22+
23+
The sample continues each turn from the stored response, so only the new `computer_call_output` is sent. Sending a GA `computer_call` back to the model instead (for example with stored responses disabled and the history kept locally) currently fails. The OpenAI .NET SDK models only the preview item and adds `"action": null`, which the Responses API rejects for the GA tool.
24+
25+
## How the simulation works
26+
27+
**This sample does not connect to a real browser.** It intercepts the model's actions and returns pre-captured screenshots as if the actions were performed:
28+
29+
| State | Reached by | Screenshot sent back |
30+
| --- | --- | --- |
31+
| Initial | Session start | `cua_browser_search.jpg`, an empty search page |
32+
| Typed | A `type` action | `cua_search_typed.jpg`, search text in the box |
33+
| Search submitted | A `keypress` of Enter, or a `click` after typing | `cua_search_results.jpg`, the results page |
34+
35+
Each loop iteration runs all actions of the call in order, then sends the screenshot for the resulting state. The loop ends when the model stops returning computer calls after the search was submitted, or after 10 iterations.
36+
37+
## Prerequisites
38+
39+
- .NET 10 SDK or later
40+
- A Microsoft Foundry project with a deployment of a model that supports the GA computer tool (for example `gpt-5.4`)
41+
- Foundry Files configured for the project, including storage access for the project's managed identity
42+
- An authenticated Azure identity with access to the project (for example, sign in with `az login`)
43+
44+
Set the following environment variables:
45+
46+
```powershell
47+
$env:FOUNDRY_PROJECT_ENDPOINT="https://your-foundry-service.services.ai.azure.com/api/projects/your-foundry-project"
48+
$env:FOUNDRY_MODEL="gpt-5.4" # Optional, defaults to gpt-5.4
49+
```
50+
51+
## Run the sample
52+
53+
```powershell
54+
dotnet run
55+
```

0 commit comments

Comments
 (0)