feat(tools): add per-task routing to delegate_task#31537
Conversation
Add optional model, provider, and reasoning_effort fields to delegate_task for single-task and per-task batch routing. Resolve credentials per task only when routing overrides are present, preserve default credential caching, and apply reasoning precedence as task > config > parent. Also clean up partially built child agents if later task credential resolution fails before execution.
|
Thanks, agreed this area is saturated. I did a pass over the linked cluster plus the nearby PRs I could find. The tracking issue (#14974) has been open since Apr 24, and I count at least ten related open PRs/proposals in or near this space (#6771, #7201, #12794, #17718, #17756, #20000, #23266, #23649, #25530, #26736). Some of those date back to Apr 9, so this has effectively been sitting for a month+ with multiple candidate implementations and no obvious convergence. I don't want this PR to add to that churn. What this branch is trying to contribute as a possible consolidation candidate:
One intentional semantic choice here: in batch mode, top-level Happy to coordinate whichever direction maintainers prefer: keep this as a small consolidation candidate, port the tests/cleanup pieces into a chosen canonical PR, or close this if another implementation is selected. |
Allow individual tasks in the array to specify their own and/or , overriding the global delegation config for that task only. When a per-task override is present, is called with a task-scoped config so that base_url, api_key, and api_mode are derived correctly from the per-task provider — not the global delegation config. Tasks without overrides fall back to the pre-resolved dict as before (no regression for existing usage). Changes: - : add and fields to the per-task object inside array - loop: resolve per-task credentials when override is present; otherwise reuse global (zero overhead) Closes NousResearch#35437 Related: NousResearch#34489, NousResearch#31537, NousResearch#36790, NousResearch#30388, NousResearch#37966
Summary
model,provider, andreasoning_effortrouting fields todelegate_taskbatch items.run_agentdispatch and clean up partially built child agents when build-stage failures occur.Test plan
scripts/run_tests.sh tests/tools/test_delegate.py tests/agent/test_subagent_stop_hook.py tests/run_agent/test_interrupt_propagation.py tests/run_agent/test_real_interrupt_subagent.py— 164 passed.scripts/run_tests.sh tests/acp/test_auth.py— 10 passed after bootstrapping the wrapper-supported[all,dev]venv.scripts/run_tests.sh tests/run_agent/test_streaming.py tests/run_agent/test_stream_drop_logging.py tests/run_agent/test_session_id_env.py tests/tools/test_discord_tool.py— 143 passed after installing browser assets in the same hermeticHOMEused byscripts/run_tests.sh.scripts/run_tests.shfull suite was attempted locally. It still fails outside this change area in this container/profile environment, including Docker install-method detection, missingsystemctl/user-systemd assumptions, and tests that monkeypatchHERMES_HOMEto temp dirs and then hit browser lazy-install timeouts. The changed/adjacent delegate tests above are green; CI should be the source of truth for the full matrix.