Skip to content

feat: structured ModelRequirement in template agent configs #722

@Aureliolo

Description

@Aureliolo

Problem

Templates use bare tier strings for model assignment ("medium", "large", "small"). The ModelRequirement system already supports tier + priority + min_context + capabilities with personality-based affinity defaults -- but templates can't express this directly.

This means all agents of the same tier get identical matching behavior regardless of role. A CEO and a Scrum Master both on "large" are treated identically, even though the CEO benefits from quality priority and large context while the Scrum Master needs speed.

Proposed Changes

Schema extension

Extend TemplateAgentConfig.model to accept either a string (backward-compat) or a dict:

# Legacy (still works)
model: "medium"

# New structured format
model:
  tier: "medium"
  priority: "quality"
  min_context: 100000

Loader changes

  • _normalize_template_data() in loader.py: pass through dict model values
  • TemplateAgentConfig.model field: change from NotBlankStr to NotBlankStr | dict[str, Any]
  • Add validator to accept both forms

Renderer changes

  • _expand_single_agent(): call parse_model_requirement() for structured dicts
  • Thread the parsed ModelRequirement to the matching engine

Template YAML updates

Update builtin templates to use structured format where it adds value:

  • Leaders/architects: priority: quality, min_context: 100000
  • SRE/DevOps: priority: speed
  • Junior/mid developers: priority: cost
  • Content writers: priority: quality (creative work benefits from quality)
  • Scrum masters/PMs: priority: speed (fast coordination)

Scope

Schema, loader, renderer changes + YAML updates. Tests for both string and dict model formats.

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:mediumShould do, but not blockingscope:medium1-3 days of workspec:providersDESIGN_SPEC Section 9 - Model Provider Layerspec:templatesDESIGN_SPEC Section 14 - Templates & Buildertype:featureNew feature implementationv0.5Minor version v0.5v0.5.0Patch release v0.5.0

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions