Skip to content

[dotnet-port-api] Port .NET harness configurator #782

Description

@github-actions

Summary

Add a top-level agent/harness package that ports the narrow composed public API shape of .NET's HarnessAgent into Go without pulling in the broader .NET-only file access, file memory, or subagent features. The new harness.Configure helper applies default harness instructions, wires the existing todo and agent-mode context providers, and optionally adds loop and tool-approval middleware so provider-specific agent configs can opt into a batteries-included harness with one exported entry point.

This was selected from upstream microsoft/agent-framework commit c033adb1f4502d30b57149cb54f8683fab66297d because it adds a small, user-facing API surface that maps cleanly onto Go's existing harness packages and is reviewable as a standalone parity step. The feature comparison doc now lists the new top-level package, and focused tests plus an example cover the composed behavior.

Ported .NET PRs

Upstream commit: c033adb1f4502d30b57149cb54f8683fab66297d

Breaking Changes

No. This adds a new package and exported helper without changing existing public APIs.

Tests and Examples

  • go test ./agent/harness/...
  • Added agent/harness/harness_example_test.go
  • Added focused coverage in agent/harness/harness_test.go for default composition, opt-out behavior, ordering, and loop wiring

Notes

This intentionally ports only the narrow composed harness configurator surface. The broader .NET harness features that still lack Go equivalents — file access, file memory, file store, subagent harness utilities, and the AI-judge loop evaluator — remain follow-up work. The Go helper composes the existing Go harness packages idiomatically instead of transliterating the full .NET HarnessAgent type and options tree.

Generated by .NET to Go API Porting Agent · gpt54 · 206.9 AIC · ⌖ 15.9 AIC · ⊞ 24.2K ·


Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch copilot/dotnet-port-harness-configurator-b4bc1d3c649d2a90.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (355 of 355 lines)
From f2743e4e5c4ca2bd8212d57a4f44a7f748f04ee7 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 4 Aug 2026 06:26:17 +0000
Subject: [PATCH] [dotnet-port-api] Port .NET harness configurator

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/harness/harness.go                 | 101 ++++++++++++
 agent/harness/harness_example_test.go    |  17 +++
 agent/harness/harness_test.go            | 186 +++++++++++++++++++++++
 docs/dotnet-go-sdk-feature-comparison.md |   2 +-
 4 files changed, 305 insertions(+), 1 deletion(-)
 create mode 100644 agent/harness/harness.go
 create mode 100644 agent/harness/harness_example_test.go
 create mode 100644 agent/harness/harness_test.go

diff --git a/agent/harness/harness.go b/agent/harness/harness.go
new file mode 100644
index 000000000..3aeb93e41
--- /dev/null
+++ b/agent/harness/harness.go
@@ -0,0 +1,101 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+// Package harness provides a composed, cross-provider harness configuration
+// aligned with the upstream .NET HarnessAgent surface.
+package harness
+
+import (
+	"slices"
+
+	"github.com/microsoft/agent-framework-go/agent"
+	"github.com/microsoft/agent-framework-go/agent/harness/agentmode"
+	"github.com/microsoft/agent-framework-go/agent/harness/loop"
+	"github.com/microsoft/agent-framework-go/agent/harness/todo"
+	"github.com/microsoft/agent-framework-go/agent/harness/toolapproval"
+)
+
+// DefaultInstructions are the built-in harness-level instructions applied when
+// Config.DisableInstructions is false and Config.Instructions is empty.
+const DefaultInstructions = `You are a helpful AI assistant that uses tools to complete tasks.
+
+## General guidelines
+
+- Think through the task before acting. Break complex work into clear steps.
+- Use the tools available to you to gather information, perform actions, and verify results.
+- Explain your reasoning and thought process as you work thr
... (truncated)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions