Harness guide

Flow AI in DeepSeek Harness

dsh ships a complete tool loop — web fetch, shell, files, sandbox, context compaction — and needs exactly one thing from outside: a model endpoint. Point it at Flow and its per-step router chooses among three routes on one key, while Flow's router picks the cheapest lane that completes each step and verifies the result.

Setup — five lines

$DSH_HOME/settings.yaml
llm-pi-ai:
  providers:
    flow:
      apiKeyEnv: FLOWAI_API_KEY          # your Flow key
      api: openai-completions            # streams tokens as they arrive
      baseURL: https://api.flowaiapi.com/v1
      models:
        - id: flow-1                     # balanced — the default
        - id: flow-1-savings             # max savings — cheapest capable lane
        - id: flow-1-quality             # quality first — best lane (add ensemble: true for two proposers + verifier pick)
      compat:
        supportsDeveloperRole: false
        maxTokensField: max_tokens

agent-default-model:
  provider: flow
  model: flow-1

The three ids are the three policies — the policy is the model name — so a harness can choose per step (savings for exploration, quality for the write-up) without a second key or a dashboard setting. Every response carries _flowaiapi: the lane used, the price paid, the routing candidates, the derived harness state and the verification verdict.

A real session, unedited

The question: “Look at buywhere.ai and its MCP server listings. Is it a good MCP server? Recommend how to test MCP servers.” What the harness did before any model wrote a word: read the site, the developer docs and the MCP endpoint; pulled the server's package.json, README, src/index.tsand its smoke-test script from GitHub; then ran the protocol itself — registered an account, initialised the MCP session, listed the tools, called one. The answer was a synthesis of ~120K tokens of evidence it had gathered. That is why it was good; the model was the cheapest lane that could hold the context.

session · 16 steps · 14 tool calls · 412 s of harness time
turn·steptooltargetresultstep timelane (Flow)
1·1web_fetchbuywhere.ai13 KB9.6 sGLM Coding Max
1·2web_fetchbuywhere.ai/developers4.6 KB13.2 sGLM Coding Max
1·3web_fetchapi.buywhere.ai/mcp0.7 KB9.6 sGLM Coding Max
1·4web_fetchapi.buywhere.ai/docs/guides/mcp9.6 KB12.9 sGLM Coding Max
1·5web_fetchgithub.com/BuyWhere/buywhere-mcp4 KB13.3 sGLM Coding Max
1·6web_fetch…/buywhere-mcp/main/package.json2.8 KB12.4 sGLM Coding Max
1·7web_fetch…/buywhere-mcp/main/README.md19.1 KB8.6 sGLM Coding Max
1·8web_fetch…/buywhere-mcp/main/src/index.ts5.3 KB11.2 sGLM Coding Max
1·9web_fetch…/buywhere-mcp/main/scripts/smoke-tools.mjs3.7 KB35.1 sGLM Coding Max
1·10bashcurl POST api.buywhere.ai/v1/auth/register (registers an account, gets a key)0.2 KB15.7 sGLM Coding Max
1·11bashcurl POST api.buywhere.ai/mcp · initialize + tools/list27 KB16.4 sGLM Coding Max
1·12bashcurl POST api.buywhere.ai/mcp · tools/call19.7 KB78.0 sGLM Coding Max
1·13synthesisturn failed here — a Flow bug, since fixed (see below)111.1 sGLM Coding Max
2·1bashcurl POST api.buywhere.ai/mcp · re-run with the key1.3 KB18.4 sMiniMax-M3
2·2bashcurl POST api.buywhere.ai/mcp · tools/call15.9 KB13.1 sMiniMax-M3
2·3synthesisthe answer — 43K tokens in, 2,476 out33.8 sMiniMax-M3
Flow requests
16
input tokens
124K + 213K cached
output tokens
4,832
total cost
$0.0042

Honesty note: turn 1 died at its final step. That was a Flow bug — the Responses stream could not serialise a value from one lane's pricing and closed the connection, which dsh reported as server_error: [object Object]. Fixed the same day; the recommended openai-completionssetting above also streams tokens progressively, which the Responses path does not.

What Flow adds to a harness

Routing on harness state

Each step is routed on the state of the loop — step index, tool failures, recovery loops, context pressure, the verifier's last verdict — derived by Flow when the harness does not send it, or sent explicitly as harness_state.

Verification on every step

A reward model we trained on execution truth scores each response (pass/fail with confidence, ~50 ms). Add ensemble: true on the quality route for two proposers and a verifier pick.

Price, not markup

Subscription, free-tier and marketplace supply at the lane's live price. The session above cost less than half a cent.

All harness guides · Docs