Skip to content

[Feature]: Allow delegate_task to accept provider/model parameters #5012

@MarcoLeongDev

Description

@MarcoLeongDev

Problem or Use Case

Current Behavior:
The delegate_task tool schema includes provider and model parameters, but these are ignored in the handler implementation (tools/delegate_tool.py lines 403~581). Subagents always use the provider/model configured in ~/.hermes/config.yaml under the delegation: section.

Current function signature:

def delegate_task(
    goal: Optional[str] = None,
    context: Optional[str] = None,
    toolsets: Optional[List[str]] = None,
    tasks: Optional[List[Dict[str, Any]]] = None,
    max_iterations: Optional[int] = None,
    parent_agent=None,
) -> str:

Desired Behavior:
Allow the provider and model parameters in delegate_task to override the global delegation configuration for that specific subagent call. This would enable:

  • Orchestrators to spawn specialized subagents, i.e., vision models for image tasks, coding models for development, reasoning models for logic
  • Per-task provider/model selection without changing global config
  • Better resource utilization, i.e. use lower capacity model for small task, premium model for complex

Use Cases:

  1. Vision tasks: Spawn subagent with vision capability (e.g. qwen/qwen2.5-vl-72b-instruct:free) for image analysis
  2. Voice tasks: Use audio-optimized models for speech processing
  3. Mathematics/Logic: Deploy reasoning-capable models for problem-solving
  4. Language tasks: Use multilingual or language-specialized models (e.g. multilingual for translation )
  5. Cost optimization: Route simple tasks to cheaper/free models, complex tasks to premium models

Implementation Approach:
Modify the delegate_task handler in tools/delegate_tool.py to:

  1. Extract provider and model from args if provided
  2. Pass these to the _resolve_delegation_credentials() function (or equivalent)
  3. Allow parameter-provided values to override config.yaml delegation settings
  4. Maintain backward compatibility (when not provided, fallback to config.yaml)

Related Code:

  • tools/delegate_tool.py: Handler function (lines 403~581)
  • _resolve_delegation_credentials() function (lines ~583)
  • Tool schema definition for delegate_task

This would transform delegation from a "one-size-fits-all" approach to a flexible per-task provider/model selection system while maintaining the existing config-based approach as fallback.

Proposed Solution

Propose function signature:

def delegate_task(
    goal: Optional[str] = None,
    context: Optional[str] = None,
    toolsets: Optional[List[str]] = None,
    tasks: Optional[List[Dict[str, Any]]] = None,
    max_iterations: Optional[int] = None,
    provider: Optional[str] = None,        # Allow provider 
    model: Optional[str] = None,           # Allow model
    parent_agent=None,
) -> str:

As mentioned, the source of this information can be from:

  • .env
  • config.yaml
  • agent's decision upon delegation (according to config.yaml)

The actual logistic of the source needs further discussion. I don't mind looking into this, yet, I would prefer being pointed to the right direction for best efficiency

Alternatives Considered

No response

Feature Type

Configuration option

Scope

None

Contribution

  • I'd like to implement this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions