Skip to content

Python: [BREAKING] Graduate create_harness_agent out of experimental - #7120

Merged
TaoChenOSU merged 6 commits into
microsoft:mainfrom
westey-m:python-graduate-harness-agent
Jul 20, 2026
Merged

Python: [BREAKING] Graduate create_harness_agent out of experimental#7120
TaoChenOSU merged 6 commits into
microsoft:mainfrom
westey-m:python-graduate-harness-agent

Conversation

@westey-m

Copy link
Copy Markdown
Contributor

Motivation & Context

create_harness_agent has matured and is ready to leave experimental status, so
callers can rely on it without opting into experimental APIs. However, a few of
the features it can wire in are still experimental (background agents, file
access, looping) or pre-release (shell tooling, from the alpha-stage
agent-framework-tools package). Graduating the factory should not silently drop
the experimental signal for those specific features. This change releases the
factory while preserving a targeted warning only for the parameters that activate
still-experimental behaviour.

Description & Review Guide

  • What are the major changes?

    • Removed the @experimental(HARNESS) decorator from create_harness_agent, so
      calling it no longer emits an ExperimentalWarning.
    • Added a runtime boundary check that emits a single ExperimentalWarning only
      when a caller opts into a still-experimental or pre-release feature:
      background_agents, file_access_store, loop_should_continue (shared
      HARNESS dedup key), and shell_executor (separate SHELL_TOOLING dedup key
      so it does not suppress unrelated HARNESS warnings).
    • Python has no per-parameter experimental decorator, so the warning is issued
      at runtime naming the responsible parameter(s).
    • Documented the gating in the docstring and packages/core/AGENTS.md, and
      added tests (graduation guard, default no-warning, and one warning test per
      gated parameter).
  • What is the impact of these changes?

    • create_harness_agent is now a released API. This is a breaking change for
      preview users who were suppressing/relying on the previous HARNESS
      experimental warning on every call.
    • Enabling background agents, file access, looping, or shell tooling still
      surfaces an ExperimentalWarning.
  • What do you want reviewers to focus on?

    • The dedup-key strategy: the experimental harness providers share the HARNESS
      key (so a downstream provider doesn't warn twice), while shell tooling uses a
      separate SHELL_TOOLING key.

Related Issue

Closes #7117

This is the Python counterpart to the .NET graduation in #7119 (which references
the same issue).

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 18:22
@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

@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: 90%

✓ Correctness

The PR correctly graduates create_harness_agent from experimental status while preserving targeted ExperimentalWarning emissions for still-experimental parameters. The dedup-key strategy correctly prevents double-warnings from downstream @experimental-decorated providers. The stacklevel, truthiness checks, and shared mutable set usage are all correct. No correctness issues found.

✓ Security Reliability

The PR graduates create_harness_agent from experimental status while preserving targeted warnings for still-experimental sub-features. The implementation follows the established _WARNED_FEATURES dedup pattern from _feature_stage.py, uses a correct stacklevel=3 to point warnings at the caller's call site, and seeds the dedup set so downstream providers don't double-warn. No security vulnerabilities, resource leaks, injection risks, or unhandled failure modes were identified.

✓ Test Coverage

The PR adds good per-parameter warning tests and a graduation guard, but the central design decision highlighted by the author—the dedup-key strategy—lacks explicit test coverage. There is no test verifying that (a) repeated calls with the same experimental param only warn once, (b) multiple HARNESS params in a single call produce one combined warning naming all params, or (c) HARNESS and SHELL_TOOLING dedup keys are independent (both fire when both features are enabled). The individual tests are well-structured and assertions are meaningful.

✓ Failure Modes

The PR cleanly graduates create_harness_agent while preserving targeted experimental warnings for still-experimental features. The dedup-key mechanism correctly mirrors the existing _warn_on_feature_use pattern in _feature_stage.py, the stacklevel=3 is accurate for the fixed call path, and the warning-before-seed ordering handles all warning filter modes correctly (error → abort before seed, ignore → intentional suppression, default → seed prevents downstream double-warn). No silent failure paths or operational failure modes introduced.

✓ Design Approach

I found one design issue in the new runtime warning boundary: create_harness_agent now consumes the one-time experimental dedup key before some opted-in features have actually been validated or wired. That means a failed first call can suppress the warning on a later successful call in the same process.

Suggestions

  • Consider deferring insertion into _WARNED_FEATURES until after the corresponding feature has been successfully built/wired. Right now _warn_experimental_harness_params() adds the dedup key eagerly (python/packages/core/agent_framework/_harness/_agent.py:294-304), but create_harness_agent() calls it before shell validation/wiring (_agent.py:561-566 before 584-589), and _assemble_shell() can still raise TypeError for an invalid executor (_agent.py:241-246).

Automated review by westey-m's agents

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _feature_stage.py1801193%108, 154, 209, 220, 241, 279, 318, 329, 335, 366, 394
packages/core/agent_framework/_harness
   _agent.py130496%201, 624–625, 627
TOTAL44844510388% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
9132 33 💤 0 ❌ 0 🔥 2m 21s ⏱️

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 create_harness_agent factory out of experimental so callers can use it without opting into experimental APIs, while preserving targeted ExperimentalWarning behavior when callers enable still-experimental (or pre-release) harness features.

Changes:

  • Removed the @experimental(HARNESS) staging from create_harness_agent and replaced it with runtime warnings only when specific gated parameters are used.
  • Implemented per-feature warning deduplication: harness-related experimental features share the HARNESS dedup key, while shell tooling uses a separate dedup key.
  • Updated documentation and added tests covering the graduated default behavior and warnings for each gated parameter.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
python/packages/core/agent_framework/_harness/_agent.py Removes the experimental decorator and adds runtime gated ExperimentalWarning emission with dedup keys.
python/packages/core/AGENTS.md Documents the new experimental-feature gating behavior and dedup-key strategy.
python/packages/core/tests/core/test_harness_agent.py Adds tests ensuring create_harness_agent is no longer experimental and that each gated parameter emits warnings.

Comment thread python/packages/core/tests/core/test_harness_agent.py
@westey-m
westey-m marked this pull request as ready for review July 17, 2026 15:49

@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: 87% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Failure Modes, Design Approach


Automated review by westey-m's agents

@TaoChenOSU
TaoChenOSU added this pull request to the merge queue Jul 20, 2026
Merged via the queue into microsoft:main with commit ac47410 Jul 20, 2026
38 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.

Graduate/Release harness agent

6 participants