Skip to content

feat(delegate_task): add per-task model/provider override#39282

Open
agt-user wants to merge 1 commit into
NousResearch:mainfrom
agt-user:feat/delegate-task-per-task-model-override
Open

feat(delegate_task): add per-task model/provider override#39282
agt-user wants to merge 1 commit into
NousResearch:mainfrom
agt-user:feat/delegate-task-per-task-model-override

Conversation

@agt-user

@agt-user agt-user commented Jun 4, 2026

Copy link
Copy Markdown

Summary

Add per-task model and provider fields to the tasks array in delegate_task, enabling different tasks in the same batch call to run on different models and providers.

Problem

Currently all tasks in a delegate_task call share the same model (resolved once from delegation.* config or inherited from parent). There's no way to route a lightweight task to haiku while a reasoning-heavy task uses opus in the same batch.

Tracked in #35437 (consolidating #5012, #10995, #17685, #23467, #32711). This implementation takes the minimal approach.

Solution

Two targeted changes, zero regressions:

1. Schema

Added model and provider as optional fields to each task object in the tasks array.

2. Loop logic

When a task specifies model or provider, _resolve_delegation_credentials is called with a task-scoped config so base_url, api_key, and api_mode are derived correctly from the per-task provider. Tasks without overrides reuse the pre-resolved creds dict (no overhead for existing callers).

Why re-resolve via _resolve_delegation_credentials?

Passing only model without re-resolving credentials would silently break cross-provider overrides — e.g. provider: "nvidia" needs the NVIDIA base_url and API key, not just a model name swap. Re-resolving per-task ensures the full credential bundle is correct.

Usage example

delegate_task(tasks=[
    {
        "goal": "Summarize this document",
        "model": "claude-haiku-4-5",
        "provider": "anthropic",
        "toolsets": ["file"]
    },
    {
        "goal": "Design the system architecture",
        "model": "claude-opus-4-5",
        "provider": "anthropic",
        "toolsets": ["web", "file"]
    }
])

Testing

  • Schema import confirms model and provider appear in task properties
  • Existing callers omitting the new fields hit the task_creds = creds path (no change)
  • Lint: clean

Closes #35437

@alt-glitch alt-glitch added type/feature New feature or request tool/delegate Subagent delegation P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 4, 2026
Allow individual tasks in the  array to specify their own
 and/or , overriding the global delegation config
for that task only.

When a per-task override is present,
is called with a task-scoped config so that base_url, api_key, and
api_mode are derived correctly from the per-task provider — not the
global delegation config. Tasks without overrides fall back to the
pre-resolved  dict as before (no regression for existing usage).

Changes:
- : add  and  fields to the
  per-task object inside  array
-  loop: resolve per-task credentials when override
  is present; otherwise reuse global  (zero overhead)

Closes NousResearch#35437
Related: NousResearch#34489, NousResearch#31537, NousResearch#36790, NousResearch#30388, NousResearch#37966
@agt-user agt-user force-pushed the feat/delegate-task-per-task-model-override branch from 6669309 to e7c78c9 Compare June 9, 2026 08:26
@agt-user

agt-user commented Jun 9, 2026

Copy link
Copy Markdown
Author

Hi — just rebased this onto latest main.

I noticed the duplicate label was added. Could you clarify which PR or commit this is considered a duplicate of? If there is an alternative implementation planned or already merged, happy to close this out. Otherwise, would appreciate a review when bandwidth allows. Thanks!

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

Labels

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.

feat: add model/provider/base_url/api_format parameters to delegate_task (consolidating #5012, #10995, #17685, #23467, #32711)

2 participants