# DeepSeek Harness on your InferOptimal endpoint

**Status:** Recommended as the safer alternative harness. That is our recommendation, resting on measured facts: one agent ended each of its short-task runs in minutes, none at the time cap, and was right 5 of 9 times on hard research. Its own measured weakness: one agent can run into the output limit on a long answer and end with none.

Every harness measured side by side, on the same model: https://www.inferoptimal.com/tools/results

DeepSeek Harness is DeepSeek's open-source agent harness. This guide points it at your InferOptimal endpoint: one agent works a
task through in the harness's own agent loop, with file and shell tools, and every model call goes to your endpoint. Its
`workflow` tool can fan a task out to many agents, but on hard research one agent did better than the fan-out.

The InferOptimal subagent tool's script (`agents.mjs`) installs, configures and starts it. The agents inside are the
harness's own: they call your endpoint directly, not through the subagent tool.

Nothing installs, starts or calls it for you. Connecting an InferOptimal account or endpoint never installs it, and it runs
nothing in the background: it works only while you run it.

## Good at, bad at, cost

Each line is marked measured, with where it was measured, or designed for and not measured yet. The measured lines come from our generated legislation benchmark (hard questions whose obvious answer is overridden by something buried in about 2,830 documents, 1 to 4 runs per question) and from a first pass over public benchmarks that ended when the GLM box we measured on was torn down (1 to 4 items each). A cost per run prices GLM time at $20 an hour, that box's rate. They are not a general accuracy figure.

Good at:

- One agent on short legal decisions: tax law (DeonticBench) 4 of 4 right in a median 3 minutes, $1.22 a run. (Measured: Experiment 6, first pass on the public DeonticBench benchmark, 2026-10-19.)
- One agent ended each of its 20 short-task runs in 1 to 22 minutes, none at the 40-minute cap, where the swarms reached the cap in 3 of their 16 short-task runs. (Measured: Experiment 6, first pass on the public DeonticBench, KramaBench, RuleArena, BRIGHT and VLoc benchmarks, 2026-10-19.)
- One agent on hard legislation research: 5 of 9 test runs right in a median 12 minutes, $5.58 a run. (Measured: Experiment 5, outside harnesses (5.6), on our generated legislation benchmark, 2026-10-18 and 19.)
- Workflow fan-out on finding vulnerable files: on the one VLoc item it reached, a File F1 of 0.36 where one agent and the Agent Framework scored 0 (1 run). (Measured: Experiment 6, first pass on the public VLoc benchmark, 2026-10-19.)

Bad at:

- One agent can run into the output limit on a long answer and end with none: on NBA rule decisions (RuleArena) 3 of its 4 runs ended that way, and it scored 1 of 4. (Measured: Experiment 6, first pass on the public RuleArena benchmark, 2026-10-19.)
- Workflow fan-out is slow: 11 to 41 minutes a run, and it often reached its 40-minute cap: on RuleArena, on VLoc and in 5 of 10 hard research runs. (Measured: Experiment 5, outside harnesses (5.6), on our generated legislation benchmark, 2026-10-18 and 19, and Experiment 6, first pass on the public DeonticBench, KramaBench, RuleArena, BRIGHT and VLoc benchmarks, 2026-10-19.)
- On hard research the workflow fan-out did worse than one agent alone: 2 of 8 test runs right against 5 of 9. (Measured: Experiment 5, outside harnesses (5.6), on our generated legislation benchmark, 2026-10-18 and 19.)

Cost:

- One agent $1.22 to $5.58 a run and the workflow fan-out $3.70 to $13.50 a run, on average per benchmark, with GLM time priced at the box's $20 an hour. (Measured: Experiment 5, outside harnesses (5.6), on our generated legislation benchmark, 2026-10-18 and 19, and Experiment 6, first pass on the public DeonticBench, KramaBench, RuleArena, BRIGHT and VLoc benchmarks, 2026-10-19.)
- Endpoint time only: every model call goes to your endpoint, and DeepSeek's own API plugins are switched off. (Designed for, not measured yet.)

## How many agents to run

Tested with one agent per task, and with the workflow fan-out running up to 8 at once, one level deep. The measured strengths, failures and costs come from those shapes. To use a whole endpoint, running many tasks in parallel as separate launches may work better than one very wide workflow: count the agents each launch runs at once (one for a single agent, up to 8 for the measured workflow fan-out) against the endpoint's provisioned agents. --concurrent-agents, --max-depth, --max-total-agents and --parallel-tool-calls take any number, and a workflow may start any number of agents in total, but wider fan-outs have not been measured. This is a suggestion; you decide. Every endpoint states how many concurrent agents its box is optimized for, and by default you keep all of them busy, through parallel launches or one wider workflow, unless the user explicitly chooses fewer; connected to an endpoint, guide and tool run say how many launches fill it.

For example, to work several tasks at once as separate launches, one agent each:

```sh
cd <folder to work in>
for task in "<task 1>" "<task 2>" "<task 3>"; do
  node ~/.inferoptimal/agents.mjs tool run deepseek-harness --task "$task" --cwd . > "answer-$(date +%s%N).txt" &
done
wait
```

Or one launch whose workflow fan-out runs more agents at once than we measured:

```sh
node ~/.inferoptimal/agents.mjs tool run deepseek-harness --task "<task; ask for the workflow tool>" --cwd <folder> --concurrent-agents 24
```

Nothing caps the number of agents. These are the harness's fan-out settings, each a default you can change for one run:

| Option | Default | What it does |
| --- | --- | --- |
| `--concurrent-agents <n>` | 8, as measured | Agents one parent runs at once, through the `subagent` and `workflow` tools. |
| `--max-depth <n>` | 1, as measured | How many levels of agents may start agents of their own. |
| `--max-total-agents <n>` | no ceiling | Total agents one workflow may start. The harness's own default ceiling of 1,000, and the 200 our runs had, are lifted. |
| `--parallel-tool-calls <n>` | 10, the harness default our runs used | Tool calls one agent runs at once, which includes starting subagents. |

Any whole number works, up to the largest the harness reads (9007199254740991). `tool run` writes the settings you give as a
small overlay in `fanout/`, named by its settings, and passes it after the installed patch, so the installed patch keeps the
measured settings and parallel launches of different sizes do not share a file.

## License

MIT, which allows any use, commercial included. DeepSeek Harness 0.2.0-rc.2 (@deepseek-ai/dsh, github.com/deepseek-ai/deepseek-harness) is installed from npm by make install; we publish only the guide, the patch writer and the npm lockfile.

We checked the license in the harness repository and in the npm package before listing it.

## Before you start

- An InferOptimal endpoint that serves chat completions with tool calls.
- The InferOptimal subagent tool set up for that endpoint (`get_codex_config` gives the one-paste install), for the one-call
  install below. Installing by hand instead needs the endpoint's base URL (ending in `/v1`), its model id and a file holding
  its key.
- Node.js with npm, Python 3.11 or newer, `make` and `curl`.

## Install

The subagent tool installs it and configures it for the endpoint it already uses, in one call:

```sh
node ~/.inferoptimal/agents.mjs tool install deepseek-harness
```

It downloads this package into `~/.inferoptimal/deepseek-harness`, runs `make fetch install` there, then runs `endpoint.py` to
write the patch for your endpoint, and prints what it configured. The key stays in the subagent tool's settings; the harness
gets it only in its environment when it runs. `node ~/.inferoptimal/agents.mjs guide deepseek-harness` prints this guide.

To install by hand instead:

```sh
mkdir -p ~/.inferoptimal/deepseek-harness && cd ~/.inferoptimal/deepseek-harness && curl -fsSLO https://www.inferoptimal.com/deepseek-harness/Makefile && make fetch install
```

`make fetch` downloads this guide, `package.json`, `package-lock.json`, `constants.toml` and `endpoint.py` into the current
folder. `make install` runs `npm install`, which installs DeepSeek Harness 0.2.0-rc.2 from npm with the versions the lockfile pins.

## Start

```sh
node ~/.inferoptimal/agents.mjs tool run deepseek-harness --task "<task>" --cwd <folder to work in>
```

It runs one agent on the task in that folder, with the endpoint key in its environment, and passes on the fan-out options
above if you give them. Add `--dry-run` to check the install and the configuration without a model call: it writes the
overlay for any fan-out options, runs `dsh --version` and prints the command it would run.

By hand:

```sh
export INFEROPTIMAL_API_KEY="$(cat <key file>)" && python3 ~/.inferoptimal/deepseek-harness/endpoint.py --base-url <endpoint base URL> --model <endpoint model> && cd <folder to work in> && ~/.inferoptimal/deepseek-harness/node_modules/.bin/dsh --profile headless --patch ~/.inferoptimal/deepseek-harness/inferoptimal.json "<task>"
```

`endpoint.py` writes `inferoptimal.json`, a DeepSeek Harness patch, beside it:

- Every model call goes to your endpoint's base URL and model, with the context window the endpoint lists for the model and up
  to 32,000 output tokens a call, as in our runs. The harness reads the key from `INFEROPTIMAL_API_KEY` when it runs; the key
  never enters the patch. Permanent services report their approved serving limit without waking hardware when it is
  retained in their configuration. Older services or endpoints without this metadata still need `--context-window <tokens>`;
  use the approved context from your quote, not an estimated per-agent cache share.
- DeepSeek's own API plugins are switched off, and so, as in our measured runs, are web search and fetch and the plugins that
  load project instructions and skills. Delete their entries from the patch to turn them back on.
- The `subagent` and `workflow` tools run up to 8 agents at once, one level deep, as measured, and a workflow may start any
  number of agents in total. `endpoint.py` takes `--concurrent-agents`, `--max-depth`, `--max-total-agents` and
  `--parallel-tool-calls` to write other settings; with `--fanout-only` it writes just those settings as an overlay, which
  needs no endpoint, to pass as a second `--patch`.

`dsh --profile headless` answers one task and exits: the answer goes to standard output and the reasoning to standard error.
It runs under the harness's own default permissions; read the `SAFETY.md` notice in its repository
(github.com/deepseek-ai/deepseek-harness) before giving it a folder. Our measured
runs instead ran each agent with full permissions inside an operating-system sandbox that confined it to the question's
folder. Use `--profile tui` or `--profile web` in place of `--profile headless` to work with it interactively.

For a question over documents, the brief we measured asked the agent to research it itself, without delegating: find the rule
that seems to decide it, search the folder for anything that amends, overrides, preempts, redefines, limits or makes an
exception to that rule, check that each really applies (right place, in force on the date, actually enacted), and end with
`ANSWER:` and the exact quotations it rests on. To fan out instead, ask in the task for the `workflow` tool.
