Upgrade DSH Python SDK: wheel and bundled dsh runtime
Upgrading the DeepSeek Harness Python SDK is not just swapping a Python dependency: the wheel also contains a matched native runtime and the dsh command. The SDK lazily starts a dsh --profile sdk-minimal process and reuses it until the context exits. So the upgrade sequence is install the target wheel, restart the host process, and verify the profile—not just step one.
DeepSeek Harness: Three things move together
One wheel upgrade changes the Python API, the bundled dsh runtime, and the bundled profile templates. What each affects:(source)
| Component | Effect after upgrade |
|---|---|
| Python package | DeepSeekHarness API and arguments |
| Bundled runtime | dsh command, profile parsing, tools, subsystems |
| Bundled profiles | Default tree and available tools in sdk-minimal |
The official docs note that sdk-minimal does not contain dsh-base; it inserts a complete tree on an empty root. Tools added to the base profile later do not appear implicitly. If a tool disappears after an upgrade, check this boundary before assuming the install failed.
The wheel also packages the full web profile and frontend assets, but dsh web is a separate CLI app and cannot serve a Python SDK client. Keep “SDK bundled runtime” and “separately installed dsh” distinct.
DeepSeek Harness: What to record first
Record versions and a configuration baseline before upgrading, or you will have nothing to compare against. Three items:(source)
- Python package version —
python -m pip show deepseek-harness-sdk. Expected: note the exact version. - Bundled dsh version —
dsh -Vinside the same venv. Expected: confirm it comes from this venv, not another global install. - sdk-minimal config —
dsh --profile sdk-minimal --dump-configif the profile exists. Expected: save the effective tree for a later diff.
If the profile is not initialized yet, run dsh --profile sdk-minimal --dump-default-config >/dev/null first so the profile files exist.
DeepSeek Harness: Upgrade steps
Install the target version in the same venv, restart the Python host, then verify with a minimal task. Steps:(source)
# 1. Activate the SDK virtualenv
. .venv/bin/activate
# 2. Install a pinned target version
python -m pip install --upgrade "deepseek-harness-sdk==<target>"
# 3. Check the bundled runtime
dsh -V
- Pin the version — production should not float to “latest” during a routine upgrade. Expected:
pip showreports the target version. - Restart the host process — close every process using
DeepSeekHarness, then start again. Expected: the new runtime loads at startup. - Run a minimal task — use
minimal.pyor a read-only task. Expected:final_responsereturns normally. - Compare the profile — dump the effective tree and diff against the baseline. Expected: no field was silently removed or rewritten.
Step 2 is the most commonly skipped: a running process keeps the dsh process it started until the context exits, even after the wheel on disk changes.
DeepSeek Harness: Three upgrade strategies
In-place, side-by-side, and version pinning suit different risk levels. Compare:(source)
- In-place venv — install the new version into the existing venv. Expected: least disk, but rollback means reinstalling the old version.
- Side-by-side venv — create
.venv-next, validate, then switch. Expected: rollback is a symlink or shell switch. - Pinned version + mirror — pin the SDK in requirements and install from an internal mirror. Expected: consistent across machines, insulated from upstream releases.
In every strategy, do not delete DSH_HOME; profiles, plugins, and sessions live there.
DeepSeek Harness: Rollback and verification commands
Write down the old version before upgrading so rollback is not a guess. A practical set:(source)
python -m pip show deepseek-harness-sdk | grep ^Version
dsh -V
# Roll back to the recorded version
python -m pip install "deepseek-harness-sdk==<old>"
dsh --profile sdk-minimal --dump-config > /tmp/sdk-config-after.yml
- Record the old version — one line from
pip show, one fromdsh -V. Expected: a clear rollback target. - Reinstall the old version — pin it in the same venv. Expected: no fallback to another profile.
- Restart and verify — rerun the minimal task and check
final_response. Expected: the Python package and runtime match. - Compare config — dump the profile before and after. Expected: no field silently disappears.
Rollback only swaps the wheel; DSH_HOME stays. Sessions and plugins remain, but an older version may not understand a newer format, so follow the startup prompt if migration is required.
DeepSeek Harness: Common incompatibilities
Most post-upgrade failures are old patches no longer matching the new tree, not a broken install. Four cases:(source)
- Patch points at a removed plugin — startup reports an unresolved package. Expected: delete the corresponding insert from
cordis.patch.yml. str_replace_editorpatch stops working — the package name or mount method changed. Expected: regenerateeditor.patch.ymlfor the new version.sdk-minimalloses a tool — it does not containdsh-baseand does not inherit new base tools. Expected: add the tool with a patch if needed.- Session format migration prompt — the new version wants to migrate old JSONL. Expected: follow the prompt instead of deleting logs.
If startup fails outright, read whether the error is “missing server entry”, “unresolved plugin”, or “invalid patch”; none of them fall back to another combination.
DeepSeek Harness FAQ
Do I need to reinstall plugins after upgrading?
Not necessarily. Plugins live in DSH_HOME and survive the wheel upgrade. If a plugin is incompatible with the new runtime, update or reinstall it according to its documentation.
Can a global dsh upgrade the SDK runtime? No. The SDK uses the runtime in its own wheel; a global dsh is another installation. The versions can differ, so record both to avoid checking the wrong one.
How do I roll back a failed upgrade?
A side-by-side venv switches back directly; an in-place upgrade reinstalls the old wheel and restarts. DSH_HOME stays untouched.
The short version: treat an SDK upgrade as three things—wheel, runtime, profile—and restart the process; skipping the restart means you did not upgrade.
FAQ
DeepSeek Harness: no. The wheel contains a matched native runtime and the dsh command, so upgrading replaces the Python package and the bundled runtime together. Restart the Python host afterward; the SDK lazily starts a dsh process and reuses it until the context exits.
DeepSeek Harness: normal SDK runs do not. The wheel bundles a matched native runtime. Only some plugin management commands, such as dsh plugin add, need pnpm; starting an installed SDK does not.
DeepSeek Harness: no. Configuration lives in $DSH_HOME/profiles/sdk-minimal/cordis.patch.yml and the home patch, and upgrading the wheel does not delete the home. New versions can still change fields or the plugin tree, so dump the profile and compare after upgrading.
DeepSeek Harness: they are separate installations. The SDK wheel also packages the web profile and frontend assets, but dsh web is a separate CLI app. If you also installed dsh globally, check both versions to avoid drift.
DeepSeek Harness: yes. SDK sessions are uncompressed JSONL under the explicit dsh_home/sessions directory. Upgrading does not delete them. If the new version requires a format migration, follow the startup prompt instead of deleting the logs.
Related Terms
- deepseek-harness-sdk
- deepseek-harness-sdk is the official DeepSeek Harness Python package. It installs a matched native runtime wheel and the dsh command, and exposes the DeepSeekHarness class for driving a dsh profile.— DeepSeek Harness docs - Python SDK
- bundled runtime
- The bundled runtime is the native dsh runtime shipped inside deepseek-harness-sdk. Normal SDK runs do not need system Node.js, and the runtime version moves with the Python package.— DeepSeek Harness docs - Python SDK
- sdk-minimal
- sdk-minimal is the minimal SDK profile. It builds a complete tree on an empty root without dsh-base and contains only the SDK protocol, DeepSeek adapter, local execution, and persistence.— DeepSeek Harness docs - Python SDK
- dsh_home
- dsh_home is the isolated SDK home holding profiles, installed plugins, credentials, settings, and session logs. The SDK only uses the home you pass explicitly and does not read ~/.dsh.— DeepSeek Harness docs - Python SDK
Sources
- DeepSeek Harness docs - Python SDK· deepseek-ai
- DeepSeek Harness reference - dsh CLI behavior· deepseek-ai