@snnh/dsh-role-config: Role Routing and Model Pool for DSH Agents

Introduction

The core design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” When building agents, how to finely control model delegation behavior and the selection of underlying models is a common challenge for developers. Traditional direct tool-calling approaches are often not flexible enough when handling complex routing rules and failover.

The following section introduces the @snnh/dsh-role-config plugin. It provides DSH with capability-based delegation routing and priority failover mechanisms through role presets and model pools.

What Is It

snnh/dsh-role-config is a DSH plugin package maintained by the user snnh and licensed under the MIT license. It does not change the core DSH architecture; instead, it provides role presets and model pools to solve how an agent can route different tasks to different models based on task characteristics, and how to automatically switch when a model call fails.

Core Features

The plugin provides the following main capabilities:

  1. Role Presets
    A model can delegate a task to a role (for example, role: "premium") without needing to know which specific model serves it. Each role carries a description, a priority chain, and operator-defined rules.

  2. Model Pools
    Define a list of models that can be called by direct name. Each model has a description written by the operator. Directly named routing uses the given configuration and does not trigger failover.

  3. Routing Rules
    Before serving from the head of a role chain, conditional checks are executed in order, including prompt substrings, regular expressions, required input modality, minimum context window, or operator-defined custom capability labels.

  4. Priority Failover
    When a delegated child request fails terminally, it retries the request on the next member in the chain of the same role. The original failure only takes effect after the entire chain has been exhausted.

  5. Function Bindings
    Context compression and session titling can follow the role instead of the session route, or keep the default Harness behavior.

Installation and Activation

Installing the plugin requires using the npm package name; no additional build steps are needed.

dsh plugin --profile <profile> add @snnh/dsh-role-config

Installing from Git (github:snnh/dsh-role-config) is also supported, because the build artifacts are already committed, and no build scripts or allowBuilds permission are required.

After installation, the plugin does not register tools or modify agents by default. Delegation must be enabled manually.

- id: role-config
  config:
    exposure:
      delegateTool: true
      listTool: true
    pool:
      - provider: deepseek-official
        model: deepseek-chat

Configuration Notes

Official Tool Compatibility

When exposure.delegateTool is enabled, the plugin registers the routing tool under the official subagent name. To prevent naming conflicts, the configuration line for the official tool (or tool-subagent) must set modelSelectionSettings: false.

- id: tool-subagent
  config:
    provider: spawn
    toolName: subagent
    modelSelectionSettings: false

Local Network Access Configuration

By default, the configuration documentation is restricted to the loopback address. To configure this plugin via a local network address (such as http://<lan-ip>:<port>), you need to override the client-connection line in the connection configuration and set operatorSurface to trusted.

- id: connection
  config:
    trustedHosts: !!js ctx.webRuntime.trustedHosts
    operatorSurface: trusted

Use Cases and Considerations

This plugin is suitable for DSH users who need complex routing logic, multi-model collaboration, or fault tolerance inside an agent.

When using it, note the following limitations:
1. Directly Named Routing: Routing directly named in the model pool does not trigger failover.
2. Agent-team Inheritance: Agent-team members inherit the leader’s route; this plugin can only perform failover on inherited routes and cannot directly select their models.
3. Function Bindings: Function bindings only write to the target configuration line and do not have their own failover mechanism.
4. Runtime Permissions: The plugin runs with the current DSH process permissions; the source code and license should be reviewed before installation.

Conclusion

Through role presets and model pools, developers can build more stable agent routing strategies. For more configuration details and directory information, please refer to the GitHub repository or the plugin directory page.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye