Skip to content

feat(agents): custom models for sub-agents (forge, sage, muse)#2705

Open
chengyixu wants to merge 2 commits intoantinomyhq:mainfrom
chengyixu:feat/custom-models-sub-agents
Open

feat(agents): custom models for sub-agents (forge, sage, muse)#2705
chengyixu wants to merge 2 commits intoantinomyhq:mainfrom
chengyixu:feat/custom-models-sub-agents

Conversation

@chengyixu
Copy link
Copy Markdown

Summary

Closes #2637

Adds per-agent model and provider configuration so users can assign different models to each built-in agent. For example, use an expensive thinking model like Opus for forge while using a fast/cheap model like MiniMax via OpenRouter for sage research.

New ZSH commands

Command Alias Description
:config-forge-model :cfm Set model for the forge (implementation) agent
:config-sage-model :csgm Set model for the sage (research) agent
:config-muse-model :cmm Set model for the muse (planning) agent

CLI commands

# Set per-agent model
forge config set agent-model forge open_router anthropic/claude-3.5-sonnet
forge config set agent-model sage open_router minimax/minimax-01

# Get per-agent model
forge config get agent-model sage
# Output:
# open_router
# minimax/minimax-01

How it works

  • When switching agents (:forge, :sage, :muse), the prompt automatically shows the agent's configured model
  • Per-agent overrides take precedence over the global default model
  • If no per-agent override is set, the agent falls back to the global model (existing behavior)
  • :model and :config-model remain scoped to the global default, as described in the issue
  • :config list now shows per-agent model overrides

Implementation

Full-stack changes across 14 files:

  • Domain (forge_domain): AgentModelConfig { provider, model } struct, AppConfig.agent_models HashMap, SetAgentModel/ClearAgentModel operations
  • Config (forge_config): forge_model, sage_model, muse_model fields persisted to .forge.toml
  • Repository (forge_repo): Bidirectional mapping between TOML config and domain types
  • Services (forge_services): get/set/clear_agent_model_config methods; agent registry applies overrides at load time
  • API (forge_api): Exposes per-agent config via the API trait; invalidates agent cache on changes
  • CLI (forge_main): forge config set/get agent-model subcommands; :config list shows overrides
  • ZSH plugin: Three new action handlers reusing _forge_pick_model for consistent fzf UX

Config file example

After configuring, .forge.toml will contain:

[forge_model]
provider_id = "open_router"
model_id = "anthropic/claude-3.5-sonnet"

[sage_model]
provider_id = "open_router"
model_id = "minimax/minimax-01"

Test plan

  • All existing tests pass (239 forge_main, 262 forge_repo, 198 forge_services, all domain/app/api/config tests)
  • cargo check succeeds
  • Manual test: :config-sage-model opens fzf picker, selection persists to .forge.toml
  • Manual test: :config-forge-model and :config-muse-model work identically
  • Manual test: switching agents shows correct per-agent model in prompt
  • Manual test: forge config set agent-model sage open_router minimax/minimax-01 works
  • Manual test: forge config get agent-model sage returns the configured values
  • Manual test: :config shows per-agent overrides in the configuration list

🤖 Generated with Claude Code

Add :config-forge-model, :config-sage-model, :config-muse-model commands
to allow configuring different model+provider combinations for each
built-in agent. This enables using expensive thinking models for forge
while using faster/cheaper models for sage research tasks.

Changes across the full stack:

Domain (forge_domain):
- New AgentModelConfig struct with provider and model fields
- AppConfig gains agent_models HashMap for per-agent overrides
- New AppConfigOperation variants: SetAgentModel, ClearAgentModel

Config (forge_config):
- ForgeConfig gains forge_model, sage_model, muse_model fields
  persisted to .forge.toml

Repository (forge_repo):
- forge_config_to_app_config maps per-agent TOML fields to domain
- apply_op handles SetAgentModel and ClearAgentModel operations

Services (forge_services):
- AppConfigService gains get/set/clear_agent_model_config methods
- AgentRegistryService applies per-agent overrides when loading agents

API (forge_api):
- API trait exposes get/set/clear_agent_model_config
- Agent cache invalidated on per-agent model changes

CLI (forge_main):
- `forge config set agent-model <agent> <provider> <model>`
- `forge config get agent-model <agent>`
- :config list shows per-agent model overrides

ZSH plugin:
- :config-forge-model (alias :cfm)
- :config-sage-model (alias :csgm)
- :config-muse-model (alias :cmm)
- Reuses _forge_pick_model helper for consistent UX

Closes antinomyhq#2637
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 26, 2026

CLA assistant check
All committers have signed the CLA.

@chengyixu
Copy link
Copy Markdown
Author

recheck

@amitksingh1490 amitksingh1490 self-requested a review March 27, 2026 04:11
@tusharmath tusharmath self-assigned this Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Custom models for sub-agents

3 participants