Skip to content

.NET: Add harness agent package#5782

Merged
westey-m merged 7 commits into
microsoft:mainfrom
westey-m:harness-agent-package
May 13, 2026
Merged

.NET: Add harness agent package#5782
westey-m merged 7 commits into
microsoft:mainfrom
westey-m:harness-agent-package

Conversation

@westey-m
Copy link
Copy Markdown
Contributor

Motivation and Context

Add package for HarnessAgent to contain a set of default capabilities

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings May 12, 2026 15:06
@moonbox3 moonbox3 added documentation Improvements or additions to documentation .NET labels May 12, 2026
@github-actions github-actions Bot changed the title Add harness agent package .NET: Add harness agent package May 12, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 4 | Confidence: 92% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Design Approach


Automated review by westey-m's agents

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

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.Harness project containing HarnessAgent, HarnessAgentOptions, and IChatClient.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.

Comment thread dotnet/tests/Microsoft.Agents.AI.Harness.UnitTests/HarnessAgentTests.cs Outdated
Comment thread dotnet/src/Microsoft.Agents.AI.Harness/HarnessAgentOptions.cs Outdated
Comment thread dotnet/samples/02-agents/Harness/Harness_Step01_Research/Program.cs
Comment thread dotnet/src/Microsoft.Agents.AI.Harness/HarnessAgent.cs Outdated
@westey-m westey-m added this pull request to the merge queue May 13, 2026
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.

7 participants