feat(models): SWE_MODEL_LOW/MED/HIGH per-tier model env vars#100
Merged
Conversation
Classify the 17 agent roles into three capability tiers (high = planning reasoning, med = coding/review/QA, low = mechanical) and let each tier be pointed at a model with one env var, instead of enumerating 17 role keys. Tier vars slot between the SWE_DEFAULT_MODEL cascade and caller config in resolve_runtime_models; SWE_MODEL_HIGH also becomes the default for the plan pipeline, whose reasoners are high-tier. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ier layer RoleToTier + tierModelsFromEnv in internal/config, applied at the same precedence point as swe_af/execution/schemas.py (after the default-model env cascade, before models config); DefaultPlanningModel consults SWE_MODEL_HIGH first. Tests mirror tests/test_model_tiers.py 1:1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the claude_code-style tier approach to every runtime (open_code, codex, claude_code) and both implementations (Python + Go): three env vars map the 17 agent roles to models by capability tier, instead of enumerating 17
models.<role>keys.Precedence (lowest → highest): runtime base defaults →
SWE_DEFAULT_MODEL/AI_MODEL/HARNESS_MODEL→ tier env vars →models.default→models.<role>. With no tier vars set, resolution is byte-identical to today.SWE_MODEL_HIGHalso becomes the default for the standaloneplanpipeline (its reasoners are high-tier).The optional
#variantreasoning-effort suffix rides on the model string and is consumed by the harness providers (opencode--variant, codexmodel_reasoning_effort) — Agent-Field/agentfield#801, which implements it in all three SDKs (Python/Go/TS). Plain tier models work with current SDK releases; once #801 ships, theagentfieldfloor here should be bumped so Docker builds pick it up.Changes
Python:
swe_af/execution/schemas.py—MODEL_TIERS,ROLE_TO_TIER,TIER_MODEL_ENV_VARS,_tier_models_from_env(); tier layer inresolve_runtime_models();_default_planning_model()consultsSWE_MODEL_HIGHfirst..env.exampledocumented. 15 new tests (tests/test_model_tiers.py).Go:
go/internal/config/resolve.go—RoleToTier+tierModelsFromEnv()at the identical precedence point;DefaultPlanningModel()consultsSWE_MODEL_HIGHfirst. 15 subtests mirroring the Python contract 1:1 (modeltiers_test.go); env-isolation lists extended inconfig_test.go/orch/plan_test.go.Validation
make check(literal CI steps, fresh 3.12 venv, committed tree): 1052 passed, 1 skippedGOWORK=off, Go 1.23 toolchain, pinned sparse SDK clone): gofmt/build/vet/test -race— all 26 packages okruntime=open_code, tier vars above): all 17 roles resolved to their tier's model,models.coderoverride still wins, and opencode session records confirmed architect served byz-ai/glm-5.2(varianthigh), coder bydeepseek-v4-pro, qa_synthesizer bydeepseek-v4-flashNotes
swe_af/fast/) has no env cascade at all today, so tiers were deliberately not mirrored there — separate decision.🤖 Generated with Claude Code