Skip to content

feat: add subAgentsTemperature config for per-agent temperature tuning - #844

Merged
avoidwork merged 3 commits into
mainfrom
feat/sub-agents-temperature-tuning
Aug 22, 2026
Merged

feat: add subAgentsTemperature config for per-agent temperature tuning#844
avoidwork merged 3 commits into
mainfrom
feat/sub-agents-temperature-tuning

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Add a subAgentsTemperature config section that allows per-agent temperature tuning for sub-agents. This enables fine-grained control over agent behavior by setting temperature values per agent type via config.yaml or environment variables.

Changes:

  • New Zod schema SubAgentsTemperatureSchema validating agent name → temperature (0-2) mappings
  • Schema added to root ConfigSchema in src/config/config.js
  • Accessor function getSubAgentTemperature(agentName) for reading per-agent temperature
  • Environment variable resolution support (e.g., SUB_AGENTS_TEMPERATURE_CODING=0.3)
  • Hyphen-to-underscore conversion for agent names with hyphens (e.g., code-reviewCODE_REVIEW)
  • Per-agent model instances created in deepAgents.js with configured temperature
  • Full test coverage for schema validation, env var resolution, and accessor function

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

  • Schema validation: Valid temperatures (0-2), invalid temperatures (out of range, non-numeric), empty config
  • Env var resolution: SUB_AGENTS_TEMPERATURE_CODING=0.3 correctly populates subAgentsTemperature.coding
  • Hyphenated agent names: SUB_AGENTS_TEMPERATURE_CODE_REVIEW=0.1 correctly populates subAgentsTemperature['code-review']
  • Accessor function: Correct value returned for listed agents, undefined for unlisted agents and empty strings
  • All existing tests pass (1192 tests)
  • Lint passes with no warnings or errors

Coverage

  • Line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with maintained line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Closes #843

Add complete OpenSpec change artifacts for per-agent temperature
configuration feature (issue #843). Includes:
- Proposal with motivation and scope
- Design doc with decisions and risks
- Spec deltas for config-system, subagent, and sub-agents-temperature
- Task breakdown for implementation
Add subAgentsTemperature config section allowing per-agent temperature
tuning via config.yaml or environment variables.

- New Zod schema (SubAgentsTemperatureSchema) for validation (0-2 range)
- Schema exported from schemas/index.js and added to root ConfigSchema
- Accessor function getSubAgentTemperature(agentName) for reading config
- DROPPED_KEYS updated so env vars flatten correctly
- _toUpperSnake modified to handle hyphens in agent names (e.g., code-review → CODE_REVIEW)
- createSubagentDefinitions creates per-agent model instances with configured temperature
- Unit tests covering schema validation, env var resolution, and accessor function
@avoidwork avoidwork self-assigned this Aug 22, 2026
@avoidwork

Copy link
Copy Markdown
Owner Author

Implementation Audit Results

Goal Fulfillment

Goal Status Notes
Add subAgentsTemperature config section ✅ Complete New schema file created, added to ConfigSchema
Zod schema validation (0-2 range) ✅ Complete SubAgentsTemperatureSchema validates record of agent→temp
Environment variable resolution ✅ Complete DROPPED_KEYS updated, hyphen handling added to _toUpperSnake
Accessor function getSubAgentTemperature ✅ Complete Returns configured value or undefined for unlisted agents
Wire into deepAgents sub-agent model creation ✅ Complete Per-agent model instances created with configured temperature

Spec Compliance

config-system spec:

  • ✅ Configuration loading and validation - subAgentsTemperature section added to ConfigSchema with Zod validation
  • ✅ subAgentsTemperature defaults to empty object {}
  • ✅ Invalid values rejected (out of range, non-numeric)

sub-agents-temperature spec:

  • ✅ Schema validates valid temperatures (0-2), rejects out-of-range and non-numeric
  • ✅ Empty config accepted
  • ✅ Environment variable resolution: SUB_AGENTS_TEMPERATURE_CODING=0.3subAgentsTemperature.coding
  • ✅ Hyphenated agent names: SUB_AGENTS_TEMPERATURE_CODE_REVIEWsubAgentsTemperature['code-review']
  • ✅ Accessor function returns correct values, undefined for missing/empty agents

subagent spec:

  • ✅ Sub-agent model created with per-agent temperature from config
  • ✅ Agents not in config use provider default (undefined temperature)

Task Completion

All 18 tasks from tasks.md completed:

  • Task 1.1-1.2: Schema creation and export ✅
  • Task 2.1-2.3: ConfigSchema addition and accessor ✅
  • Task 3.1-3.2: DROPPED_KEYS and hyphen handling ✅
  • Task 4.1-4.3: deepAgents wiring ✅
  • Task 5.1-5.4: Unit tests ✅
  • Task 6.1-6.4: Verification (tests pass, lint passes, app starts) ✅

Quality Check

  • Tests: 1192/1192 passing (0 failures)
  • Lint: 0 warnings, 0 errors
  • Formatting: All files formatted with oxfmt
  • No regressions: All existing tests continue to pass
  • Clean implementation: Minimal changes, follows existing patterns

Code Changes Summary

File Changes Purpose
src/config/schemas/subAgentsTemperature.js New file Zod schema for subAgentsTemperature
src/config/schemas/index.js +1 line Export new schema
src/config/config.js +34 lines Add to ConfigSchema, add accessor, _setResolvedConfig
src/config/loader.js +7 lines Add to DROPPED_KEYS, hyphen handling, _setResolvedConfig call
src/agent/deepAgents.js +23/-1 lines Per-agent model instances with temperature
tests/unit/config-subAgentsTemperature.test.js New file 217 lines of comprehensive tests

@avoidwork
avoidwork merged commit cdca28d into main Aug 22, 2026
2 checks passed
@avoidwork
avoidwork deleted the feat/sub-agents-temperature-tuning branch August 22, 2026 21:54
avoidwork added a commit that referenced this pull request Aug 23, 2026
- Add per-agent temperature defaults to config.yaml (closes #844)
- Add temperature defaults table to README.md (sorted alphabetically)
- Fix Deep Agents link to langchain-ai/deepagentsjs

Closes #844
avoidwork added a commit that referenced this pull request Aug 23, 2026
* fix: add subAgentsTemperature defaults to config.yaml

PR #844 added the schema and runtime support but forgot the
config.yaml entries. Without these, no agent gets a temperature
override — the feature is silently inert.

Closes #844

* fix: add subAgentsTemperature defaults to config.yaml and README

- Add per-agent temperature defaults to config.yaml (closes #844)
- Add temperature defaults table to README.md (sorted alphabetically)
- Fix Deep Agents link to langchain-ai/deepagentsjs

Closes #844
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add subAgentsTemperature config for per-agent temperature tuning

1 participant