Skip to content

[dotnet-port] Align agentmode tool names and instructions with .NET #267

Description

@github-actions

Summary

Aligns the agent/harness/agentmode package with the .NET AgentModeProvider as updated in microsoft/agent-framework#6071.

Changes made:

  1. Tool names renamedAgentMode_Set/AgentMode_Getmode_set/mode_get. This matches the cross-SDK alignment made in #6071 (also applied to the Python SDK at the same time).

  2. Default instructions updated — the instructions now:

    • Add a bullet note: "you must check the current mode after any user input" (important behavioral guidance).
    • Reference mode_get/mode_set instead of the old tool names.
    • Add a "Mandatory Mode based Workflow" section that guides the agent on mode-based behavior for every user request.
  3. Default mode descriptions expandedplan and execute now have detailed step-by-step process descriptions matching .NET. Previously both descriptions were a single short sentence; now each has a 5–7 step workflow.

  4. Mode rendering formatbuildInstructions now formats each mode as a markdown section header (#### mode_name) followed by its description, matching .NET's BuildInstructions output. The old format used bullet points (- "mode_name": description).

  5. Tests updated — existing TestToolNames updated for new names; two new tests added:

    • TestDefaultInstructions_ContainToolNamesAndModeCheckGuidance — verifies mode_get, mode_set, "check the current mode", and "Mandatory Mode based Workflow" are present.
    • TestDefaultInstructions_ModesSectionHeaderFormat — verifies #### plan / #### execute headers appear in instructions.
  6. Feature comparison doc updated to note the alignment.

Ported .NET PRs

Breaking Changes

Yes. The mode_set and mode_get tool names replace AgentMode_Set and AgentMode_Get. Any agent prompts or harness configurations that reference the old tool names by string will stop matching. Since this is an intentional cross-SDK alignment (same rename was applied to Python) and the Go SDK is in beta, this breaking change is acceptable.

Tests and Examples

  • All existing agent/harness/agentmode tests pass.
  • Full go test ./... passes.
  • Added TestDefaultInstructions_ContainToolNamesAndModeCheckGuidance.
  • Added TestDefaultInstructions_ModesSectionHeaderFormat.

Notes

Upstream commits 5e097276 (docs), 383d551b (Purview), 2a345e5d (Magentic), 96d242fa (HarnessAgent compaction opt-in), and 9486c76e (ChatClientAgent reasoning merging) were inspected but are not applicable to the Go SDK — no Go equivalents for Magentic, HarnessAgent, or ChatClientAgent exist. The AgentMode misalignment was found via the Go SDK misalignment pass.

Generated by .NET to Go Porting Agent · ● 53.9M ·


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 dotnet-port/agentmode-tool-names-alignment-7428d9b884e17844.

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 (194 of 194 lines)
From 754d86f885b076c995c80469f6121e7c2ce828e3 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 10 Jun 2026 10:32:03 +0000
Subject: [PATCH] harness/agentmode: align tool names and instructions with
 .NET (#6071)

Rename AgentMode_Set/AgentMode_Get tools to mode_set/mode_get to match
the cross-SDK alignment made in microsoft/agent-framework#6071.

Also update the default instructions and default mode descriptions to
match the .NET AgentModeProvider as of that same PR:
- Add 'check mode after user input' note to instructions.
- Add 'Mandatory Mode based Workflow' section.
- Expand plan/execute default mode descriptions with step-by-step processes.
- Change mode rendering in instructions from bullet points to section
  headers (#### mode_name) matching .NET BuildInstructions output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/harness/agentmode/agentmode.go      | 52 +++++++++++++++++------
 agent/harness/agentmode/agentmode_test.go | 45 ++++++++++++++++++--
 docs/dotnet-go-sdk-feature-comparison.md  |  2 +-
 3 files changed, 81 insertions(+), 18 deletions(-)

diff --git a/agent/harness/agentmode/agentmode.go b/agent/harness/agentmode/agentmode.go
index 2d4201af..7c0df6a5 100644
--- a/agent/harness/agentmode/agentmode.go
+++ b/agent/harness/agentmode/agentmode.go
@@ -25,14 +25,20 @@ const stateKey = "agentModeState"
 
 const defaultInstructions = `## Agent Mode
 
-You can operate in different modes. Depending on the mode you are in, you will be required to follow different processes.
+- You can operate in different modes. Depending on the mode you are in, you will be required to follow different processes.
+- You must check the current mode after any user input, since the user may have changed the mode themselves,
+  e.g. the user may have switched to 'plan' mode after a previous research task finished in 'execute' mode, meaning they want to review a plan first before execu
... (truncated)

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