Skip to content

Python: [BREAKING] Graduate tool approval middleware out of experimental#7106

Merged
eavanvalkenburg merged 1 commit into
microsoft:mainfrom
westey-m:python-gradudate-toolapprovalmiddleware
Jul 14, 2026
Merged

Python: [BREAKING] Graduate tool approval middleware out of experimental#7106
eavanvalkenburg merged 1 commit into
microsoft:mainfrom
westey-m:python-gradudate-toolapprovalmiddleware

Conversation

@westey-m

Copy link
Copy Markdown
Contributor

Motivation & Context

The Microsoft Agent Framework harness depends on several building-block features
that are still marked experimental. As part of releasing those dependencies (see
#6964), the tool approval middleware and its supporting types are now stable
enough to graduate out of experimental status so downstream users can rely on
them without opting into experimental warnings.

Description & Review Guide

  • What are the major changes?

    • Removed the @experimental(feature_id=ExperimentalFeature.HARNESS) decorators
      from the graduated tool-approval types (ToolApprovalRule,
      ToolApprovalState, ToolApprovalMiddleware) in
      _harness/_tool_approval.py, along with the now-unused _feature_stage
      import.
    • Updated the "Tool Approval Harness" section of packages/core/AGENTS.md to
      drop the "Experimental" qualifier from ToolApprovalMiddleware.
  • What is the impact of these changes?

    • The tool-approval middleware and its state/rule types no longer emit
      experimental warnings.
    • Breaking (experimental surface only): graduating a preview API is marked
      breaking so preview users of the experimental harness are notified; no
      released API is broken.
    • The shared ExperimentalFeature.HARNESS id is intentionally retained (still
      referenced by other harness symbols that remain experimental).
  • What do you want reviewers to focus on?

    • That the tool-approval surface (ToolApprovalRule, ToolApprovalState,
      ToolApprovalMiddleware, and the already-undecorated helper functions and
      ToolApprovalRuleCallback alias) is the intended graduation scope.

Related Issue

Related to #6964

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI review requested due to automatic review settings July 14, 2026 10:05
@westey-m westey-m marked this pull request as ready for review July 14, 2026 10:06
@giles17 giles17 added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible labels Jul 14, 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.

Pull request overview

Graduates the Python tool-approval middleware surface from experimental to stable so downstream users can adopt it without opting into experimental warnings, while keeping other harness components under ExperimentalFeature.HARNESS.

Changes:

  • Removed @experimental(feature_id=ExperimentalFeature.HARNESS) decorators (and the now-unused import) from ToolApprovalRule, ToolApprovalState, and ToolApprovalMiddleware.
  • Updated core Python documentation to remove the “Experimental” qualifier for ToolApprovalMiddleware.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
python/packages/core/AGENTS.md Updates the harness documentation to describe ToolApprovalMiddleware as non-experimental.
python/packages/core/agent_framework/_harness/_tool_approval.py Removes experimental staging decorators/imports from the tool-approval rule/state/middleware types.

@github-actions

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/_harness
   _tool_approval.py3544487%68, 71, 76, 113, 130, 133, 136, 193–194, 213, 242, 250, 261, 279–284, 296, 310, 313, 333, 383, 406, 408–409, 441, 451, 466, 468–469, 471–472, 497–498, 519–521, 559–560, 610, 614, 619
TOTAL44431524388% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
8965 33 💤 0 ❌ 0 🔥 2m 24s ⏱️

@github-actions github-actions Bot 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.

Automated Code Review

Reviewers: 5 | Confidence: 94%

✓ Correctness

This is a clean, mechanical removal of three @experimental decorators and their now-unused import from _tool_approval.py, graduating ToolApprovalRule, ToolApprovalState, and ToolApprovalMiddleware to stable. The import removal is safe—no other references to experimental or ExperimentalFeature remain in the file. The ExperimentalFeature.HARNESS enum value is still used by numerous other harness modules (_file_access, _agent, _loop, _file_memory, _todo, _background_agents, _memory), so nothing is left dangling. The AGENTS.md documentation update correctly removes the 'Experimental' qualifier. No correctness issues found.

✓ Security Reliability

This PR cleanly removes the @experimental decorators from three classes (ToolAprovalRule, ToolApprovalState, ToolApprovalMiddleware) and their associated import. The grep confirms no remaining references to experimental or ExperimentalFeature in the file after the change. There are no security or reliability concerns — the change is purely removing decorator-based warnings and updating documentation. No resource leaks, injection risks, or unhandled failure modes are introduced.

✓ Test Coverage

The PR correctly removes @experimental decorators from ToolApprovalRule, ToolApprovalState, and ToolApprovalMiddleware. Functional test coverage for these classes is solid (13 tests in test_harness_tool_approval.py). However, unlike the analogous todo harness graduation (which added test_todo_harness_graduated_classes_are_not_experimental in test_harness_todo.py:369), this PR does not add a regression test asserting these classes no longer carry feature_id metadata. This is the established pattern in the codebase for graduating experimental features.

✓ Failure Modes

This is a clean, minimal change that removes three @experimental decorators and their associated import from _tool_approval.py, graduating ToolApprovalRule, ToolApprovalState, and ToolApprovalMiddleware to stable status. The import removal is safe (no remaining references in the file), and the ExperimentalFeature.HARNESS enum value is correctly preserved for other harness symbols that remain experimental. No silent failure modes, lost errors, or operational issues are introduced.

✓ Design Approach

I did not find a design-approach issue in this diff. The three symbols being graduated are already treated as normal public API in the package exports and harness tests, and the removed decorator only adds warning/docstring/metadata behavior rather than functional semantics, so this change is consistent with the stated goal of graduating just the tool-approval surface.

Suggestions

  • Add a graduation regression test (following the pattern in test_harness_todo.py:369-379) asserting that ToolApprovalRule, ToolApprovalState, and ToolApprovalMiddleware no longer carry __feature_id__ or experimental docstring warnings. This guards against accidental re-introduction of the experimental decorator.

Automated review by westey-m's agents

@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Jul 14, 2026
Merged via the queue into microsoft:main with commit ba0ad2d Jul 14, 2026
45 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants