hermes - 💡(How to fix) Fix feat: per-task model/provider overrides in delegate_task [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#15789Fetched 2026-04-26 05:25:03
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×3commented ×1

Code Example

{
    "goal": "Summarise this text",        # required (existing)
    "context": "...",                      # optional (existing)
    "toolsets": ["terminal", "file"],      # optional (existing)
    "model": "deepseek-v4-flash",         # NEW: per-task model override
    "provider": "ollama-cloud",           # NEW: per-task provider override
}

---

"model": {
    "type": "string",
    "description": "Per-task model override. Overrides delegation.model for this task only.",
},
"provider": {
    "type": "string",
    "description": "Per-task provider override (e.g. 'openrouter', 'ollama-cloud'). Overrides delegation.provider for this task only.",
},

---

model=creds["model"],           # single global delegation model
override_provider=creds["provider"],
override_base_url=creds["base_url"],
override_api_key=creds["api_key"],
override_api_mode=creds["api_mode"],
RAW_BUFFERClick to expand / collapse

Feature Request: Per-task model/provider overrides in delegate_task

Problem

delegate_task currently assigns all subagents the same model/provider pair, configured via delegation.model / delegation.provider in config.yaml. There is no way to route different sub-tasks to different models within a single delegation call.

This forces a trade-off: you either configure the delegation model for expensive high-quality work (and waste tokens on trivial summaries), or for cheap/fast work (and get poor results on complex analysis). There's no middle ground without making multiple delegation calls and manually switching config between them.

Use Cases

  1. Mixed-cost batch processing — One subagent does a cheap text summarisation (deepseek-v4-flash), a second does code review (gpt-5.5), a third does a web research task (gemma4). All in one delegate_task call.

  2. Smart routing with cheap fallbacks — The main delegation config defaults to the expensive model, but individual task items can override down to a cheaper one when the task is trivial.

  3. Provider diversity — Some tasks need OpenRouter-specific models, others need Anthropic or Ollama Cloud. Per-task provider override enables this.

Proposed API

Add two optional fields to each task item in the tasks array:

{
    "goal": "Summarise this text",        # required (existing)
    "context": "...",                      # optional (existing)
    "toolsets": ["terminal", "file"],      # optional (existing)
    "model": "deepseek-v4-flash",         # NEW: per-task model override
    "provider": "ollama-cloud",           # NEW: per-task provider override
}

And corresponding optional top-level parameters for the single-task mode.

Implementation Sketch

The change is localised to tools/delegate_tool.py:

1. Schema (DELEGATE_TASK_SCHEMA)

Add "model" and "provider" to the task item properties (lines ~2090-2114):

"model": {
    "type": "string",
    "description": "Per-task model override. Overrides delegation.model for this task only.",
},
"provider": {
    "type": "string",
    "description": "Per-task provider override (e.g. 'openrouter', 'ollama-cloud'). Overrides delegation.provider for this task only.",
},

Also add top-level model and provider to the main properties block for parity in single-task mode.

2. Credential resolution in delegate_task() (lines ~1625-1655)

Currently each child is built with:

model=creds["model"],           # single global delegation model
override_provider=creds["provider"],
override_base_url=creds["base_url"],
override_api_key=creds["api_key"],
override_api_mode=creds["api_mode"],

When a per-task model or provider is present, it should resolve fresh credentials for that specific child instead of using the global delegation config. This could work as:

  • If per-task provider is set → resolve full credentials for that provider (using resolve_runtime_provider or the provider system)
  • If only per-task model is set → use same provider as delegation config, but with the overridden model name
  • If neither is set → existing behaviour (use delegation config)

3. _resolve_delegation_credentials() (line ~1885)

This function could be extended or a new helper created that resolves credentials for a given (model, provider) pair, reusing the same resolve_runtime_provider mechanism already in use.

Backward Compatibility

Fully backward compatible. Both new fields are optional. The "required": ["goal"] constraint on task items stays unchanged. When neither model nor provider is specified on a task, behaviour is identical to current releases.

Why Not Just Use Multiple delegate_task Calls?

You can already do this manually, but it's cumbersome:

  • You'd need to track results across calls
  • You lose the unified spinner/progress display
  • The parallelism is capped by what you can manually schedule
  • It requires the calling agent to know about model routing strategy explicitly

Per-task model routing lets the agent itself decide which model suits each subtask, keeping the parent context clean.

extent analysis

TL;DR

To implement per-task model/provider overrides in delegate_task, add optional model and provider fields to each task item and update the credential resolution logic in delegate_task().

Guidance

  • Update the DELEGATE_TASK_SCHEMA to include model and provider fields in the task item properties.
  • Modify the delegate_task() function to resolve fresh credentials for each task based on the per-task model and provider overrides.
  • Create a new helper function or extend _resolve_delegation_credentials() to resolve credentials for a given (model, provider) pair.
  • Ensure backward compatibility by keeping the new fields optional and maintaining the existing behavior when neither model nor provider is specified.

Example

# Updated task item with per-task model override
{
    "goal": "Summarise this text",
    "context": "...",
    "toolsets": ["terminal", "file"],
    "model": "deepseek-v4-flash"
}

# Updated delegate_task() function
def delegate_task(...):
    # ...
    for task in tasks:
        if "model" in task or "provider" in task:
            # Resolve fresh credentials for the task
            model = task.get("model", creds["model"])
            provider = task.get("provider", creds["provider"])
            # ...

Notes

The proposed implementation requires updates to the delegate_tool.py file and may involve changes to the credential resolution mechanism. It is essential to ensure that the new functionality is fully backward compatible and does not introduce any breaking changes.

Recommendation

Apply the proposed changes to implement per-task model/provider overrides, as this will provide the required flexibility and improve the overall functionality of the delegate_task feature.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix feat: per-task model/provider overrides in delegate_task [1 comments, 2 participants]