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¶
-
subagent_model
Delegate tasks to a subagent and specifyprovider,model, andmax_tokensin the current call. If not specified, the subagent inherits the routing of the calling agent. Ifmodel: "auto"is passed, the built-in strategy selects the model. -
subagent_models
A read-only catalog tool. Lists the provider routes registered underctx.llmand their model lists, and annotates each model with metadata (cost,speed,strength,specialty,contextWindow) and the route’shealthstatus. -
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), orcomplex(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
autoEscalateis enabled, transient failures such asrate-limittrigger a retry using the next-tier model. - Rerouting: For terminal failures such as
quotaorauth, 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¶
- 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");
- Explicitly specify a subagent
When callingsubagent_model, explicitly specify the provider and model:
await ctx.callTool("subagent_model", {
description: "代码审查",
prompt: "请审查以下代码...",
provider: "deepseek-official",
model: "deepseek-v4-pro",
max_tokens: 4000
});
- Use automatic selection
Setmodelto"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" // 内置策略接管选择
});
- Get recommendations
Usesubagent_recommendto 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 setrun_in_background: false. - Failure classification: Subagent failures (such as
quota,rate-limit, andauth) 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.