Skip to content

feat: per-call model/provider override on delegate_task - #3734

Closed
HenkDz wants to merge 2 commits into
NousResearch:mainfrom
HenkDz:feat/delegate-per-call-model
Closed

feat: per-call model/provider override on delegate_task#3734
HenkDz wants to merge 2 commits into
NousResearch:mainfrom
HenkDz:feat/delegate-per-call-model

Conversation

@HenkDz

@HenkDz HenkDz commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Closes #3719

Summary

Add model and provider parameters to delegate_task (top-level and per-task in batch mode) so the parent agent can dynamically route subagents to different models based on task type.

Motivation

Currently subagent model selection is static via delegation.model/delegation.provider in config.yaml — all subagents use the same model. Different tasks benefit from different models (code → fast model, research → strong reasoning model).

Changes

tools/delegate_tool.py (136 insertions, 34 deletions)

  1. Schema: Added model and provider as top-level params + inside batch task items
  2. _resolve_call_credentials(): New helper that merges per-call overrides with config-level credentials via resolve_runtime_provider()
  3. delegate_task(): Refactored to resolve credentials per-task instead of once globally. Top-level model/provider flow into single-task mode; batch mode uses each task's own overrides
  4. Registry handler: Wires model/provider through the lambda

Resolution Priority

per-call model/provider  →  config delegation.model/provider  →  inherit parent

Fully backward compatible — omitting model/provider preserves existing behavior.

Example Usage

Single task:

delegate_task({
  "goal": "Implement auth middleware",
  "model": "glm-5.1",
  "provider": "zai"
})

Batch with per-task routing:

delegate_task({
  "tasks": [
    {"goal": "Research competitors", "model": "glm-5", "provider": "zai"},
    {"goal": "Write integration tests", "model": "glm-5.1"}
  ]
})

henkey added 2 commits March 29, 2026 16:33
…#3719)

Add model and provider parameters to delegate_task tool schema (both
top-level and per-task in batch mode) so the parent agent can dynamically
route subagents to different models based on task type.

Resolution priority: per-call -> config delegation.* -> parent inherit.

Changes:
- Add model/provider to DELEGATE_TASK_SCHEMA (top-level + batch items)
- Add _resolve_call_credentials() helper that merges per-call overrides
  with config-level credentials
- Refactor delegate_task() to resolve credentials per-task instead of
  once globally
- Wire model/provider through handler lambda

Backward compatible: omitting model/provider preserves existing behavior.
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.

Feature: Per-call model/provider override on delegate_task

2 participants