Plugins

Everything is a plugin.

DeepSeek Harness's defining idea: every capability is a plugin. Learn what a plugin is, write your first one, and register tools. Based on the official developer guide.

What is a plugin?

A Harness plugin is a TypeScript module that exports an apply function. The framework calls apply when it loads, passing a ctx through which you register capabilities:

import type { Context } from '@deepseek-ai/cordis'

export const name = 'my-plugin'

export function apply(ctx: Context) {
  // Register capabilities here.
}

Anything you register via ctx is cleaned up automatically when the plugin unloads.

Your first plugin

mkdir -p scratch-plugin/src
// scratch-plugin/src/my-plugin.ts
import type { Context } from '@deepseek-ai/cordis'
export const name = 'hello-plugin'
export function apply(ctx: Context) {
  console.log('[hello-plugin] plugin loaded!')
}

Create scratch-plugin/cordis.yml pointing at the absolute path, then start the Web UI with the patch:

- insert:
    - id: hello
      name: '/absolute/path/to/deepseek-harness/scratch-plugin/src/my-plugin.ts'
pnpm dsh web --patch ./scratch-plugin/cordis.yml

Register a tool

Use defineTool to add a tool your agent can call:

import { defineTool } from '@deepseek-ai/dsh-tools'

ctx.tools.register(defineTool({
  name: 'greet',
  description: 'Greet someone by name.',
  parameters: { name: { type: 'string', required: true, description: 'The name' } },
  output: { schema: { type: 'string' }, render: (_a, v) => [{ type: 'text', text: v }] },
  async execute(args) { return `Hello, ${args.name}!` },
}))

Community plugins & publishing

Tag your repo with dsh-plugin to join the ecosystem, and see the plugin directory (120+ curated).

Back to the tutorial →

🌐 δΈ­ζ–‡