Skip to content

feat(tools): add delegation model pool with per-call model/provider override#5229

Closed
HenkDz wants to merge 1 commit into
NousResearch:mainfrom
HenkDz:feat/delegate-model-provider
Closed

feat(tools): add delegation model pool with per-call model/provider override#5229
HenkDz wants to merge 1 commit into
NousResearch:mainfrom
HenkDz:feat/delegate-model-provider

Conversation

@HenkDz

@HenkDz HenkDz commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Add intelligent model routing for subagent delegation via a configurable model pool and per-call overrides.

Problem: Users with access to multiple models/providers (e.g. via OpenRouter or Z.AI) had no way to control which model a subagent uses at call time.

Solution:

  1. Delegation model pool (delegation.pool): Users define a list of models with strengths. The pool is injected into the delegate_task tool description, so the LLM sees available models and picks the best fit automatically.

  2. Per-call overrides: model and provider params on delegate_task for explicit routing. Per-task model field in batch mode.

  3. Pool validation: If a model is set but not in the pool, falls back to default with a warning.

Changes

  • tools/delegate_tool.py: Dynamic schema builder, pool validation, per-task model support
  • hermes_cli/config.py: Add pool to DEFAULT_CONFIG
  • cli-config.yaml.example: Document pool configuration
  • website/docs/user-guide/configuration.md: Add Delegation Model Pool section

Model resolution (highest to lowest)

  1. Per-call model param
  2. Per-task model field (batch mode)
  3. Pool validation (falls back with warning if not in pool)
  4. delegation.model from config
  5. Parent agent's model (inherited)

Test plan

  • Pool models appear in delegate_task tool description
  • Subagent spawns with pool-selected model
  • Per-call model/provider override takes precedence
  • Per-task model in batch mode
  • Pool validation warning for unknown models
  • Backward compatible when pool is empty/unset

@HenkDz HenkDz force-pushed the feat/delegate-model-provider branch from 393f343 to c2ffc7f Compare April 5, 2026 13:27
@HenkDz HenkDz changed the title feat(tools): add per-call model/provider override on delegate_task feat(tools): add delegation model pool with per-call model/provider override Apr 5, 2026
…verride

Add intelligent model routing for subagent delegation via a configurable
model pool and per-call overrides.

- delegation.pool: users define models with strengths, injected into
  delegate_task schema so the LLM picks the best model per task
- model param: per-call or per-task (batch mode) model override
- provider param: per-call provider override with full credential resolution
- Pool validation: if a model is set but not in pool, falls back with warning
- Dynamic schema: _build_delegate_schema() reads pool from config at load time

Resolution order (highest to lowest):
  1. Per-call model param (top-level, applies to all tasks)
  2. Per-task model field (batch mode only)
  3. Pool validation — if model set but not in pool, falls back with warning
  4. delegation.model from config (fallback default)
  5. Parent agent's model (inherited)

Supersedes NousResearch#3794 (clean rebase on latest main).
@HenkDz HenkDz force-pushed the feat/delegate-model-provider branch from c2ffc7f to e38deec Compare April 5, 2026 14:10
@trevorgordon981

Copy link
Copy Markdown

Pool + per-call override layering looks clean, and the 5-level resolution hierarchy is explicit. One question: does the dynamic schema builder regenerate the delegate_task tool description every turn, or is it cached? If it's turn-rebuilt, that's another prompt-cache bust vector to watch. Proceed once that's confirmed.

@HenkDz

HenkDz commented Apr 5, 2026

Copy link
Copy Markdown
Contributor Author

Pool + per-call override layering looks clean, and the 5-level resolution hierarchy is explicit. One question: does the dynamic schema builder regenerate the delegate_task tool description every turn, or is it cached? If it's turn-rebuilt, that's another prompt-cache bust vector to watch. Proceed once that's confirmed.

cached,
DELEGATE_TASK_SCHEMA = _build_delegate_schema() is a module-level assignment. It runs once when tools/delegate_tool.py is imported, then the static dict is registered with the tool registry. The schema doesn't regenerate per turn.

The only way it would rebuild is if you changed your config and restarted hermes, which is expected behavior anyway.

MestreY0d4-Uninter pushed a commit to MestreY0d4-Uninter/hermes-agent that referenced this pull request Apr 13, 2026
… reasoning_effort

Unified implementation combining tier profiles (from stale PR NousResearch#5692)
with model pool validation (inspired by PR NousResearch#5229).

Features:
- 5 named tiers: light, heavy, review, planning, research
- Each tier configures model, provider, reasoning_effort, max_iterations
- Reasoning floor guardrails prevent silent degradation:
  heavy/research >= medium, planning/review >= high
- Per-task tier in batch mode overrides top-level tier
- Optional delegation pool for model validation
- override_reasoning_effort in _build_child_agent
- resolve_tier_config() merges tier over flat base config
- Schema updated with tier enum at top-level and per-task

Resolution order:
  task.tier > top-level tier > default_tier > flat config > parent

Config example:
  delegation:
    default_tier: heavy
    tiers:
      light:   {model: gpt-5.4-mini, reasoning_effort: low, max_iterations: 25}
      review:  {model: gpt-5.4, reasoning_effort: xhigh, max_iterations: 60}
    pool:
      - model: gpt-5.4, strengths: coding, debugging

Tests:
- 56 new unit tests (test_delegate_tiers.py)
- 7 real integration tests (test_delegate_tiers_real.py)
- 128 total delegate tests passing
- Backward compatibility verified (flat configs work unchanged)
MestreY0d4-Uninter added a commit to MestreY0d4-Uninter/hermes-agent that referenced this pull request Apr 14, 2026
… reasoning_effort

Unified implementation combining tier profiles (from stale PR NousResearch#5692)
with model pool validation (inspired by PR NousResearch#5229).

Features:
- 5 named tiers: light, heavy, review, planning, research
- Each tier configures model, provider, reasoning_effort, max_iterations
- Reasoning floor guardrails prevent silent degradation:
  heavy/research >= medium, planning/review >= high
- Per-task tier in batch mode overrides top-level tier
- Optional delegation pool for model validation
- override_reasoning_effort in _build_child_agent
- resolve_tier_config() merges tier over flat base config
- Schema updated with tier enum at top-level and per-task

Resolution order:
  task.tier > top-level tier > default_tier > flat config > parent

Config example:
  delegation:
    default_tier: heavy
    tiers:
      light:   {model: gpt-5.4-mini, reasoning_effort: low, max_iterations: 25}
      review:  {model: gpt-5.4, reasoning_effort: xhigh, max_iterations: 60}
    pool:
      - model: gpt-5.4, strengths: coding, debugging

Tests:
- 56 new unit tests (test_delegate_tiers.py)
- 7 real integration tests (test_delegate_tiers_real.py)
- 128 total delegate tests passing
- Backward compatibility verified (flat configs work unchanged)
@HenkDz HenkDz closed this Apr 15, 2026
@HenkDz HenkDz deleted the feat/delegate-model-provider branch April 15, 2026 21:20
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.

2 participants