Skip to content

.NET: Add sample to show how to build a harness#5268

Merged
westey-m merged 6 commits intomicrosoft:feature-harnessfrom
westey-m:harness-sample01
Apr 15, 2026
Merged

.NET: Add sample to show how to build a harness#5268
westey-m merged 6 commits intomicrosoft:feature-harnessfrom
westey-m:harness-sample01

Conversation

@westey-m
Copy link
Copy Markdown
Contributor

Motivation and Context

The sample is intended to show how to use a ChatClientAgent with the various AF built in components to demonstrate how to assemble your own agent harness.

Description

  • Add harness console app sample

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 April 15, 2026 10:58
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new .NET console sample demonstrating how to assemble an “agent harness” around ChatClientAgent using built-in Harness context providers (planning, todos, mode) and a shared interactive console runner.

Changes:

  • Added a new Harness sample group with a step-by-step research agent sample.
  • Introduced a shared console loop (Harness_Shared_Console) for streaming output + tool call formatting + spinner + mode/todo commands.
  • Added a simple web-browsing tool that downloads HTML and converts it to markdown for the agent.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
dotnet/samples/02-agents/README.md Adds the Harness sample link to the samples index.
dotnet/samples/02-agents/Harness/README.md Introduces the Harness samples landing page.
dotnet/samples/02-agents/Harness/Harness_Step01_Research/README.md Documents prerequisites, env vars, and how to run the step-1 harness sample.
dotnet/samples/02-agents/Harness/Harness_Step01_Research/Program.cs Implements the research agent using Foundry + Harness providers + web tools.
dotnet/samples/02-agents/Harness/Harness_Step01_Research/WebBrowsingTools.cs Adds a URI download tool and HTML→Markdown conversion logic.
dotnet/samples/02-agents/Harness/Harness_Step01_Research/Harness_Step01_Research.csproj Adds the step-1 sample project.
dotnet/samples/02-agents/Harness/Harness_Shared_Console/HarnessConsole.cs Provides reusable interactive console runner for harness samples.
dotnet/samples/02-agents/Harness/Harness_Shared_Console/Spinner.cs Adds console spinner used during streaming/tool calls.
dotnet/samples/02-agents/Harness/Harness_Shared_Console/ToolCallFormatter.cs Adds human-readable tool call formatting for console output.
dotnet/samples/02-agents/Harness/Harness_Shared_Console/Harness_Shared_Console.csproj Adds shared console helper project.
dotnet/agent-framework-dotnet.slnx Adds the new Harness projects and README into the solution.

Comment thread dotnet/samples/02-agents/Harness/Harness_Step01_Research/WebBrowsingTools.cs Outdated
Comment thread dotnet/samples/02-agents/Harness/Harness_Step01_Research/Program.cs Outdated
Comment thread dotnet/samples/02-agents/Harness/Harness_Shared_Console/Spinner.cs Outdated
Comment thread dotnet/samples/02-agents/Harness/Harness_Shared_Console/ToolCallFormatter.cs Outdated
Comment thread dotnet/samples/02-agents/README.md Outdated
Comment thread dotnet/samples/02-agents/Harness/Harness_Step01_Research/README.md Outdated
@moonbox3 moonbox3 added documentation Improvements or additions to documentation .NET labels Apr 15, 2026
@github-actions github-actions Bot changed the title Add sample to show how to build a harness .NET: Add sample to show how to build a harness Apr 15, 2026
@westey-m westey-m merged commit 9d89353 into microsoft:feature-harness Apr 15, 2026
4 of 5 checks passed
pull Bot pushed a commit to nagyist/ms-agent-framework that referenced this pull request May 1, 2026
* .NET: Add a TODO AIContextProvider (microsoft#5233)

* Add a TODO AIContextProvider

* Add unit tests

* Address PR comments

* Address PR comments

* Fix test after removing one tool

* .NET: Add a ModeProvider for managing agent modes (microsoft#5247)

* Add a ModeProvider for managing agent modes

* Fix typo

* Fix typo

* Fix typo

* Address PR comments

* .NET: Add sample to show how to build a harness (microsoft#5268)

* Add sample to show how to build a harness

* Improve sample

* Sample max output tokens and model

* Fix encoding

* Fix model name in readme

* Address PR comments

* .NET: Add context window size compaction strategy for harness (microsoft#5304)

* Add context window size compaction strategy for harness

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Address PR comments

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* .NET: Add a file memory provider (microsoft#5315)

* Add a file memory provider

* Address PR comments

* Fix review comments.

* Add additional unit tests

* Addressing PR comments.

* .NET:  Harness: Improve prompts and add FileSystem store (microsoft#5365)

* Harness: Improve prompts and add FileSystem store

* Address PR comments

* .NET: Harness: Improve path validation (microsoft#5404)

* Harness: Improve path validation

* Address PR comments

* .NET: Add always approve helpers, improve sample and fix bug (microsoft#5451)

* Add always approve helpers, improve sample and fix bug

* Address PR comments

* .NET: Make Todo, Mode and FileMemory providers more configurable (microsoft#5477)

* Make Todo, Mode and FileMemory providers more configurable

* Address PR comments.

* .NET: Add subagents provider and sample (microsoft#5518)

* Add subagents provider and sample

* Addressing PR comments.

* .NET: Harness filememory index plus instructions consistency (microsoft#5540)

* Add FileMemoryProvider index and improve instruction consistency

* Address PR comments.

* Address PR comments

* Address PR comments.

* Apply suggestion from @rogerbarreto

Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>

---------

Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>

* .NET: Refactor harness console to be more extensible and easy to understand with better UX (microsoft#5573)

* Refactor harness console to be more extensible and easy to understand with better UX.

* Fix formatting issues.

* Allow multiple clarifications in one response

* Address PR comments

* .NET: Add FileAccessProvdider and concurrency fix for FileMemoryProvider (microsoft#5583)

* Add FileAccessProvdider and concurrency fix for FileMemoryProvider

* Address PR comments

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
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.

4 participants