Skip to content

feat: integrate subagent event trees with consumer migrations - #3526

Open
Lancetnik wants to merge 7 commits into
feat/subagent-eventbus-v2-prfrom
feat/subagent-eventbus-tests
Open

Lancetnik wants to merge 7 commits into
feat/subagent-eventbus-v2-prfrom
feat/subagent-eventbus-tests

Conversation

@Lancetnik

@Lancetnik Lancetnik commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Why are these changes needed?

This PR activates observable subagent trees, addressed delivery, cancellation cleanup, and source-event accounting. It removes legacy rollup generation and migrates UI, observers, telemetry, eval, network consumers, and their tests together. Delegation, accounting, HITL, cancellation, and consumer regressions accompany the implementation.

Addressed delivery has one public operation: event.origin.send(...). Only the StreamHandle and DeliveryError types are added to the existing subagent package exports. send_down and registry lookup/broadcast by task ID, agent name, or subtree are removed. run_task, TaskResult, and DelegationRegistry remain internal and are not re-exported. Registry access is an internal class method, with no global getter. Existing as_tool and subagent_tool entry points retain their roles. Race and nested-delivery tests obtain live addresses through event.origin; provider smoke tests import the runner module directly.

Accounting is forwarded as plain UsageEvent, without ChildEvent. Existing observer(UsageEvent, ...) and stream.where(UsageEvent) subscriptions receive original local and descendant costs with the same publication identity, kind, provider, and model. Forwarding preserves event_id; an explicit new publication creates a fresh ID and clears the inherited live address. Forwarded usage retains event.origin for addressed budget interventions, while serialization omits live handles. No rollup is generated.

Related issue number

Stack #3525: #3524 (events) → #3523 (variables) → #3526 (routing) → #3527 (documentation) → #3528 (support). No linked issue.

Checks

Current implementation: 7884 passed, 9 skipped, 437 deselected, 2 xfailed in the local standard non-LLM suite. The local run deselects four previously reproduced ACP advertised-address networking cases; no repository skips or CI changes were added. GitHub runs the normal workflow matrix.

Focused regression, accounting, telemetry, eval, and cancellation checks: 100 passed, 3 skipped. Mypy passed on the integration layer (255 source files) and with the strict configuration on the stack tip (259 files). Ruff passed for changed Python files. Relative documentation links and Python snippets were checked. Executable code matches the full-suite snapshot; subsequent source edits changed docstrings only.

The original typed-subscription regression was observed failing (only the root's 10 tokens instead of root + child + grandchild costs of 60), then passing for both observer and stream registration. A second regression verifies replay and republication cannot reuse the old live address. CI is rerunning for the updated heads. Website integration/build was not run locally.

AI assistance

Codex assisted with implementation, tests, documentation, and reorganizing the stack. The public surface, source identity, typed subscriptions, persistence/replay, and direct implementation-module imports were verified against the actual implementation. Delivery tests use event-origin handles rather than accessing the registry or selecting recipients by name. No CI workflows or test skips were added.

  • I understand the changes in this PR and can explain them in my own words.
  • I have verified that the PR description accurately reflects the actual diff.
  • If AI assistance was used, I reviewed, tested, and validated the generated code/text before submitting.

@github-actions github-actions Bot added area:core Agent runtime core: ag2/*.py, ag2/events, ag2/response, ag2/streams area:tools Tool system, builtin tools, subagents (ag2/tools) area:middleware Middleware system and builtins (ag2/middleware) area:eval Offline evaluation framework (ag2/eval) labels Oct 28, 2026
@Lancetnik
Lancetnik added this pull request to stack #3525 October 28, 2026 07:07
@Lancetnik
Lancetnik force-pushed the feat/subagent-eventbus-tests branch from b82b271 to 472b86e Compare October 28, 2026 20:01
@Lancetnik
Lancetnik force-pushed the feat/subagent-eventbus-tests branch from 472b86e to 482e700 Compare October 28, 2026 20:54
@github-actions github-actions Bot added area:ag-ui AG-UI integration (ag2/ag_ui) area:acp ACP support for CLI coding agents (ag2/acp) area:a2ui A2UI support (ag2/a2ui) area:network Agent network (ag2/network) labels Oct 28, 2026
@Lancetnik Lancetnik changed the title test: cover subagent event routing and consumer migrations feat: integrate subagent event trees with consumer migrations Oct 28, 2026
@Lancetnik
Lancetnik marked this pull request as ready for review October 28, 2026 21:05
@Lancetnik
Lancetnik force-pushed the feat/subagent-eventbus-tests branch from 482e700 to 5ce5853 Compare October 28, 2026 21:14
@github-actions github-actions Bot added the area:providers LLM provider clients and mappers (ag2/config) label Oct 29, 2026
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.03980% with 32 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ag2/tools/subagents/_forwarding.py 92.05% 7 Missing and 10 partials ⚠️
ag2/network/task_mirror.py 7.14% 13 Missing ⚠️
ag2/events/delegation.py 75.00% 1 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
ag2/a2ui/dispatch.py 100.00% <100.00%> (ø)
ag2/acp/executor.py 94.17% <100.00%> (-0.06%) ⬇️
ag2/ag_ui/stream.py 95.72% <100.00%> (+0.05%) ⬆️
ag2/agent.py 96.79% <100.00%> (-0.48%) ⬇️
ag2/context.py 97.80% <100.00%> (+0.10%) ⬆️
ag2/eval/sources/_spans.py 94.69% <100.00%> (+1.63%) ⬆️
ag2/eval/trace.py 100.00% <100.00%> (ø)
ag2/events/task_events.py 96.87% <100.00%> (+0.10%) ⬆️
ag2/events/types.py 94.49% <100.00%> (ø)
ag2/history.py 100.00% <100.00%> (ø)
... and 11 more

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

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

Labels

area:a2ui A2UI support (ag2/a2ui) area:acp ACP support for CLI coding agents (ag2/acp) area:ag-ui AG-UI integration (ag2/ag_ui) area:core Agent runtime core: ag2/*.py, ag2/events, ag2/response, ag2/streams area:eval Offline evaluation framework (ag2/eval) area:middleware Middleware system and builtins (ag2/middleware) area:network Agent network (ag2/network) area:providers LLM provider clients and mappers (ag2/config) area:tools Tool system, builtin tools, subagents (ag2/tools)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant