microsoft / microsoft/agent-framework-go

[dotnet-port-api] Add per-tool agent mode controls

Open
#1,097 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

agentic-workflows
Dominant language
Go
Stars
619
Forks
56
Avg merge
1d 1h
Merged PRs (30d)
122

Description

[!TIP]
Your pull request is ready to create! 🎉 ✅

Everything is OK—the changes have been pushed to branch dotnet-port-api-agentmode-tool-controls-20260918-a1a5742accaf6893. Please review the changes, including any protected files, before creating the pull request.

Create the pull request

The original pull request description is below.


Summary

Align agent/harness/agentmode with the .NET per-tool AgentModeProvider controls from microsoft/agent-framework#8458. This adds DisableModeSetTool and DisableModeGetTool config flags, keeps the default injected instructions coherent when either built-in tool is disabled, adds SetModeForSessionSilently for custom mode-switch flows that should not queue a follow-up notification, and extends the parity doc and package tests to cover the new behavior.

Ported .NET PRs

  • microsoft/agent-framework#8458 - Add per-tool AgentModeProvider controls
    • Upstream commit: dcd2c4d1e0b0fce6bcebe0f3d244351ba9002a80

Breaking Changes

No.

Tests and Examples

  • go test ./agent/harness/agentmode
  • go test ./agent/harness/...
  • Added targeted coverage for per-tool disable combinations, default-instruction rewrites, and silent mode changes that clear pending notifications.
  • No example changes.

Notes

  • The local upstream-agent-framework/main fetch was blocked by the firewall in this environment, so upstream inspection used the GitHub read bridge against the merged .NET PR and commit instead of a refreshed local remote-tracking ref.
  • Exact duplicate searches for [dotnet-port-api] plus the mode_set/mode_get AgentMode surface returned no matching workflow tracking issue before this port.

[!NOTE]
GitHub Actions is not permitted to create or approve pull requests in this repository.

The changes have been pushed to branch dotnet-port-api-agentmode-tool-controls-20260918-a1a5742accaf6893 and are ready to review.

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 (41 of 484 lines)
From 11b680cfda8c6a32a6c2c89b74f85ab946ef9bdd Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: 15e68364d23450bb00f1c846218038b2c1152ada
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 18 Sep 2026 05:35:06 +0000
Subject: [PATCH] [dotnet-port-api] Add per-tool agent mode controls

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

diff --git a/agent/harness/agentmode/agentmode.go b/agent/harness/agentmode/agentmode.go
index 32e1f69..c107779 100644
--- a/agent/harness/agentmode/agentmode.go
+++ b/agent/harness/agentmode/agentmode.go
@@ -25,14 +25,17 @@ import (
 
 const stateKey = "agentModeState"
 
+const modeGetInstructions = "Use the mode_get tool to check your current operating mode.\n"
+
+const modeSetInstructions = "Use the mode_set tool to switch between modes as your work progresses. Only use mode_set if the user explicitly instructs/allows you to change modes.\n\n"
+
+const planModeTransition = "7. When approval is granted, always switch to execute mode (using the `mode_set` tool), and follow the steps for *Execute mode*."
+
 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.
 
-Use the mode_get tool to check your current operating mode.
-Use the mode_set tool to switch between modes as your work progresses. Only use mode_set if the user explicitly instructs/allows you to change modes.
-
-You are currently operating in the {current_mode} mode.
+{mode_get_instructions}{mode_set_instructions}You are currently operating in the {current_mode} mode.
 
 ### Mandatory Mode based Workflow
 
@@ -64,6 +67,14 @@ type Config struct {
 	// Instructions overrid
... (truncated)

[!WARNING]

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by .NET to Go API Porting Agent · copilot · gpt54 · 124.4 AIC · ⌖ 14.7 AIC · ⊞ 15.7K ·

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with agent/harness/agentmode/agentmode.go and its targeted tests in agent/harness/agentmode/agentmode_test.go; run go test ./agent/harness/agentmode. Check the parity update in docs/dotnet-go-sdk-feature-comparison.md. Done means the per-tool controls, instruction combinations, silent mode changes, and documentation are covered by passing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
ai
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.