Skip to content

feat(tools): add per-call model/provider/profile overrides to delegate_task - #64988

Closed
luluthehungrycat wants to merge 2 commits into
NousResearch:mainfrom
luluthehungrycat:feat/delegate-task-model-override-v2
Closed

luluthehungrycat wants to merge 2 commits into
NousResearch:mainfrom
luluthehungrycat:feat/delegate-task-model-override-v2

Conversation

@luluthehungrycat

@luluthehungrycat luluthehungrycat commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • Adds three new optional parameters (model, provider, profile) to the delegate_task tool
  • Allows the model (or a Python caller) to spawn a subagent with a specific model, provider, and profile
  • New _resolve_per_call_credentials() function reads the specified profile's .env and config.yaml

Motivation

delegate_task previously inherited the parent agent's model and provider with no way to override per-call. This change makes model-aware routing a first-class capability of the delegation framework.

Changes

  • delegate_task() signature: added model, provider, profile optional parameters
  • Credential injection: when model is set, _resolve_per_call_credentials() overrides the resolved credentials dict
  • New _resolve_per_call_credentials(model, provider=None, profile=None) — reads the target profile's .env and config.yaml. When provider is omitted, returns a model-only override (child inherits parent's provider/credentials). When profile is omitted, uses the active profile's directories.
  • Schema: added model, provider, profile as optional string properties in DELEGATE_TASK_SCHEMA
  • Registry handler: pipes the new args through to delegate_task()
  • Tests: 8 new unit tests in TestPerCallCredentialOverride covering model-only, model+provider, nonexistent profile fallback, empty model string, credential dict shape, and schema exposure

Test Plan

  • Unit tests pass: python -m pytest tests/tools/test_delegate.py::TestPerCallCredentialOverride -v — 8/8 pass
  • Manual verification: delegate_task(goal="...", model="deepseek-v4-flash", provider="opencode-go", profile="coder") spawns subagent on the specified model
  • Manual verification: model-only override (no provider) inherits parent's provider
  • Existing delegation tests pass: scripts/run_tests.sh

Notes for Reviewers

  • Zero regression risk when model is omitted — existing delegation config path unchanged
  • Provider is NOT defaulted (when omitted, child inherits parent's provider/credentials)
  • Profile is NOT defaulted (when omitted, uses the active profile's directories)
  • No new dependencies, no config changes required
  • Related: PR feat(delegation): load optional profile persona #64975 (deanjo) adds profile for SOUL.md persona loading — complementary
  • Review feedback from luluthehermeticcrabBot's Mistral Vibe session incorporated: removed hardcoded defaults, added 8 unit tests, added docstring examples

…e_task

Adds three new optional parameters to the delegate_task tool that let
the model (or a human caller) override the model, provider, and profile
used for subagents on a per-call basis.

- model: specify which model the subagent should use
- provider: specify which provider serves the model (required with model)
- profile: specify which Hermes profile's credentials to resolve from

When model is provided, _resolve_per_call_credentials() reads the
specified profile's .env and config.yaml to resolve the API key, base
URL, and API mode — bypassing the delegation config block entirely.
When model is omitted, the existing delegation config path is used
unchanged.

The new fields are exposed in the tool schema so the model sees them,
and threaded through the registry handler into the delegate_task()
function signature.
@alt-glitch alt-glitch added type/feature New feature or request tool/delegate Subagent delegation P3 Low — cosmetic, nice to have labels Jul 15, 2026
…e_task

Adds three new optional parameters (model, provider, profile) to the
delegate_task tool that let the model override the model, provider, and
profile used for subagents on a per-call basis.

- model: specify which model the subagent should use
- provider: optional — when omitted, child inherits parent's provider
  and credentials (model-only override)
- profile: optional — when omitted, uses active profile's directories

When model is provided, _resolve_per_call_credentials() reads the
specified profile's .env and config.yaml to resolve the API key, base
URL, and API mode, bypassing the delegation config block entirely.
When model is omitted, the existing delegation config path is unchanged.

Includes 6 unit tests covering: model-only override (no provider),
model+provider resolution, credential dict shape compatibility,
signature acceptance, and schema field exposure.
@luluthehermeticcrabBot
luluthehermeticcrabBot force-pushed the feat/delegate-task-model-override-v2 branch from 06d08cf to ba11850 Compare July 15, 2026 13:25
@luluthehungrycat

Copy link
Copy Markdown
Author

Superseded by v3 branch — see new PR for updated implementation addressing OpenCode review feedback.

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.

2 participants