Skip to content

Python: Remove unused AG-UI orchestration helpers and flatten subpackage - #7426

Open
moonbox3 wants to merge 3 commits into
microsoft:mainfrom
moonbox3:moonbox3/agui-flatten-orchestration
Open

Python: Remove unused AG-UI orchestration helpers and flatten subpackage#7426
moonbox3 wants to merge 3 commits into
microsoft:mainfrom
moonbox3:moonbox3/agui-flatten-orchestration

Conversation

@moonbox3

Copy link
Copy Markdown
Contributor

Motivation & Context

The agent_framework_ag_ui._orchestration._helpers module has no production callers. Its only importer anywhere in the repo is its own test file. It also carries a stale fork of the live metadata sanitization in _agent_run.py: the dead copy truncates oversized metadata values to 512 chars, while the live copy deliberately drops the key with a warning because truncation can produce invalid JSON. Keeping the dead copy around means 751 lines of code and tests certifying behavior nothing runs, and a divergent implementation waiting to mislead someone.

Description & Review Guide

  • Delete _orchestration/_helpers.py (247 lines, zero production callers) and its test file test_helpers.py (504 lines).
  • Move _tooling.py and _predictive_state.py from _orchestration/ to the package root and remove the now-empty subpackage; the subpackage's __init__.py was empty, so it provided a path segment and nothing else.
  • Update the 3 production and 5 test import sites accordingly. The only content change in the moved modules is one relative import line (from .._utils to from ._utils).

Impact: none at runtime. Public exports are unchanged (__all__ is identical before and after, and test_public_exports.py passes), the agent_framework.ag_ui facade resolves as before, and the wheel builds cleanly with no _orchestration remnants. All 890 ag-ui tests pass; ruff and pyright are clean; the 3 pre-existing mypy errors are identical on main.

Review focus: confirm the deleted helpers have no callers you know of outside the repo, and that the flattened module locations look right.

Related Issue

Internal cleanup, no linked 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.

The _orchestration/_helpers module had no production callers; its only
importer was its own test file. It also carried a stale fork of the live
metadata sanitization in _agent_run.py: the dead copy truncated oversized
values, behavior the live copy deliberately replaced with drop-plus-warning
because truncation can produce invalid JSON.

Move _tooling.py and _predictive_state.py to the package root and remove
the now-empty _orchestration subpackage. Public exports are unchanged.
Copilot AI review requested due to automatic review settings July 30, 2026 08:37
@moonbox3
moonbox3 temporarily deployed to github-app-auth July 30, 2026 08:37 — with GitHub Actions Inactive
@moonbox3
moonbox3 temporarily deployed to github-app-auth July 30, 2026 08:37 — with GitHub Actions Inactive
@moonbox3
moonbox3 temporarily deployed to github-app-auth July 30, 2026 08:37 — with GitHub Actions Inactive
@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Jul 30, 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: 59% | Result: All clear

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


Automated review by moonbox3's agents

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

This PR cleans up the Python AG-UI integration package by removing an unused orchestration helpers module (and its tests) and flattening the package structure by moving the remaining orchestration modules to the package root. This reduces dead/duplicated code and eliminates the _orchestration path segment while keeping runtime behavior and public exports unchanged.

Changes:

  • Deleted agent_framework_ag_ui._orchestration._helpers and its dedicated test file (test_helpers.py).
  • Flattened the internal module layout by moving _tooling.py and _predictive_state.py to agent_framework_ag_ui/ and removing the _orchestration/ subpackage.
  • Updated production and test import sites to the new module paths.

Reviewed changes

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

Show a summary per file
File Description
python/packages/ag-ui/tests/ag_ui/test_tooling.py Updates tooling imports to agent_framework_ag_ui._tooling.
python/packages/ag-ui/tests/ag_ui/test_run.py Updates predictive state import to agent_framework_ag_ui._predictive_state.
python/packages/ag-ui/tests/ag_ui/test_run_common.py Updates predictive state import to agent_framework_ag_ui._predictive_state.
python/packages/ag-ui/tests/ag_ui/test_predictive_state.py Updates predictive state import to agent_framework_ag_ui._predictive_state.
python/packages/ag-ui/tests/ag_ui/test_helpers.py Removes tests for the deleted dead helpers module.
python/packages/ag-ui/agent_framework_ag_ui/_tooling.py Adds tooling helper module at package root (flattened layout).
python/packages/ag-ui/agent_framework_ag_ui/_run_common.py Updates internal import to the flattened predictive state module.
python/packages/ag-ui/agent_framework_ag_ui/_predictive_state.py Updates relative import after flattening (._utils).
python/packages/ag-ui/agent_framework_ag_ui/_agent_run.py Updates imports to flattened predictive state/tooling modules.
python/packages/ag-ui/agent_framework_ag_ui/_orchestration/_helpers.py Deletes unused orchestration helpers implementation.
python/packages/ag-ui/agent_framework_ag_ui/_orchestration/init.py Removes now-unneeded subpackage initializer (subpackage removed).

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/ag-ui/agent_framework_ag_ui
   _agent_run.py117911889%185–192, 239–240, 247, 356, 360, 362, 379, 406–407, 520, 534, 538, 542, 545, 550, 555, 564, 567, 574–580, 613, 625, 636, 639, 674, 728–732, 797, 812, 815, 817, 843, 869–871, 929, 931, 933, 936–940, 954, 962–967, 976–977, 1026–1029, 1040, 1048, 1080, 1095, 1109, 1121, 1151, 1155, 1158, 1160, 1200–1202, 1266, 1272–1273, 1278, 1282–1283, 1481, 1489, 1519, 1523, 1568, 1686, 1716–1717, 1839, 1985, 2045, 2062, 2082–2083, 2090, 2198, 2226, 2234, 2236, 2239, 2245, 2300, 2303, 2313–2314, 2321, 2368
   _predictive_state.py99297%144, 216
   _run_common.py5914891%76, 139–140, 142, 144, 147, 153, 155, 169, 176, 200–201, 214, 233, 235, 269, 313, 325, 327, 329, 332–336, 514, 794–795, 801–806, 1117–1118, 1123, 1125–1127, 1136, 1144, 1156, 1158–1161, 1224
   _tooling.py480100% 
TOTAL46530448490% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
9546 34 💤 0 ❌ 0 🔥 2m 29s ⏱️

@moonbox3 moonbox3 changed the title Python: Remove dead AG-UI orchestration helpers and flatten subpackage Python: Remove unused AG-UI orchestration helpers and flatten subpackage Jul 30, 2026
@moonbox3
moonbox3 temporarily deployed to github-app-auth July 30, 2026 09:36 — with GitHub Actions Inactive
@moonbox3
moonbox3 enabled auto-merge July 30, 2026 09:41
@moonbox3
moonbox3 requested a review from westey-m July 30, 2026 10:31
@moonbox3

Copy link
Copy Markdown
Contributor Author

@westey-m super simple one if you're able to take a look. Thanks!

@moonbox3
moonbox3 temporarily deployed to github-app-auth July 30, 2026 10:32 — with GitHub Actions Inactive
@moonbox3
moonbox3 temporarily deployed to github-app-auth July 30, 2026 10:37 — with GitHub Actions Inactive

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

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


Automated review by moonbox3's agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants