Skip to content

feat(delegate): per-task model/provider override in delegate_task tasks array#34773

Open
DJNing wants to merge 1 commit into
NousResearch:mainfrom
DJNing:feat/per-task-model-provider-override
Open

feat(delegate): per-task model/provider override in delegate_task tasks array#34773
DJNing wants to merge 1 commit into
NousResearch:mainfrom
DJNing:feat/per-task-model-provider-override

Conversation

@DJNing

@DJNing DJNing commented May 29, 2026

Copy link
Copy Markdown

Summary

Add optional model and provider fields to each item in the delegate_task tasks array, allowing different subagents in a batch to run on different models or providers.

Semantics

Override What happens
model only Sends a different model name to the existing delegation provider/endpoint
provider only Re-resolves the full credential bundle (base_url, api_key, api_mode) for that provider, uses its default model
Both Re-resolves provider creds + overrides the model name within it

Implementation

In tools/delegate_tool.py:

  1. Credential resolution (line ~1996): renamed single creds to default_creds to prepare for per-task resolution.
  2. Per-task resolution (line ~2058): when t["provider"] differs from the delegation default, calls _resolve_delegation_credentials() again with the overridden provider to get the full credential bundle. When only t["model"] is set, copies default creds and overrides the model name.
  3. Schema (line ~2759): added model and provider fields to the task item JSON schema.

No changes needed in AIAgent.__init__ or the agent loop — _build_child_agent already resolves effective_model = model or parent_agent.model.

Testing

  • ✅ All 152 existing delegate tests pass
  • ✅ Credential re-resolution tested for all 4 scenarios (default, model-only, provider-only, both)
  • ✅ Unknown provider raises clean ValueError listing available providers
  • ✅ End-to-end live test through delegate_task tool confirmed correct model/provider on spawned subagents:
    • glm-4.6v via zai → reported MODEL=glm-4.6v, PROVIDER=zai
    • deepseek-chat via deepseek → reported MODEL=deepseek-chat, PROVIDER=deepseek
  • ❌ Unknown model name passes through and fails at API level (consistent with main agent behavior)

Example usage

delegate_task(tasks=[
    {
        "goal": "Search arxiv for recent papers",
        "toolsets": ["web"],
        "model": "deepseek-chat",         # model override only
    },
    {
        "goal": "Summarize the results",
        "toolsets": ["terminal", "file"],
        "provider": "deepseek",            # full provider re-resolve
        "model": "deepseek-chat",          # + model within that provider
    },
])

Closes #34764

…ks array

Add optional 'model' and 'provider' fields to each item in the
delegate_task 'tasks' array.

- 'model' alone: sends a different model name to the default delegation
  provider/endpoint
- 'provider' alone: re-resolves the full credential bundle (base_url,
  api_key, api_mode) for that provider, using its default model
- Both: re-resolves provider creds + overrides the model name

Unknown providers raise a clean ValueError with available providers
listed. Model validation is deferred to the API (consistent with the
rest of Hermes — model names aren't validated at credential time).

Closes NousResearch#34764
@alt-glitch alt-glitch added type/feature New feature or request tool/delegate Subagent delegation P3 Low — cosmetic, nice to have labels May 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of the per-task model/provider override cluster. Tracking issue: #14974. Most comprehensive open implementation: #17756. Also competing: #20000, #23266, #32555, #34752.

Related issue filed by same feature request: #34764 (already triaged as duplicate of #15789).

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

Labels

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.

feat(delegate): per-task model/provider override in delegate_task tasks array

2 participants