zai-org / zai-org/feedback

[Feature Request] ZCode: Allow Subagents to Use Different Model/Effort Level Than Session Spine

Open
#392 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

πŸš€ Feature Request

Add the ability for ZCode subagents to be spawned with a different model and effort level than the main session's "spine" model.

Example Use Case:
  • Session Spine: GLM-5.3 (full power β€” planning, architecture, review)
  • Subagent Workers: GLM-5.3-Flash (fast/cheap β€” execution, file editing, searches)

πŸ“‹ Current Behavior (Limitation)

❌ Issue

When using ZCode's multi-agent/subagent capabilities:

  • All subagents inherit the same model as the parent session
  • No way to specify "run this subagent on Flash model"
  • No way to mix effort levels within a single session
User Experience

"In ZCode, I asked 5.3 to spawn subagents that run as 5.3-Flash and it told me that this is not possible so the subagents were 5.3 (non Flash) instead."

"It would be super cool if we can spawn subagents that have a different model and difficulty, so the session can act as a spine with 5.3 (non Flash) and workers can execute as 5.3-Flash."
β€” blockomoco [OC], Discord


βœ… Proposed Solution

Architecture: "Spine + Workers" Pattern
ZCODE SESSION
|
+-- SESSION SPINE (Orchestrator)
|   Model: GLM-5.3 (Full Power)
|   Role: Planning, Review, Architecture
|   Command: "Spawn 3 subagents to refactor modules"
|
+-- SUBAGENT Worker 1  --> Model: GLM-5.3-Flash  Cost: $0.01
+-- SUBAGENT Worker 2  --> Model: GLM-5.3-Flash  Cost: $0.01
+-- SUBAGENT Worker 3  --> Model: GLM-5.3-Flash  Cost: $0.01
|
RESULT: 1x expensive + 3x cheap = HIGH QUALITY, LOWER COST

🎯 UI/UX Implementation

Option A: Session-Level Default Setting
Agent Configuration
---------------------
Main Session Model: [GLM-5.3        β–Ό]

Subagent Default:
( ) Same as session                    [current]
(*) Specify model:                       [NEW]
    Model: [GLM-5.3-Flash      β–Ό]
    Effort: [Low β–Ό]
Option B: Per-Invocation Override (Advanced)

User can prompt:

@spawn_subagent(
  task: "Refactor auth module",
  model: "glm-5.3-flash",
  effort: "low",
  max_tokens: 8000
)
Option C: Agent Pool Configuration
Agent Pool
---------
Orchestrator:  GLM-5.3      (planning)
Workers (1-5): GLM-5.3-Flash (execution)
Reviewer:      GLM-5.3      (quality gate)

[Add Role] [Remove] [Reorder]

πŸ’° Cost-Benefit Analysis

Token/Cost Savings Scenario
Approach # of Agents Model Est. Cost/Session
Current (all same) 4 agents GLM-5.3 ~$0.40
Proposed (spine+workers) 1Γ— GLM-5.3 + 3Γ— Flash Mixed ~$0.16
Savings β€” β€” ~60% reduction βœ…
Quality Retention
  • Spine (GLM-5.3) handles: Planning, decomposition, review β†’ High-quality decisions
  • Workers (Flash) handle: Execution, file ops, simple tasks β†’ Adequate for routine work
  • Net result: Near-full-power quality at fraction of cost

πŸ† Competitive Analysis

How Competitors Handle This:
Platform Feature Name Status
OpenAI Codex Multi-model agent delegation βœ… Supported
Anthropic Claude Subagent model override βœ… Supported
Cursor Hierarchical agent models βœ… Supported
Windsurf Cascade model selection βœ… Supported
ZCode Subagent model selection ❌ Not supported ← WE ARE HERE
Quote from User:

"This is a capability that both Codex and Claude have and it allows to save considerable amounts of tokens/$ this way while retaining very high output quality close to what the stronger model would achieve by itself."
β€” blockomoco [OC]


πŸ”§ Technical Implementation

Backend Changes Required
1. Agent Spawn API Extension
interface SpawnSubagentRequest {
  task: string;
  context: AgentContext;
  
  // NEW FIELDS:
  modelOverride?: string;       // e.g., "glm-5.3-flash", "glm-4.5"
  effortOverride?: 'low' | 'medium' | 'high';
  maxTokens?: number;
  temperature?: number;
}
2. Session Config Schema
interface SessionConfig {
  primaryModel: string;           // Existing: "glm-5.3"
  
  // NEW:
  subagentDefaults?: {
    model?: string;              // undefined = inherit from primary
    effort?: 'low' | 'medium' | 'high';
    maxConcurrent?: number;      // Limit parallel workers
  };
  
  agentRoles?: Array({
    name: string;                // "orchestrator", "worker", "reviewer"
    model: string;
    effort: string;
    responsibilities: string[];
  });
}
3. Quota/Billing Logic
def calculate_session_cost(session):
    base_cost = session.spine_model.cost_per_token * spine_tokens
    
    for subagent in session.subagents:
        model = subagent.model_override or session.primary_model
        base_cost += model.cost_per_token * subagent.tokens_used
    
    return base_cost

πŸ“Š Use Cases & Benefits

Primary Use Cases
Use Case Spine Model Worker Model Benefit
Large refactoring GLM-5.3 GLM-5.3-Flash Plan smart, execute cheap
Code generation GLM-5.3 GLM-4.5 Architect with best, generate with good
Testing/debugging GLM-5.3-Flash GLM-5.3-Flash All fast for quick iteration
Documentation GLM-5.3 GLM-5.3-Flash Quality writing, cheap research
Multi-file edits GLM-5.3 GLM-5.3-Flash Coordinate carefully, edit rapidly
Who Benefits?
User Type Impact
Power users Optimize cost without sacrificing quality
Budget-conscious Stretch quota further on free/lower tiers
Enterprise Fine-grained cost control per project type
Quality-focused Keep spine on best model, offload grunt work

🎯 Implementation Priority

Phase 1: Basic Model Override (MVP)
  • Add model parameter to subagent spawn function
  • Support GLM-5.3 ↔ GLM-5.3-Flash switching
  • Show model assignment in agent panel UI
  • Track per-agent token usage separately
Phase 2: Effort/Temperature Control
  • Add effort parameter (low/medium/high)
  • Map effort to temperature, top_p, max_tokens defaults
  • Allow per-subagent overrides in prompts
Phase 3: Agent Roles/Pools
  • Pre-configured role templates (orchestrator, worker, reviewer)
  • Session-level default agent pool
  • Save/load agent configurations
  • Visual DAG of agent hierarchy with model labels
Phase 4: Smart Recommendations
  • AI suggests optimal model per subtask
  • Cost estimation before execution
  • Auto-balance based on complexity detection

⚠️ Considerations & Edge Cases

Case Recommended Handling
User doesn't have Flash access Fall back to session model or show error
Context window mismatch Truncate/prioritize context for smaller models
Subagent needs to spawn its own subagent Inherit parent's model override or use session default
Billing display Break down costs by model used
Error in Flash subagent Retry with spine model (automatic escalation)

πŸ“ˆ Success Metrics

If implemented, track:

  • Cost savings % for sessions using mixed models
  • Task completion rate comparison (mixed vs uniform)
  • User adoption rate of the feature
  • Satisfaction scores from power users

πŸ“ Additional Context

Full User Statement

"In ZCode, I asked 5.3 to spawn subagents that run as 5.3-Flash and it told me that this is not possible so the subagents were 5.3 (non Flash) instead."

"It would be super cool if we can spawn subagents that have a different model and difficulty, so the session can act as a spine with 5.3 (non Flash) and workers can execute as 5.3-Flash."

"This is a capability that both Codex and Claude have and it allows to save considerable amounts of tokens/$ this way while retaining very high output quality close to what the stronger model would achieve by itself."
β€” blockomoco [OC], Discord


πŸ”— Reference

Original Suggestion: Submitted by blockomoco [OC] via Discord community


Submitted by: Roman Galaxys10 (Roman) β€” Z.ai Volunteer Ambassador
Discord: bignavi_x
GitHub: romangalaxys10-spec
Source: Discord Community β€” User: blockomoco [OC]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up β€” it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files or tests are named. Start by locating the SpawnSubagentRequest and SessionConfig entry points, then inspect the session cost calculation; done requires an agreed implementation scope, validation of model and effort overrides, and coverage for billing and fallback behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
ai, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.