Skip to content

.NET: Add Microsoft.Agents.AI.Hyperlight package for CodeAct integration (.NET)#5329

Draft
eavanvalkenburg wants to merge 1 commit intomicrosoft:mainfrom
eavanvalkenburg:codeact_dotnet
Draft

.NET: Add Microsoft.Agents.AI.Hyperlight package for CodeAct integration (.NET)#5329
eavanvalkenburg wants to merge 1 commit intomicrosoft:mainfrom
eavanvalkenburg:codeact_dotnet

Conversation

@eavanvalkenburg
Copy link
Copy Markdown
Member

@eavanvalkenburg eavanvalkenburg commented Apr 17, 2026

Adds a new Microsoft.Agents.AI.Hyperlight package that brings first-class CodeAct support to the .NET Agent Framework, backed by the Hyperlight sandbox via the new .NET SDK from hyperlight-dev/hyperlight-sandbox PR 46.

Follows docs/features/code_act/dotnet-implementation.md and the Python agent_framework_hyperlight reference.

What's included

  • HyperlightCodeActProvider (AIContextProvider):
    • Injects an execute_code tool + CodeAct guidance into every invocation.
    • Single-instance-per-agent enforced via a fixed StateKeys value (ChatClientAgent rejects duplicate state keys).
    • CRUD for provider-owned tools, file mounts, and outbound-domain allow-list — all exposed inside the sandbox via call_tool(...).
    • Run-scoped snapshot captured under a lock so mutations between runs don't affect in-flight executions.
  • HyperlightExecuteCodeFunction: standalone AIFunction for manual/static wiring.
  • Async tool registration end-to-end (Sandbox.RegisterToolAsync).
  • Approval model via CodeActApprovalMode (AlwaysRequire / NeverRequire with propagation from ApprovalRequiredAIFunction-wrapped tools).
  • Both entry points accept options = null and fall back to defaults (mirroring the Python reference).

Tests & samples

  • Unit tests: instruction builder, tool bridge (JSON round-trip + error wrapping + approval unwrap), approval computation matrix, provider CRUD, snapshot isolation, approval wrapping in ProvideAIContextAsync.
  • Integration test: env-gated on HYPERLIGHT_PYTHON_GUEST_PATH, runs print("hi") end-to-end.
  • Three samples under dotnet/samples/02-agents/AgentWithCodeAct/: Interpreter, ToolEnabled (with an ApprovalRequiredAIFunction-wrapped tool), ManualWiring.

Draft — not yet buildable

  • Requires .NET SDK 10.0.200 (per repo global.json).
  • Requires HyperlightSandbox.Api 0.1.0-preview, which is not yet published (hyperlight-dev/hyperlight-sandbox PR 46). The src project is IsPackable=false until the dependency is available.
  • Nothing in this PR has been compiled or run locally yet. Needs to be validated end-to-end once the Hyperlight .NET SDK lands on nuget.org (or a local feed is set up).

Open items to resolve before un-drafting

  • Verify compile on net8.0 / net9.0 / net10.0 against the real SDK.
  • Confirm Sandbox.RegisterToolAsync return-type handling in ToolBridge.RegisterOne.
  • Decide on richer per-mount filesystem API once the Hyperlight SDK exposes one (today, FileMount entries are surfaced only in the execute_code description).
  • Add CHANGELOG entry if required by area owners.

Tracks: CodeAct .NET implementation (see docs/features/code_act/dotnet-implementation.md).

Introduces a new Microsoft.Agents.AI.Hyperlight package that enables CodeAct-style sandboxed code execution via Hyperlight (hyperlight-sandbox .NET SDK, PR microsoft#46) for .NET agents, following the docs/features/code_act/dotnet-implementation.md design and the Python agent_framework_hyperlight reference.

Highlights:
- HyperlightCodeActProvider (AIContextProvider): injects an execute_code tool and CodeAct guidance per invocation; single-instance-per-agent via a fixed StateKeys value; supports multiple provider-owned tools (exposed inside the sandbox via call_tool), file mounts, and an outbound domain allow-list; snapshot/restore per run.
- HyperlightExecuteCodeFunction: standalone AIFunction for manual/static wiring when the sandbox configuration is fixed.
- Approval model via CodeActApprovalMode (AlwaysRequire / NeverRequire) with propagation from ApprovalRequiredAIFunction-wrapped tools.
- Unit tests (instruction builder, tool bridge, approval computation, provider CRUD, ProvideAIContextAsync snapshot isolation and approval wrapping).
- Env-gated integration test (HYPERLIGHT_PYTHON_GUEST_PATH).
- Three samples under samples/02-agents/AgentWithCodeAct (interpreter, tool-enabled, manual wiring).

Build is not yet runnable: requires .NET SDK 10.0.200 and the not-yet-published HyperlightSandbox.Api 0.1.0-preview NuGet package. Package is marked IsPackable=false until the dependency is available.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@moonbox3 moonbox3 added documentation Improvements or additions to documentation .NET labels Apr 17, 2026
@github-actions github-actions bot changed the title Add Microsoft.Agents.AI.Hyperlight package for CodeAct integration (.NET) .NET: Add Microsoft.Agents.AI.Hyperlight package for CodeAct integration (.NET) Apr 17, 2026
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.AI.Abstractions" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already included as a transient dependency from Microsoft.Agents.AI.Abstractions, so we should be able to remove this it.

Suggested change
<PackageReference Include="Microsoft.Extensions.AI.Abstractions" />

/// Optional list of HTTP methods to allow (for example <c>["GET", "POST"]</c>).
/// When <see langword="null"/>, all methods supported by the backend are allowed.
/// </param>
public sealed record AllowedDomain(string Target, IReadOnlyList<string>? Methods = null);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally avoid record types because of their cost, unless we are using their functionality. They come with a lot of functionality by default, which is usually not used.
Since this is essentially just config, a class is probably fine.

/// <summary>
/// Gets or sets the initial outbound network allow-list entries.
/// </summary>
public IEnumerable<AllowedDomain>? AllowedDomains { get; set; }
Copy link
Copy Markdown
Contributor

@westey-m westey-m Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this also work as a Dictionary<string, IReadOnlyList<string>>?
It'll avoid someone providing the same domain twice, but at the same it might be tricker to understand, i.e. you have to read the comments to know what IReadOnlyList<string> should contain.

/// Gets or sets an optional workspace root directory on the host.
/// When set, it is exposed as the sandbox's <c>/input</c> directory.
/// </summary>
public string? WorkspaceRoot { get; set; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this term something that Hyperlight uses? If it's a folder on the host that maps to an input folder in the sandbox, WorkspaceRoot isn't the first name that springs to mind 😄

/// Required for the <see cref="SandboxBackend.Wasm"/> backend; not needed for
/// <see cref="SandboxBackend.JavaScript"/>.
/// </summary>
public string? ModulePath { get; set; }
Copy link
Copy Markdown
Contributor

@westey-m westey-m Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is optional only for javascript, but required for wasm.
Since we default to wasm though, it means that providing no options will always fail.
We should consider switching to javascript as the default.

Another option is to add some factory methods on the provider like:
HyperlightCodeActProviderOptions.CreateForWasm(string modulePath, HyperlightCodeActProviderOptions? options = null);
HyperlightCodeActProviderOptions.CreateForJavaScript(HyperlightCodeActProviderOptions? options = null);

And then we don't have backend or module path on the options.

Comment on lines +160 to +168
foreach (var name in names)
{
if (name is null)
{
continue;
}

_ = this._tools.Remove(name);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be shortened a little bit into the following, here and in other cases here.

Suggested change
foreach (var name in names)
{
if (name is null)
{
continue;
}
_ = this._tools.Remove(name);
}
foreach (var name in names.Where(x => x is not null))
{
_ = this._tools.Remove(name);
}

{
lock (this._gate)
{
return this._tools.Values.ToArray();
Copy link
Copy Markdown
Contributor

@westey-m westey-m Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are returning a List, we might as well convert to a list instead of an array, which will then be converted to a list again.

Suggested change
return this._tools.Values.ToArray();
return this._tools.Values.ToList();

public override IReadOnlyList<string> StateKeys => s_stateKeys;

// -------------------------------------------------------------------
// Tool registry
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the public modification methods for tools, mounts, etc?
In other places, we generally only add this type of thing if there is a good user case.
And in that case, we probably could expose the properties publicly to allow the user to directly modify. The only checks we do is for null values, and that we can do at consumption time as well.

{
this.ThrowIfDisposed();
snapshot = new SandboxExecutor.RunSnapshot(
this._tools.Values.ToArray(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these explicitly requiring array as input? Just double checking that we aren't unnecessarily converting to array.

Comment on lines +346 to +362
internal static bool ComputeApprovalRequired(CodeActApprovalMode mode, IReadOnlyList<AIFunction> tools)
{
if (mode == CodeActApprovalMode.AlwaysRequire)
{
return true;
}

foreach (var tool in tools)
{
if (tool is ApprovalRequiredAIFunction)
{
return true;
}
}

return false;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally don't comment on style, but since you are new to this, suggesting some shortcuts:

Suggested change
internal static bool ComputeApprovalRequired(CodeActApprovalMode mode, IReadOnlyList<AIFunction> tools)
{
if (mode == CodeActApprovalMode.AlwaysRequire)
{
return true;
}
foreach (var tool in tools)
{
if (tool is ApprovalRequiredAIFunction)
{
return true;
}
}
return false;
}
internal static bool ComputeApprovalRequired(CodeActApprovalMode mode, IReadOnlyList<AIFunction> tools)
=> mode == CodeActApprovalMode.AlwaysRequire ?
true :
tools.Any(x => x is ApprovalRequiredAIFunction);

Comment on lines +80 to +95
private static string SerializeResult(object? result)
{
switch (result)
{
case null:
return "null";
case string s:
return JsonSerializer.Serialize(s);
case JsonElement element:
return element.GetRawText();
case JsonNode node:
return node.ToJsonString();
default:
return JsonSerializer.Serialize(result);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static string SerializeResult(object? result)
{
switch (result)
{
case null:
return "null";
case string s:
return JsonSerializer.Serialize(s);
case JsonElement element:
return element.GetRawText();
case JsonNode node:
return node.ToJsonString();
default:
return JsonSerializer.Serialize(result);
}
}
private static string SerializeResult(object? result)
=> result switch
{
null => "null",
string s => JsonSerializer.Serialize(s),
JsonElement element => element.GetRawText(),
JsonNode node => node.ToJsonString(),
_ => JsonSerializer.Serialize(result)
};

{
tool = wrapper.InnerFunction;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this unwrapping is required. ApprovalRequiredAIFunction is invocable just like a regular AIFunction. It doesn't stop execution, and is essentially just metadata. It's up to whatever uses it to ask for approval if it wants to respect the metadata.

return new Dictionary<string, object?>(StringComparer.Ordinal);
}

var node = JsonNode.Parse(argsJson);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also consider deserializating into a dictionary directly, e.g.

JsonSerializer.Deserialize<Dictionary<string, object?>>(argsJson);

return new Dictionary<string, object?>(StringComparer.Ordinal);
}

var node = JsonNode.Parse(argsJson);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to support NativeAOT with this feature?

case null:
return "null";
case string s:
return JsonSerializer.Serialize(s);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to serialize a string? I suppose it'll just put it in quotes, but not sure if that is required.

Comment on lines +88 to +93
case JsonElement element:
return element.GetRawText();
case JsonNode node:
return node.ToJsonString();
default:
return JsonSerializer.Serialize(result);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think JsonSerializer.Serialize(result); should work for JsonElement and JsonNode as well, so you may not required the switch at all.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new .NET package (Microsoft.Agents.AI.Hyperlight) that integrates Hyperlight-backed CodeAct into the Agent Framework, including an AIContextProvider that injects an execute_code tool plus companion tests and samples.

Changes:

  • Introduces Microsoft.Agents.AI.Hyperlight (provider, options, execute_code function wrapper, internal sandbox executor/tool bridge, and supporting models).
  • Adds unit + integration tests validating instruction/description building, tool bridging, approval behavior, and an env-gated end-to-end sandbox run.
  • Adds three new CodeAct samples and wires them into the .NET solution + samples index.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
dotnet/tests/Microsoft.Agents.AI.Hyperlight.UnitTests/ToolBridgeTests.cs Unit coverage for ToolBridge argument passing, error wrapping, and approval unwrap behavior.
dotnet/tests/Microsoft.Agents.AI.Hyperlight.UnitTests/ProvideAIContextTests.cs Validates provider context injection, approval wrapping behavior, and snapshot isolation in tool description.
dotnet/tests/Microsoft.Agents.AI.Hyperlight.UnitTests/Microsoft.Agents.AI.Hyperlight.UnitTests.csproj Adds new unit test project referencing Hyperlight + core AI projects.
dotnet/tests/Microsoft.Agents.AI.Hyperlight.UnitTests/InstructionBuilderTests.cs Tests CodeAct instruction/description text generation for tools, mounts, and network config.
dotnet/tests/Microsoft.Agents.AI.Hyperlight.UnitTests/HyperlightCodeActProviderTests.cs CRUD + lifecycle tests for provider-owned registries and fixed StateKeys behavior.
dotnet/tests/Microsoft.Agents.AI.Hyperlight.UnitTests/ApprovalComputationTests.cs Tests approval-required computation matrix.
dotnet/tests/Microsoft.Agents.AI.Hyperlight.IntegrationTests/Microsoft.Agents.AI.Hyperlight.IntegrationTests.csproj Adds new integration test project referencing Hyperlight.
dotnet/tests/Microsoft.Agents.AI.Hyperlight.IntegrationTests/CodeActEndToEndTests.cs Env-gated end-to-end execute_code run against a real sandbox guest module.
dotnet/src/Microsoft.Agents.AI.Hyperlight/README.md Package-level documentation and requirements/status notes.
dotnet/src/Microsoft.Agents.AI.Hyperlight/Microsoft.Agents.AI.Hyperlight.csproj New multi-targeted Hyperlight integration project and dependencies.
dotnet/src/Microsoft.Agents.AI.Hyperlight/Internal/ToolBridge.cs Bridges host AIFunctions to sandbox tool callbacks (JSON in/out) and unwraps approval wrappers.
dotnet/src/Microsoft.Agents.AI.Hyperlight/Internal/SandboxExecutor.cs Central executor managing sandbox lifecycle and snapshot/restore per invocation.
dotnet/src/Microsoft.Agents.AI.Hyperlight/Internal/InstructionBuilder.cs Generates model-facing guidance + execute_code description sections.
dotnet/src/Microsoft.Agents.AI.Hyperlight/Internal/ExecuteCodeFunction.cs Implements the run-scoped execute_code AIFunction bound to a snapshot + executor.
dotnet/src/Microsoft.Agents.AI.Hyperlight/HyperlightExecuteCodeFunction.cs Public manual-wiring wrapper for registering execute_code directly.
dotnet/src/Microsoft.Agents.AI.Hyperlight/HyperlightCodeActProviderOptions.cs Public options surface for backend/module path/tools/mounts/allow-list/approval mode.
dotnet/src/Microsoft.Agents.AI.Hyperlight/HyperlightCodeActProvider.cs AIContextProvider that injects execute_code and maintains provider-owned registries with snapshotting.
dotnet/src/Microsoft.Agents.AI.Hyperlight/FileMount.cs Public model for describing host-to-sandbox mounts.
dotnet/src/Microsoft.Agents.AI.Hyperlight/CodeActApprovalMode.cs Public enum controlling approval semantics for execute_code.
dotnet/src/Microsoft.Agents.AI.Hyperlight/AllowedDomain.cs Public model for outbound network allow-list entries.
dotnet/samples/02-agents/README.md Adds the new “AgentWithCodeAct (Hyperlight)” entry to the samples index.
dotnet/samples/02-agents/AgentWithCodeAct/README.md New sample group README describing the three CodeAct sample steps.
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step03_ManualWiring/README.md Docs for manual wiring sample configuration and run instructions.
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step03_ManualWiring/Program.cs Manual wiring example using HyperlightExecuteCodeFunction.
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step03_ManualWiring/AgentWithCodeAct_Step03_ManualWiring.csproj Manual wiring sample project wiring + dependencies.
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step02_ToolEnabled/README.md Docs for provider-owned tool orchestration + approval-required tool example.
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step02_ToolEnabled/Program.cs Tool-enabled sample using HyperlightCodeActProvider with provider-owned tools.
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step02_ToolEnabled/AgentWithCodeAct_Step02_ToolEnabled.csproj Tool-enabled sample project wiring + dependencies.
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step01_Interpreter/README.md Docs for interpreter-only CodeAct sample.
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step01_Interpreter/Program.cs Interpreter mode sample using HyperlightCodeActProvider.
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step01_Interpreter/AgentWithCodeAct_Step01_Interpreter.csproj Interpreter sample project wiring + dependencies.
dotnet/agent-framework-dotnet.slnx Adds the new Hyperlight project, tests, and sample projects into the solution structure.
dotnet/Directory.Packages.props Introduces central package version entry for HyperlightSandbox.Api.

Comment on lines +4 to +5
using System.Collections.Generic;
using System.ComponentModel;
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System.Collections.Generic and System.ComponentModel appear unused in this file. The repo elevates IDE0005 (unnecessary usings) to warning, and warnings are treated as errors, so this will break the build. Remove the unused using directives (or use the types if they’re intended).

Suggested change
using System.Collections.Generic;
using System.ComponentModel;

Copilot uses AI. Check for mistakes.
// Copyright (c) Microsoft. All rights reserved.

using System;
using System.Collections.Generic;
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System.Collections.Generic looks unused here. Since IDE0005 is configured as a warning and warnings are treated as errors, this will fail the build. Remove the unused using directive (or use the type if intended).

Suggested change
using System.Collections.Generic;

Copilot uses AI. Check for mistakes.
{
if (this._sandbox is not null)
{
return;
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ExecuteAsync accepts a per-run snapshot, but once _sandbox is initialized EnsureInitialized(snapshot) becomes a no-op. That means later registry/allow-list CRUD changes (captured in subsequent snapshots) won’t be applied to the actual sandbox configuration—only the tool description changes—leading to confusing/incorrect runtime behavior. Consider either rebuilding the sandbox when the snapshot’s relevant configuration changes, or re-applying snapshot state (tool registration / allow-domains / IO config) each run before Run().

Suggested change
return;
this._sandbox.Dispose();
this._sandbox = null;
this._warmSnapshot = null;

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +33
"You can execute Python code in a secure sandbox by calling the `execute_code` tool. "
+ "Use it for calculations, data analysis, and anything that benefits from running code. "
+ "State does not persist between calls; pass any required values in the code you execute.";
}

return
"You can execute Python code in a secure sandbox by calling the `execute_code` tool. "
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BuildContextInstructions hard-codes “Python code”, but the provider supports multiple backends (SandboxBackend.Wasm vs SandboxBackend.JavaScript). If a non-Python backend is configured, the guidance will be wrong for the model. Consider making the instructions backend-aware (e.g., “execute code” generically, or pass the backend/language into BuildContextInstructions).

Suggested change
"You can execute Python code in a secure sandbox by calling the `execute_code` tool. "
+ "Use it for calculations, data analysis, and anything that benefits from running code. "
+ "State does not persist between calls; pass any required values in the code you execute.";
}
return
"You can execute Python code in a secure sandbox by calling the `execute_code` tool. "
"You can execute code in a secure sandbox by calling the `execute_code` tool. "
+ "Use it for calculations, data analysis, and anything that benefits from running code. "
+ "State does not persist between calls; pass any required values in the code you execute.";
}
return
"You can execute code in a secure sandbox by calling the `execute_code` tool. "

Copilot uses AI. Check for mistakes.
Comment on lines +79 to +96
if (!string.IsNullOrEmpty(workspaceRoot))
{
sb.AppendLine(
string.Format(
CultureInfo.InvariantCulture,
"- Workspace directory mounted read-only at `/input` (host: `{0}`).",
workspaceRoot));
}

foreach (var mount in fileMounts)
{
sb.AppendLine(
string.Format(
CultureInfo.InvariantCulture,
"- `{0}` (host: `{1}`)",
mount.MountPath,
mount.HostPath));
}
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The execute_code description includes host filesystem paths (e.g., workspaceRoot and mount.HostPath). Since tool descriptions are model-visible, this can leak host machine details (directory names, usernames, repo paths). Consider omitting host paths from the model-facing description (or redacting to just the sandbox mount path), and keep host paths only in logs / developer-facing diagnostics.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +10
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Agents.AI.Hyperlight\Microsoft.Agents.AI.Hyperlight.csproj" />
<ProjectReference Include="..\..\src\Microsoft.Agents.AI\Microsoft.Agents.AI.csproj" />
</ItemGroup>
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test project inherits TargetFrameworks=net10.0;net472 from dotnet/tests/Directory.Build.props, but it project-references Microsoft.Agents.AI.Hyperlight, which only targets net8.0+. This will fail to build for the net472 target. Override TargetFrameworks here (e.g., to $(TargetFrameworksCore) or net10.0) so the test project doesn't target net472.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +6
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Agents.AI.Hyperlight\Microsoft.Agents.AI.Hyperlight.csproj" />
</ItemGroup>

Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test project inherits TargetFrameworks=net10.0;net472 from dotnet/tests/Directory.Build.props, but it references Microsoft.Agents.AI.Hyperlight (net8.0+ only). The net472 target will fail to build. Override TargetFrameworks in this csproj (e.g., $(TargetFrameworksCore) or net10.0) to avoid targeting net472.

Copilot uses AI. Check for mistakes.
|--------------------------------|-------------------------------------------------------------------------------------------|
| `AZURE_OPENAI_ENDPOINT` | Azure OpenAI endpoint. Required. |
| `AZURE_OPENAI_DEPLOYMENT_NAME` | Azure OpenAI deployment. Defaults to `gpt-5.4-mini`. |
| `HYPERLIGHT_PYTHON_GUEST_PATH` | Absolute path to the Hyperlight Python guest module (`.wasm` or `.aot` file). Required. |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Details on how to get the guest module will go to capture or point to a website with the details, as most of the end users are new to Hyperligh


Demonstrates adding provider-owned tools to `HyperlightCodeActProvider`. Those
tools are **only** available to code running inside the sandbox via
`call_tool("<name>", ...)` — they are never exposed to the model as direct
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Tools the recommended approach to pass files to the sandbox? Use case: Let the user upload an Excel file, and the agent uses the code to get details from the Excel file, similar to how Copilot works (Copilot studio). A sample to showcase this use case will be good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants