Skip to content

feat(agent): configure subagent roles and model bindings - #576

Open
changer-changer wants to merge 4 commits into
OpenBMB:mainfrom
changer-changer:feat/subagent-model-selection
Open

changer-changer wants to merge 4 commits into
OpenBMB:mainfrom
changer-changer:feat/subagent-model-selection

Conversation

@changer-changer

@changer-changer changer-changer commented Sep 12, 2026

Copy link
Copy Markdown

Summary

Subagent types currently have fixed descriptions and tool presets, while a shared default or automatic routing determines their models. A parent cannot select a user-configured role such as visual inspection or careful review and reliably get the model and input capabilities intended for that role.

Add Settings → Agents → Subagents for built-in and custom roles: description, model binding, tool allowlist, read-only/enabled state, and maximum delegation depth. The parent selects subagent_type by description; the runtime applies the user's model binding. The settings preview and model-facing role catalog share the same formatter. Model names are not added to the catalog.

  • Store overrides under agent.subagents.profiles; retain existing defaults and automatic routing for unbound roles. A bound model stays selected across child tool turns with its own token limits and input capabilities. Invalid bindings fail visibly.
  • Allow nested delegation through the existing agent tool when permitted by the parent's tools and maxDepth (default 1, supported range 0–5). Enforce depth, inherited read-only restrictions and cancellation at runtime; forward descendant activity to the root while preserving transcript parentage.
  • Preserve registered attachment read grants in children and start their read cache empty, so an image/text file already read by the parent is still available to a child that receives only the directive.
  • Validate profiles through the shared parser in the runtime and settings API, and track profile model bindings when providers/models are renamed.
  • Keep internal subagent tracing identifiers out of OpenAI-compatible request metadata. Caller-supplied metadata is preserved. This avoids sending an unsupported metadata field on otherwise ordinary child requests.

Uses PilotDeck's existing synchronous child sessions. task_id restoration and background task management are outside this change. No new dependencies. Configuration and examples: docs/subagent-model-selection.md.

Validation

  • Gateway and Web UI builds passed.
  • Web Regression suite using the repository's existing exclusions: 193 files / 1,576 tests passed (local concurrency limited to 2).
  • Focused runtime/config/tool/request tests: 66 passed. Settings UI/helpers/navigation: 47 passed. Config API/routes: 100 passed. These overlap the larger suites.
  • Full backend suite: 563 passed, 0 failed, 2 skipped, 7 cancelled. The same seven tests/network/fetch.spec.ts cases cancel on the unchanged baseline with Promise resolution is still pending but the event loop has already resolved; no network-test changes are included.
  • UI typecheck has 497 existing diagnostics on both the previous head and this change; normalized file/message comparison shows no added diagnostics. Unrestricted Vitest also reproduces the baseline's excluded failures; it is not claimed as passing.
  • Browser verification in an isolated instance: add/edit/save/reload, model and tool persistence, disable/catalog hiding, deletion, clean state after save, and English/Chinese layouts. With its separate Gateway connected, saving profiles/depth triggers runtime configuration reload.
  • Live GLM experiment through the actual parent/child tool loop: 6/6 description-matched choices across vision, review and routine extraction, including renamed opaque role IDs. A text-only parent also independently delegated a natural image task to the configured Flash vision role; the child received the image and returned the correct visible code and shape counts. The short review/extraction tasks could instead be completed by the parent. These are small smoke tests, not evidence of general quality or speed improvement.

Remote workflow approval and maintainer review remain separate from these local results.


补充背景:我是面壁智能黑客松参赛者,此前与团队成员交流时了解到这方面的使用需求,因此尝试补上实现,供团队评审。


Merge sequencing (added 2026-09-14)

This PR is one of four coordinated subagent-lifecycle PRs (#579, #576, #580, #581). The features are semantically independent but overlap textually in the agent core, so an explicit merge order is proposed in #583.

Proposed order: #579#576#580#581 (this PR: 2).

This branch's known conflicts: clean against current main; 1 UI file with #579, 4 core files with #580 (AgentLoop.ts, SubAgentSession.ts, agent.ts, tool/protocol/types.ts), 3 core files with #581.

After each sibling PR merges, I will rebase the remaining branches onto main and re-run the targeted test suites before updating the PRs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant