Skip to content

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

Merged
Quim Muntal (qmuntal) merged 1 commit into
mainfrom
dotnet-port-api-agentmode-tool-controls-20260918-a1a5742accaf6893
Sep 22, 2026
Merged

Quim Muntal (qmuntal) merged 1 commit into
mainfrom
dotnet-port-api-agentmode-tool-controls-20260918-a1a5742accaf6893

Conversation

@michelle-clayton-work

Copy link
Copy Markdown
Contributor

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

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.

Closes #1097

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 19, 2026 19:09
@github-actions github-actions Bot added area:agent Changes files in the agent area size:xlarge More than 300 changed lines or 10 files labels Sep 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The built-in mode_set path can clear a queued PreviousMode notification, so the moderate finding must be addressed.

Review effort: Lite
Findings: None

What changed in this PR

Adds per-tool mode_set/mode_get controls and silent session mode changes to the Go agent-mode harness, with tests and .NET parity documentation.

Changes:

  • Adds independent tool-disable controls and instruction rewriting.
  • Adds silent mode updates that clear pending notifications.
  • Expands tests and parity documentation.
File Summary
docs/​dotnet-go-sdk-feature-comparison.md Documents per-tool agent-mode parity.
agent/​harness/​agentmode/​agentmode.go Implements controls and silent mode changes; the built-in mode_set path must preserve queued PreviousMode notifications.
agent/​harness/​agentmode/​agentmode_test.go Adds coverage for tool combinations, instructions, and notification behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added kind:code Changes production behavior or code kind:docs Changes documentation or comments kind:tests Changes tests, fixtures, or test infrastructure public-api-change Pull Request changes public APIs labels Sep 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Scope: public API, user-visible behavior

Changed Go contract: agent/harness/agentmode:

  • New Config.DisableModeSetTool / Config.DisableModeGetTool fields (both default false).
  • New exported Provider.SetModeForSessionSilently(session, mode) method.
  • Behavior change: createTools conditionally omits mode_set/mode_get; buildInstructions conditionally strips {mode_get_instructions}/{mode_set_instructions}/{plan_mode_transition} guidance only when using default (non-custom) modes/instructions; SetModeForSession/SetModeForSessionSilently share setModeForSessionWithNotificationOption, which clears PreviousMode (pending notification) when silent.

Upstream evidence reviewed: dotnet/src/Microsoft.Agents.AI/Harness/AgentMode/AgentModeProvider.cs and AgentModeProviderOptions.cs from microsoft/agent-framework#8458 (merged commit dcd2c4d1e0b0fce6bcebe0f3d244351ba9002a80):

  • AgentModeProviderOptions.DisableModeSetTool / DisableModeGetTool, both defaulting to false — matches Go's Config fields and zero-value defaults.
  • CreateTools conditionally adds mode_set/mode_get via if (!this._disableModeSetTool) / if (!this._disableModeGetTool) — matches Go's createTools.
  • BuildInstructions only rewrites {mode_get_instructions}/{mode_set_instructions}/{plan_mode_transition} when _usesDefaultInstructions/_usesDefaultModes, preserving custom instructions verbatim — matches Go's usesDefaultInstr/usesDefaultModes guards, and is covered by Options_DisabledTools_PreserveCustomInstructionsAsync (.NET) and TestCustomInstructions_AreNotRewrittenWhenModeToolsDisabled (Go).
  • SetModeAsync(session, mode, disableNotification, ct) overload sets PreviousModeForNotification = null when disableNotification and otherwise preserves default (non-silent) notification behavior — matches Go's SetModeForSessionSilently clearing PreviousMode, and DisabledTools_PreserveStateInstructionsAndNotificationsAsync / PublicSetMode_DisableNotification_ClearsPendingNotificationAsync (.NET) map to TestSetModeForSessionSilently_ChangesModeWithoutNotification / TestSetModeForSessionSilently_ClearsPendingNotification (Go).

Result: aligned. The per-tool disable flags default to false (parity preserved for existing callers), the instruction-rewrite guarding for custom instructions/modes matches upstream exactly, and the silent-mode-set notification-suppression/clearing semantics mirror the .NET SetModeAsync overload. Naming is idiomatically Go (SetModeForSessionSilently vs. SetModeAsync(..., disableNotification: true, ...)) but conceptually equivalent. docs/dotnet-go-sdk-feature-comparison.md was updated to reference #8458. No parity issues found.

Generated by Go API Consistency Review Agent for #1111 · copilot · auto · 53.1 AIC · ⌖ 7.73 AIC · ⊞ 9.2K ·

@qmuntal
Quim Muntal (qmuntal) added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit 0c561b1 Sep 22, 2026
29 checks passed
@qmuntal
Quim Muntal (qmuntal) deleted the dotnet-port-api-agentmode-tool-controls-20260918-a1a5742accaf6893 branch September 22, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Changes files in the agent area kind:code Changes production behavior or code kind:docs Changes documentation or comments kind:tests Changes tests, fixtures, or test infrastructure public-api-change Pull Request changes public APIs size:xlarge More than 300 changed lines or 10 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants