DeepSeek Harness SDK: Python, HTTP API and gateway

Plugin DevelopmentPublished 2026-11-01Author: DeepSeek Plugin Market
DeepSeek Harness SDKPython SDKTypert gatewayCLIplugin development
Three developer entry points: Python SDK to drive sessions, Typert gateway for plugin front and back ends, and CLI calls for scripts and CI.

DeepSeek Harness has three developer entry points: Python SDK, Typert gateway, and CLI calls. They target different callers; choosing wrong means writing code where a command would do, or assembling commands where structured results are needed.

Who each entry serves

Decide by the caller and the result you need.

EntryForSolvesStability
Python SDKExternal programsDrive sessions, structured resultsOfficial
Typert gatewayPlugin front and back endsExpose host capabilities to clientInternal mechanism
CLIScripts, CITrigger commands, exit codesOfficial

The SDK is for programmatic use, the gateway is for plugin internals, and the CLI is for one-off actions. Create sessions, send messages, and read results from Python (source). The gateway exposes host methods to client code and is not a public HTTP API; you meet it when writing plugin UI. The CLI handles install, start, plugin management, and commands, so scripts depend on it least.

Python SDK: minimal working example

The SDK's value is structure, not replacing the CLI.

  1. Install the SDK: pip install deepseek-harness-sdk.
  2. Prepare the environment and a writable DSH_HOME.
  3. Start the sdk-minimal profile with the DeepSeekHarness context manager.
  4. Create a session and send one test message.
  5. Read the result and confirm JSONL logs under DSH_HOME/sessions.

sdk-minimal is deliberately small. It reduces plugin and tool dependencies for scripted calls; switch to a fuller profile when needed.

Logs are the first diagnostic entry. If a request does not return or the result is incomplete, read the JSONL before adding prints.

Typert gateway: plugin communication

The gateway is an internal bridge, not a public interface.

  1. Add @Remote or @RemoteScope to host service methods to select exposure.
  2. Declare object and wire-identity relationships with TypertLookupMap.
  3. Call through the generated client entry; do not hand-write the protocol.
  4. Expose only necessary methods; a wider surface increases permission and security risk.
  5. Use logs to confirm whether a call reached the host.

@Remote controls whether a method can be called; @RemoteScope controls where it is visible (source).

Do not treat it as REST. It has no public HTTP paths or status-code semantics; understanding it as a plugin mechanism avoids fragile code.

CLI: scripts and CI

The most stable script pattern is command plus exit code.

  1. Confirm the environment with dsh --version.
  2. Confirm plugin state with dsh plugin --profile web list.
  3. Call the target command and capture the exit code.
  4. Parse standard output or switch to the SDK when structure is needed.
  5. Pin versions in CI to avoid pulling a different build each run.

Avoid interactive prompts in CI. Add non-interactive flags; otherwise the pipeline waits for input.

The exit code is the contract. Zero and non-zero mean success and failure; do not match output text, which changes between versions.

Authentication and timeouts

Each entry authenticates differently and needs its own timeout policy.

  1. SDK: provide model keys through environment variables or configuration, never hard-coded.
  2. Gateway: uses host permissions; no extra token, but limit exposed methods.
  3. CLI: reuses local configuration and login state; inject env vars in CI.
  4. Timeouts: request-level for SDK, process-level for CLI, call-level for the gateway.
  5. Retries: only for retryable errors, with a cap.

Keys do not belong in code; timeouts must be layered. Environment variables, secret managers, and CI secrets beat plaintext. Set request, task, and process limits separately; one layer alone kills long tasks.

Errors and logs

The three entries fail differently, but diagnosis starts with logs.

EntryFailure shapeLook at
SDKException type and messageSDK exception and session JSONL
GatewayRejected call or timeoutHost logs and exposure scope
CLIExit code and stderrTerminal output and system logs

Separate "not called" from "call failed." The first checks entry configuration, the second checks the error; mixing them changes the wrong place.

Logs need context. Session ID, profile, and version make reproduction possible; "it failed" does not.

Selection table

Choose by caller, result, and dependency tolerance.

ScenarioEntryReason
External system integrationPython SDKStructured results, session control
Plugin UI calling hostTypert gatewayInternal, permission-scoped
Scheduled jobs, CICLIFew dependencies, clear exit codes
One-off troubleshootingCLIFastest, no code
Complex output parsingSDKAvoid text parsing

If the CLI solves it, do not add the SDK. More code means more maintenance; use the SDK for structure and reuse.

Write plugins only with the gateway. It is not an external integration entry; treating internal mechanisms as public APIs creates fragile integrations.

Next steps

Pick the entry, then write the minimal example. For Python SDK configuration, read How to call DeepSeek Harness from Python. For @Remote, read What the DeepSeek Harness API gateway is. To write a first plugin, read Write your first DSH plugin.

Sources: DeepSeek Harness docs, dsh CLI README, deepseek-harness repository

FAQ

Does DeepSeek Harness have a public HTTP API for sending messages?

DeepSeek Harness exposes a Python SDK and a CLI as stable external entries; plugin front and back ends use the Typert gateway internally. Prefer the SDK rather than undocumented HTTP paths.

How do I install the DeepSeek Harness Python SDK, and what is the minimal example?

Install deepseek-harness-sdk and use the DeepSeekHarness context manager with the sdk-minimal profile, then send one message. Session logs are written as JSONL under DSH_HOME/sessions.

What does @Remote do in the Typert gateway, and is it an HTTP route?

In the Typert gateway, @Remote is not an HTTP route: @Remote and @RemoteScope select which host methods are exposed to the client. TypertLookupMap declares object and wire-identity relationships.

Should scripts and CI use the DeepSeek Harness SDK or the CLI?

In scripts and CI, use the DeepSeek Harness SDK when you need structured results and session control, and the CLI when you only trigger a command and read the exit code. CI prefers the CLI.

Related Terms

Python SDK
The Python SDK is the official programmatic entry for DeepSeek Harness, using the DeepSeekHarness context manager to drive profiles and sessions.— DeepSeek Harness docs
Typert gateway
The Typert gateway is the internal service-exposure mechanism between host and client, using @Remote and @RemoteScope to control visible methods.— DeepSeek Harness docs
sdk-minimal
sdk-minimal is a minimal profile for SDK use, reducing plugin and tool dependencies for scripted calls.— DeepSeek Harness docs
JSONL
JSONL is a log format with one JSON object per line; DeepSeek Harness writes session logs in this format under DSH_HOME/sessions.— DeepSeek Harness docs

Sources