Skip to content

Allow configurable subagent model in config.yaml #609

@teknium1

Description

@teknium1

Summary

Allow users to configure a dedicated provider + model for subagents (the delegate_task tool) via config.yaml, following the same pattern used by compression.summary_model and the TTS model configs.

Motivation

Currently, subagents always inherit the parent agent's model (delegate_tool.py line 204):

child = AIAgent(
    ...
    model=model or parent_agent.model,
    provider=getattr(parent_agent, "provider", None),
    ...
)

There is no way for users to configure a different (potentially cheaper/faster) model for subagent tasks without the parent agent explicitly passing it per-call. Common use cases:

  • Cost savings: Run the main agent on a powerful model (e.g., anthropic/claude-sonnet-4) but delegate subtasks to a cheaper model (e.g., google/gemini-3-flash-preview)
  • Speed: Subagent tasks are often narrowly scoped and don't need the full reasoning power of the primary model
  • Provider flexibility: Use a different provider for subagents than the main agent (e.g., main agent on Nous Portal, subagents on OpenRouter)

Proposed Config

Add a subagent section to config.yaml with provider and model fields, matching the existing pattern:

# config.yaml
subagent:
  # Provider for subagent model (optional — defaults to parent's provider)
  # provider: "openrouter"
  
  # Model to use for subagents spawned by delegate_task (default: inherits parent model)
  # A fast/cheap model is recommended since subtasks are narrowly scoped
  model: "google/gemini-3-flash-preview"

For reference, the existing compression config follows this pattern:

compression:
  summary_model: "google/gemini-3-flash-preview"

Implementation Notes

  1. Config: Add subagent key to DEFAULT_CONFIG in hermes_cli/config.py and load_cli_config() defaults in cli.py
  2. delegate_tool.py: Read the config values and use them as the default when no explicit model is passed by the agent:
    # In _run_single_task or handle_delegate:
    subagent_config = config.get("subagent", {})
    configured_model = subagent_config.get("model")
    configured_provider = subagent_config.get("provider")
    
    child = AIAgent(
        ...
        model=model or configured_model or parent_agent.model,
        provider=configured_provider or getattr(parent_agent, "provider", None),
        ...
    )
  3. cli-config.yaml.example: Add documented example section
  4. hermes setup / hermes tools: Consider adding subagent model to the config display (_print_status)
  5. Precedence: Explicit model passed via tool call > config.yaml subagent.model > parent model (inherit)

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