Skip to content

feat(delegate): add per-call model/provider/base_url overrides#17756

Open
mddragon18 wants to merge 1 commit into
NousResearch:mainfrom
mddragon18:jarvis-dev
Open

feat(delegate): add per-call model/provider/base_url overrides#17756
mddragon18 wants to merge 1 commit into
NousResearch:mainfrom
mddragon18:jarvis-dev

Conversation

@mddragon18

@mddragon18 mddragon18 commented Apr 30, 2026

Copy link
Copy Markdown

Summary

Add model, provider, and base_url parameters to delegate_task, allowing per-call overrides for subagents — both at the top level and per-task in batch mode. api_key is kept in the code path (works via delegation.api_key config) but excluded from the schema for security.

Changes

tools/delegate_tool.py:

  • Extended delegate_task() function signature with model, provider, base_url params
  • Added fields to DELEGATE_TASK_SCHEMA at top-level and per-task — api_key excluded from schema to prevent LLM secret leakage
  • Credential resolution happens per-child: per-task > top-level per-call > delegation config > parent inherit
  • All pre-existing code preserved (cost rollup, ACP transport safety, ACP override clearing)

tests/tools/test_delegate.py:

  • Updated test_schema_valid to assert new fields
  • Added test_per_call_model_override

Security

api_key is NOT exposed to the model via the schema. The code path still supports it internally — set via delegation.api_key in config.yaml — but the LLM cannot inject or read it through tool calls.

Example

# Single task with model override
delegate_task(goal="Do X", model="gemini-flash-latest", provider="google")

# Batch with per-task overrides
delegate_task(tasks=[
    {"goal": "Research", "model": "fast-model"},
    {"goal": "Analyze", "model": "reasoning-model", "provider": "openrouter"},
])

Verification

  • All 121 delegate tests pass

Loading
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.

4 participants