Skip to content

feat: allow configuring subAgent temperature from config.yaml #435

Description

@avoidwork

Summary

Allow users to configure the temperature parameter for subAgents via config.yaml, enabling fine-grained control over their randomness and creativity at launch.

Motivation

Currently, subAgents are launched without configurable temperature, meaning their behavior is fixed by the default LLM settings. Users may want to adjust temperature per-subAgent or globally to control the randomness of their outputs — lower for precise, deterministic tasks and higher for creative, exploratory work.

Proposed Solution

Add a temperature field to the subAgent configuration in config.yaml. When launching a subAgent, read this value and pass it to the LLM call. Support both a global default and per-subAgent override.

Example config:

subAgents:
  temperature: 0.7  # global default
  skills:
    - name: audit-code
      temperature: 0.3  # override for specific skill

Alternatives Considered

  • Command-line flag only — Less convenient for persistent configuration. Config.yaml is the right home for this.
  • Per-skill in the skill definition — Would require modifying each skill file. Config.yaml keeps it centralized and user-controlled.

OpenSpec Note

This project uses OpenSpec for feature development. If this request is approved, I will:

  1. Run /opsx:propose to generate a full proposal with specs and tasks
  2. Iterate on the design before any code is written
  3. Follow the task-driven implementation workflow

Additional Context

The temperature parameter is a standard LLM parameter that controls randomness in model outputs. This would give users more control over subAgent behavior without needing to modify system prompts or skill definitions.

Environment

  • OS: Linux 7.0.2-7-pve
  • Node.js: v25.8.1
  • madz version: 1.18.0
  • LLM provider: Unknown — user to confirm---

Audit Findings

Current Architecture

  • File: src/tools/subAgent.js — SubAgents are spawned as separate node index.js processes (line 113). Each subAgent is a full madz instance that reads its own config.yaml.
  • File: src/provider/openai.js — Temperature is passed to ChatOpenAI at model creation time (line 24). Currently reads from provider config only.
  • File: config.yaml — Temperature is configured at providers.openai.temperature (line 9). SubAgent config lives under process.subAgent (lines 84-89) but has no temperature field.

Integration Points

  1. src/tools/subAgent.js:113spawnSubAgentProcess() spawns the child process. This is where temperature would need to be passed (env var or CLI arg).
  2. src/tools/subAgent.js:258-274resolveTimeout() shows the existing pattern: per-call > env var > config default. Temperature resolution should follow the same hierarchy.
  3. src/provider/openai.js:21-32createChatModel() accepts temperature from config. The spawned process would need to override this with the subAgent-specific value.
  4. config.yaml:84-89process.subAgent section is the natural home for subAgent-specific config including temperature.

Proposed Implementation Path

  1. Add temperature field to process.subAgent in config.yaml (e.g., 0.7)
  2. Pass temperature to spawned process via MADZ_SUBAGENT_TEMPERATURE env var in spawnSubAgentProcess()
  3. In the spawned process, override provider temperature if MADZ_SUBAGENT_TEMPERATURE is set
  4. Follow the same resolution pattern as timeout: per-call > env var > config default > provider default
  5. Add temperature to the subAgent tool schema (optional per-call override)

Config Schema Change

process:
  subAgent:
    timeout: 600000
    maxConcurrent: 4
    sessionMode: isolated
    defaultStrategy: parallel
    defaultOnError: continue
    temperature: 0.7  # NEW — subAgent temperature (0-2, follows OpenAI spec)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions