Skip to content

feat(delegation): add named delegate_task profiles - #44412

Closed
alfredomtx wants to merge 1 commit into
NousResearch:mainfrom
alfredomtx:feat/delegate-task-profiles
Closed

alfredomtx wants to merge 1 commit into
NousResearch:mainfrom
alfredomtx:feat/delegate-task-profiles

Conversation

@alfredomtx

Copy link
Copy Markdown

Summary

  • add named delegation.profiles config for reusable subagent routing lanes
  • let delegate_task accept a top-level profile and per-task batch profile
  • merge profile config over root delegation config before resolving child credentials/toolsets
  • validate unknown or malformed profiles before spawning any child agents
  • keep max_iterations config/profile-authoritative and out of the model schema

Why

Advanced users often want different subagent lanes for discovery, coding, review, and research. Today that requires repeating provider/model/reasoning/toolset settings every time, or hardcoding local behavior. Named profiles make the existing delegate_task tool configurable without adding another core tool.

Default behavior is unchanged when delegation.profiles is empty or no profile is passed.

Tests

  • python -m pytest tests/tools/test_delegate.py -q -k 'profile or schema_valid or runtime_limits or schema_overrides'

Notes:

  • Full tests/tools/test_delegate.py currently hits an unrelated timing-flaky heartbeat assertion on upstream/main as well. I confirmed the same failure on a clean upstream/main worktree; the profile-specific tests pass.
  • Independent dual review found no blocking issues.

@alfredomtx
alfredomtx force-pushed the feat/delegate-task-profiles branch from fc4c522 to bb0642b Compare June 11, 2026 18:08
@liuhao1024

Copy link
Copy Markdown
Contributor

Verified the delegation profile implementation — clean and well-structured. Specific checks applied:

  1. Profile merge semantics (_merge_delegation_profile): None values in a profile are correctly treated as "don't override" (skip), while non-None values (including empty strings) override the base config. This allows profiles to intentionally clear inherited values.

  2. Fail-fast validation: Unknown profile names raise ValueError before any child agent is constructed. The error message lists known profiles, which is a nice UX touch. No zombie children left behind on validation failure.

  3. Per-task credential resolution: _resolve_delegation_credentials is now called per-task with the profile-merged config (task_cfg), not once globally. This is correct — different profiles may specify different providers/models requiring different credentials.

  4. Backward compatibility: _build_child_agent's new delegation_cfg parameter defaults to None and falls back to _load_config() when unset. Direct callers (tests, internal code paths) that don't pass it continue to work unchanged.

  5. Type guard on parent_enabled: The added isinstance(parent_enabled_raw, (list, tuple, set, frozenset)) check is a defensive improvement over the bare truthiness check — prevents a non-collection truthy value (e.g., a string) from silently passing through.

  6. Service tier handling: _parse_service_tier_config maps "fast"/"priority"/"on""priority" and ignores unknown values with a warning. The resolve_fast_mode_overrides import is wrapped in a broad except Exception for forward-compatibility. Clean.

Good test coverage across single-task profile, batch multi-profile, and unknown-profile error paths.

@alt-glitch alt-glitch added type/feature New feature or request tool/delegate Subagent delegation comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 11, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

Duplicate of #7201 — named delegate_task profiles is a saturated cluster (#9459): #7201/#4929/#34754/#41998/#18522 all implement it. #7201 is the earliest open; the more comprehensive recent entries are #41998/#34754.

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have tool/delegate Subagent delegation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants