.NET: Add harness agent package#5782
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new .NET package, Microsoft.Agents.AI.Harness, that provides a HarnessAgent wrapper around ChatClientAgent with a preconfigured pipeline (function invocation, per-service-call chat history persistence, and context-window compaction). It also updates the Harness samples to use HarnessAgent and adds unit tests for the new agent and options.
Changes:
- Added
Microsoft.Agents.AI.Harnessproject containingHarnessAgent,HarnessAgentOptions, andIChatClient.AsHarnessAgent(...). - Added a new unit test project for
Microsoft.Agents.AI.Harness. - Updated Harness samples (Step01/02/03) to use
AsHarnessAgent(...)instead of manually composing the pipeline.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Harness/Microsoft.Agents.AI.Harness.csproj | New packable Harness library project definition and test visibility. |
| dotnet/src/Microsoft.Agents.AI.Harness/HarnessAgent.cs | Implements the preconfigured HarnessAgent pipeline and default instructions. |
| dotnet/src/Microsoft.Agents.AI.Harness/HarnessAgentOptions.cs | Adds configuration options for HarnessAgent (identity, chat options, history provider, context providers). |
| dotnet/src/Microsoft.Agents.AI.Harness/ChatClientHarnessExtensions.cs | Adds AsHarnessAgent(...) extension on IChatClient. |
| dotnet/tests/Microsoft.Agents.AI.Harness.UnitTests/Microsoft.Agents.AI.Harness.UnitTests.csproj | New unit test project referencing the Harness project. |
| dotnet/tests/Microsoft.Agents.AI.Harness.UnitTests/HarnessAgentTests.cs | Adds unit tests for constructor validation and pipeline behavior. |
| dotnet/tests/Microsoft.Agents.AI.Harness.UnitTests/HarnessAgentOptionsTests.cs | Adds unit tests for HarnessAgentOptions defaults and property set/get behavior. |
| dotnet/samples/02-agents/Harness/Harness_Step01_Research/README.md | Updates sample description to reflect HarnessAgent usage. |
| dotnet/samples/02-agents/Harness/Harness_Step01_Research/Program.cs | Switches Step01 sample from manual pipeline composition to AsHarnessAgent(...). |
| dotnet/samples/02-agents/Harness/Harness_Step01_Research/Harness_Step01_Research.csproj | Adds project reference to the new Harness project. |
| dotnet/samples/02-agents/Harness/Harness_Step02_Research_WithSubAgents/README.md | Updates sample description to reflect HarnessAgent usage. |
| dotnet/samples/02-agents/Harness/Harness_Step02_Research_WithSubAgents/Program.cs | Switches Step02 sample agents to AsHarnessAgent(...). |
| dotnet/samples/02-agents/Harness/Harness_Step02_Research_WithSubAgents/Harness_Step02_Research_WithSubAgents.csproj | Adds project reference to the new Harness project. |
| dotnet/samples/02-agents/Harness/Harness_Step03_DataProcessing/README.md | Updates sample description to reflect HarnessAgent usage. |
| dotnet/samples/02-agents/Harness/Harness_Step03_DataProcessing/Program.cs | Switches Step03 sample from manual pipeline composition to AsHarnessAgent(...). |
| dotnet/samples/02-agents/Harness/Harness_Step03_DataProcessing/Harness_Step03_DataProcessing.csproj | Adds project reference to the new Harness project. |
| dotnet/agent-framework-dotnet.slnx | Adds the new Harness project and its unit tests to the solution. |
alliscode
reviewed
May 12, 2026
peibekwe
reviewed
May 12, 2026
peibekwe
approved these changes
May 12, 2026
SergeyMenshykh
approved these changes
May 13, 2026
This was referenced May 14, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Add package for HarnessAgent to contain a set of default capabilities
Description
Contribution Checklist