Run Python on the local NVIDIA CUDA GPU from DeepSeek Harness: device status, foreground and detached jobs, durable logs, and a measured peak-VRAM figure per run.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Void-LifeStream/dsh-cuda
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
Run Python on your local NVIDIA GPU from DeepSeek Harness.
Three tools plus one skill, so an agent can do numerical work on the GPU instead of occupying the CPU: device status, foreground and detached runs, durable logs, and a measured peak-VRAM figure for every run.
中文说明见 README.zh.md.
What you get
| Name | Purpose |
|---|---|
cuda_status |
device memory, utilization, GPU processes, every CUDA-capable Python on the machine, recent jobs |
cuda_run |
submit Python source (code=) or a .py file (script=, plus args=); foreground or background=true |
cuda_job |
follow one job: logs / wait / kill / info, by exact id, unique prefix, or latest |
skill cuda-compute |
the local terrain, how to write the code, the traps — loaded on demand by the model |
Every run gets its own directory under ~/.dsh/gpu-runs/<job-id>/:
script.py a copy of what actually ran
_runner.py the wrapper that records resource facts
stdout.log full stdout (the tool returns only a tail)
stderr.log full stderr
job.json the durable record: pid, cwd, argv, timestamps, status
result.json written by the wrapper: ok, exit_code, elapsed_s, peak VRAM
peak_alloc_MB comes from torch.cuda.max_memory_allocated() inside the child, so the
number is measured, not estimated. A program can read DSH_CUDA_JOB_DIR to write its own
artifacts there — they are listed back to the model automatically.
Five design decisions worth knowing
- Exceeding the foreground budget promotes a run to background instead of killing it.
A two-hour simulation should not die because the caller stopped waiting. The result comes
back with
status: runningand a note; follow it withcuda_job. Only an explicit cancellation actually terminates. - Background runs are detached and survive a harness restart — again on purpose,
because long compute should not be tied to a UI lifecycle. The cost is that "leftover"
jobs are found by asking, which is what
cuda_statusis for. - A detached run's outcome is settled from
result.json. No parent is left to record the exit code, so once the pid disappears the wrapper's own fact sheet decidesdone/failed; only its absence meanslost. - The skill is registered through a borrowed provider. The catalog keeps the summary
and every load re-reads the file, so editing the skill body needs no restart. Skill
registration is a soft dependency: a deployment without
ctx.skillsstill gets the tools. lib/engine.jsimports nothing from DSH, so the engine is driven directly by plain Node in the test suite — see below.
Install
The package lives in a workspace directory. Install it through the harness rather than by
hand-editing the profile (the bundled cordis-plugin-development skill explains why):
plugin_manager action: install_bundle target: <absolute path to this directory>
Bundle code is only loaded at harness startup — restart DSH after installing or editing.
(The installer's applied result means the config was written and the entry imports
cleanly; it does not mean the tools are already visible to a running agent.)
Configure
Precedence for every setting: explicit plugin config → environment variable →
~/.dsh/cuda.json → built-in discovery.
| Environment variable | Meaning | Default |
|---|---|---|
DSH_CUDA_PYTHON |
interpreter to use | discovered |
DSH_CUDA_RUNS_DIR |
where job directories live | ~/.dsh/gpu-runs |
DSH_CUDA_TIMEOUT_MS |
foreground budget | 300000 |
DSH_CUDA_MAX_TIMEOUT_MS |
ceiling for a caller-supplied budget | 1800000 |
DSH_CUDA_MAX_OUTPUT_CHARS |
output returned to the model per stream | 12000 |
~/.dsh/cuda.json is the convenient place for a machine-specific interpreter (an embedded
Python, a conda env):
{
"pythonPath": "C:\\path\\to\\python.exe",
"pythonCandidates": ["C:\\path\\to\\python.exe"],
"runsDir": "D:\\gpu-runs"
}
A malformed file is ignored rather than fatal.
Interpreter discovery
With nothing configured, the plugin probes every python/python3 on PATH and a few
usual install locations, then picks the first candidate that exists. cuda_status reports
what each one can actually do (torch version, CUDA availability, device name, bf16), and
the probe result is cached for an hour.
An interpreter only counts if it has torch with CUDA. A system Python without torch
is reported but never chosen. Embedded interpreters shipped with image-generation tools
(ComfyUI, Stable Diffusion WebUI) work well — point DSH_CUDA_PYTHON at them.
Requirements
- DeepSeek Harness, Node 22+
- Any CUDA-capable NVIDIA GPU — the card model does not matter, and nothing here is tuned for
one.
cuda_statusreports the model, memory, compute capability and bf16 support at runtime, so the documents deliberately do not hard-code them. - The one real constraint is driver ↔ torch. A CUDA build of PyTorch needs a driver at least as
new as the CUDA runtime it was compiled against; if
torch.cuda.is_available()isFalse, that mismatch (or a CPU-only torch wheel) is the usual cause.cuda_statusshows the driver and each interpreter's CUDA availability side by side, so the problem is visible before writing any code. - A Python with
torch+ CUDA. The rest (numpy, triton, scipy…) is optional.
For writing custom kernels the plugin's skill documents what actually works: use
triton if it is installed. numba.cuda needs
libNVVM (shipped with the CUDA Toolkit) and fails with
NvvmSupportError: libNVVM cannot be found when the Toolkit is absent — a common trap.
Tests
110 checks across three suites. All of them run with plain Node — no harness restart, no test framework:
node test/selftest.mjs # 36 engine, against the real GPU
node test/harness.mjs # 46 plugin: mock context drives apply(), then the tools run
node test/lossless.mjs # 28 every tool value crosses the wire (see below)
selftest.mjscovers both run modes, promotion, cancellation, log tails, artifact collection and argument validation on real hardware.harness.mjsbuilds a fake cordis context with exactly the surface the plugin uses, soapply()and every tool branch are exercised without the harness.lossless.mjsdeserves its own line: DSH refuses a tool value that is not lossless JSON (visitJsonValuein@deepseek-ai/dsh-api-gatewayrejectsundefined,NaN,-0, class instances, array holes and cycles). A singleundefinedfield is enough to make a perfectly working tool answervalue is not lossless JSON, and no mock-based test catches it. The suite reimplements that rule verbatim and adds six deliberately broken values to prove the check itself has teeth.
Known limits
- Windows/WDDM:
nvidia-smireports no per-process VRAM and mixes graphics processes into the GPU process list.cuda_statussays so rather than pretending otherwise. - Concurrency:
cuda_runis registered as not concurrency-safe, so the harness will not overlap two runs; large concurrent jobs would compete for VRAM anyway. - No CUDA Toolkit integration:
nvccis never invoked. Everything runs through the interpreter, which keeps the plugin zero-install.
License
MIT — see LICENSE.
Links
More in this category
Tencent/WeKnora#dsh-weknora★ 38608
Four read-only tools over a WeKnora knowledge base: list knowledge bases, hybrid passage search, reassemble one document's chunks in order, and WeKnora's own cited RAG or ReAct-agent answer with a resumable session id.
DayuanJiang/next-ai-draw-io#dsh-plugin★ 37289
Draws draw.io diagrams in DeepSeek Harness through the next-ai-drawio MCP server: the link in the reply opens a live preview in the right sidebar, you can edit the diagram by hand, and each AI change is a version you can restore. Node.js 18+; npx downloads the MCP server on first use.
yikart/AiToEarn#dsh-plugin-aitoearn★ 28947
Generate copy, images and short videos, and publish with one click to Douyin, Kuaishou, Xiaohongshu, WeChat Official, Bilibili, Facebook, TikTok and more, covering the full content lifecycle from creation to publishing and monetization.
superdesigndev/treg★ 10049
Tool catalog for agents: search ~2,600 external endpoints (SEO and SERP, backlinks, social, people and company enrichment, ad libraries, scraping) by the task you want done, read each one's parameters and per-call price, then call it with the credential injected server-side. Ships the skill plus an MCP row that stays disabled until TREG_TOKEN is set.
T-Auto/dsh-ops★ 6112
Provides bash, PowerShell 7, and high-performance Rust tools for DSH on Windows to reduce token usage.
Hithink-Tech-Org/Financial-API#hithink-finance★ 4761
Query Hithink Finance data in DeepSeek Harness, view charts in chat, and save refreshable dashboards.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.