In DeepSeek Harness, the standard subagent tool inherits the parent model routing, which can be insufficiently flexible when you need fine-grained control over subagent model selection. The dsh-subagent-router plugin provides finer-grained control for subagent delegation. It adds a new subagent_model tool, allowing you to explicitly specify the provider, model, and output limit for each call, or delegate the choice to the built-in model:"auto" automatic selection strategy. It also provides catalog lookup and smart recommendation features to help make decisions in complex scenarios.

Core Features

The plugin provides three main tools and one automatic selection strategy.

Tool List

  1. subagent_model
    Delegate tasks to a subagent and specify provider, model, and max_tokens in the current call. If not specified, the subagent inherits the routing of the calling agent. If model: "auto" is passed, the built-in strategy selects the model.

  2. subagent_models
    A read-only catalog tool. Lists the provider routes registered under ctx.llm and their model lists, and annotates each model with metadata (cost, speed, strength, specialty, contextWindow) and the route’s health status.

  3. subagent_recommend
    Intelligently recommends a provider and model based on the task description. It condenses the model catalog into four tiers and returns top-ranked suggestions (top-3 by default).

model:”auto” Strategy

This strategy delegates model selection to deterministic rules without additional LLM calls. It includes the following mechanisms:

  • Task tiering: Tasks are classified as trivial (simple), standard (standard), or complex (complex) based on task length and complexity.
  • Anchoring to the parent model: By default, it prioritizes the parent model’s configuration, unless the parent model is unhealthy or the task clearly exceeds its capabilities.
  • Failure escalation: When autoEscalate is enabled, transient failures such as rate-limit trigger a retry using the next-tier model.
  • Rerouting: For terminal failures such as quota or auth, it switches to a healthy provider route and retries.
  • Health awareness: The plugin records provider failure status to avoid getting stuck on a bad route.

Installation and Configuration

Installation

Run the following command in your terminal to install the plugin:

dsh plugin add dsh-subagent-router

Configuration

The plugin provides client-side configuration, and configuration changes take effect immediately without requiring a restart.

Settings Page UI:
In DSH, go to Settings → Plugin Configuration, and find the subagent-router card to edit it.

YAML Configuration Example:
You can also configure it in the config field of a composition line:

- id: subagent-router
  name: 'dsh-subagent-router'
  config:
    autoEscalate: true
    autoReroute: true
    autoEscalationTiers: 1
    autoProviderOrder: [deepseek-official, pi-ai-cn]
    autoTierPolicy:
      trivial: cheapest
      standard: anchor
      complex: strongest

Fixed Defaults (not configurable):
* Subagent provider: spawn
* Tool names: subagent_model / subagent_models
* Background mode: continuable (runs in the background by default and immediately returns a persistent subagent ID)
* Depth limit: provider-managed

Typical Usage

  1. View route and model information
    First use the catalog tool to confirm the currently available providers and model status:
    // 调用 subagent_models
    const models = await ctx.callTool("subagent_models");
  1. Explicitly specify a subagent
    When calling subagent_model, explicitly specify the provider and model:
    await ctx.callTool("subagent_model", {
      description: "代码审查",
      prompt: "请审查以下代码...",
      provider: "deepseek-official",
      model: "deepseek-v4-pro",
      max_tokens: 4000
    });
  1. Use automatic selection
    Set model to "auto", and the strategy will automatically choose based on task complexity and the parent model’s status:
    await ctx.callTool("subagent_model", {
      description: "分析报告",
      prompt: "生成详细分析...",
      model: "auto" // 内置策略接管选择
    });
  1. Get recommendations
    Use subagent_recommend to get suggestions for the current task:
    const recommendation = await ctx.callTool("subagent_recommend", {
      description: "摘要生成"
    });

Notes

  • Inheritance change: Subagents no longer automatically inherit the parent model’s configuration. Selection must be explicitly specified through the tool.
  • Background mode: The default background mode is continuable, which creates a persistent subagent. If you need to wait for the result in the foreground, explicitly set run_in_background: false.
  • Failure classification: Subagent failures (such as quota, rate-limit, and auth) are classified and passed through. Callers can directly see the specific failure reason and HTTP status code instead of a generic execution failure.
  • Ecosystem context: The DeepSeek Harness follows the “everything is a plugin” philosophy. This plugin is a community plugin and has no affiliation with official DeepSeek.