feat(agent): architecture router — task-decomposability-based selector (#1139) - #1160
Merged
Merged
Conversation
#1139) Adds an orchestrator router that classifies each task on two axes (decomposability + tool density, plus sequentiality) and recommends the optimal execution architecture, following Google's agent-scaling study (arXiv:2512.08296): parallelizable tasks favor a centralized orchestrator; sequential tasks are penalized by multi-agent overhead; independent parallel agents amplify errors. - agent/architecture_router.py: * classify_task() — heuristic decomposability / tool-density / sequentiality scoring with a confidence signal. * route() — decision table (single_agent / centralized_orchestrator / plan_and_execute) + guardrails: low confidence -> single-agent; workers capped to contain error amplification (Google: 17.2x -> 4.4x). * RouterTelemetry — bounded log of decisions + outcomes (the calibration dataset the issue asks for). * config + lazy load via load_config_readonly. - conversation_loop._run_conversation_impl: config-gated pre-flight records the recommended architecture on agent._architecture_route + telemetry WITHOUT changing turn execution (observation-only). OFF by default -> pure no-op. Tests: full unit coverage (classifier, decision table for 3 task types, guardrails, telemetry) + executable-seam runtime tests driving the real run_conversation loop (off / parallelizable->orchestrator / sequential->plan).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1139. Adds an orchestrator router following Google's agent-scaling study (arXiv:2512.08296).
How
agent/architecture_router.pyclassify_task()— heuristic scoring of decomposability / tool density / sequentiality with a confidence signal.route()— decision table (single_agent/centralized_orchestrator/plan_and_execute) + guardrails: low classifier confidence → single-agent; workers capped to contain the error amplification the study documents (17.2× independent-parallel → 4.4× centralized).RouterTelemetry— bounded log of decisions + outcomes (the calibration dataset the issue asks for).conversation_loop._run_conversation_impl— a config-gated pre-flight records the recommended architecture onagent._architecture_route+ telemetry in the real turn loop.Safety / no-regression
architecture_router.enabled, documented incli-config.yaml.example). It logs a recommendation for calibration; it does not change how the turn executes (acting on it is a documented follow-up). When off the pre-flight sets_architecture_route = Noneand does nothing else. Never raises.run_conversationloop (off records nothing / parallelizable task → centralized orchestrator + telemetry / sequential task → plan-and-execute, single worker).Tests
tests/agent/test_architecture_router.py— classifier, decision table across 3 task types, confidence/worker-cap guardrails, telemetry.tests/run_agent/test_architecture_router_runtime.py— executable-seam runtime tests.Note: the research cycle §1 states all 7 other recommendations were already covered by existing issues; this closes the routing-decision-layer gap.