Skip to content

[Feature]: Per-subagent temperature control via delegate_task parameter #31516

Description

@JethroLong

Problem or Use Case

Currently, all subagents spawned via delegate_task inherit the parent's temperature (or the model's default). This makes it impossible to use different creative/deterministic settings for different phases of a workflow.

My use case (creative writing workflow):

Phase Purpose Desired Temperature Why
Creative brainstorming Generate diverse story ideas 0.8 Need imagination, unexpected connections
Plot structuring Organize narrative arcs 0.5 Balance creativity and coherence
Logic review Check for plot holes 0.2 Strict, deterministic analysis
Style consistency Ensure voice uniformity 0.3 Predictable output patterns

Current workarounds and their problems:

  1. Model switching — Use "creative" model (Claude Sonnet) for brainstorming, "strict" model (Claude Opus/o1) for review. Problem: costly, limited model availability, not fine-grained enough.

  2. Prompt engineering — Ask for "be creative" or "be strict" in the prompt. Problem: unreliable, model-dependent, wastes tokens on instructions that should be inference parameters.

  3. Local source patch — Modify delegate_tool.py to hardcode temperature. Problem: not maintainable across updates, not shareable across team members.

Why this matters for multi-agent workflows:

The delegate_task tool is designed for parallel subagent execution — a core selling point of Hermes. But without per-subagent inference parameter control, all children in a batch are forced into the same "personality mode." This significantly limits the sophistication of multi-agent workflows.

Proposed Solution

Add an optional temperature parameter to delegate_task that gets forwarded to the child AIAgent via request_overrides.

Minimal implementation (~3 files, <50 lines)

1. tools/delegate_tool.py — tool signature

def delegate_task(
    goal: str = None,
    context: str = None,
    tasks: List[Dict[str, Any]] = None,
    model: str = None,
    temperature: float = None,        # ← NEW
    toolsets: List[str] = None,
    role: str = "leaf",
    acp_command: str = None,
    acp_args: List[str] = None,
) -> List[Dict[str, Any]]:
    """Spawn one or more subagents to work on tasks in isolated contexts.
    
    ...existing docs...
    
    Args:
        temperature: Optional sampling temperature (0.0-2.0) for the subagent's
            LLM calls. Overrides the parent agent's temperature. Useful for
            creative tasks (higher) vs analytical tasks (lower).
    """

2. tools/delegate_tool.py_build_child_agent()

# Around line 1106 in current main
def _build_child_agent(...):
    ...
    child = AIAgent(
        base_url=effective_base_url,
        api_key=effective_api_key,
        model=effective_model,
        provider=effective_provider,
        api_mode=effective_api_mode,
        ...
        request_overrides={"temperature": temperature} if temperature is not None else None,
        # ↑ NEW: forward temperature to child via request_overrides
        ...
    )

3. Optional: config.yaml schema

delegation:
  model: ''
  provider: ''
  temperature: null    # ← NEW: default null = inherit from parent
  max_iterations: 50

Usage examples

# Creative brainstorming — high temperature
creative_results = delegate_task(
    goal="Brainstorm 10 unexpected plot twists for a mystery novel",
    temperature=0.8,
    model="anthropic/claude-sonnet-4",
)

# Logic review — low temperature
review_results = delegate_task(
    goal="Check the following plot for logical inconsistencies...",
    temperature=0.2,
    model="anthropic/claude-sonnet-4",  # same model, different behavior
)

# Batch with mixed temperatures (parallel execution)
mixed_results = delegate_task(
    tasks=[
        {"goal": "Generate title ideas", "temperature": 0.9},
        {"goal": "Check grammar", "temperature": 0.1},
        {"goal": "Expand outline", "temperature": 0.6},
    ]
)

Alternatives Considered

Approach Pros Cons
Model switching (current workaround) No code changes Costly; limited by provider model availability; can't fine-tune within same model
Prompt engineering No code changes Unreliable; model-dependent; wastes tokens; not deterministic
Local source patch Works immediately Not maintainable; breaks on updates; not team-shareable
Global config key (delegation.temperature) Simple Too coarse — can't vary per subagent in same workflow
Per-task temperature in batch mode Flexible Slightly more complex API; but this is the proposed solution

Feature Type

Configuration option

Scope

Small (single file, < 50 lines)

Contribution

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

Debug Report (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to haveduplicateThis issue or pull request already existstool/delegateSubagent delegationtype/featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions