Files
deepseek-harness/examples/python-sdk-agent
Tianyi Cui 79a8f667f7 refactor(python): launch the minimal example through sdk-minimal
Make minimal.py select the shipped sdk-minimal profile directly and pass its selected model into the profile-owned adapter catalog. The Python SDK still starts only the bundled dsh CLI with an explicit Harness home; it no longer supplies an invocation overlay for this mode.

Drive both the source keyless process test and installed-wheel smoke through the same named profile. The keyless test pins the generated profile manifest and exact two-tool model request, while the packaged smoke keeps the persistent-shell, editor, session-log, and model-visible snapshot evidence.

Delete minimal.patch.yml and the unused complete-config/replay fixtures. Their composition now has one owner in @deepseek-ai/dsh-sdk-minimal, so the example and tests cannot drift into separate launch trees.
2026-08-24 17:28:28 +08:00
..

python-sdk-agent

English | 中文

Runnable Python SDK example over the sole application launcher, dsh --profile sdk. The Python client owns JSON-RPC stdio; the profile owns the agent composition, persistence, permissions, and plugins.

Run the minimal agent

Install deepseek-harness-sdk, export a model credential, then supply an isolated Harness home and workspace:

export DEEPSEEK_API_KEY=sk-your-key-here
python examples/python-sdk-agent/minimal.py \
  --dsh-home /absolute/path/to/example-dsh-home \
  --workspace /absolute/path/to/disposable-workspace \
  --session-id example-001 \
  "Inspect the repository and fix the failing tests."

Set DEEPSEEK_BASE_URL for a compatible proxy, DSH_MODEL for the default model, or DSH_SYSTEM_PROMPT for the deployment persona. --model and --profile override their script defaults. The selected home stores the generated profile and Zstandard session logs under sessions/; the script never reads ~/.dsh implicitly.

minimal.patch.yml is an ordered overlay on the shipped SDK profile. Its root-agent tool allowlist exposes exactly:

  • owner-scoped persistent bash
  • str_replace_editor with view, create, str_replace, and insert

The allowlist excludes every other current or later global tool without requiring a disable entry for each base row. A complete deployment persona suppresses unrelated tool-guidance sections; runtime-context messages, local instruction discovery, compaction, and the conflicting one-shot Bash row are disabled separately. The overlay inserts the local PTY and persistent Bash providers and sets the editor output limit to 16,000 characters. Other SDK-profile services remain mounted, including persistence, policy, settings, credentials, and providers.

This variant is intentionally POSIX-only. Its persistent PTY and editor can modify any path available to the runtime process, so use a disposable checkout or container.

Add plugins

Use the runtime wheel's dsh command against the same explicit home for persistent profile changes:

export DSH_HOME=/absolute/path/to/example-dsh-home
dsh plugin --profile sdk add file:/absolute/path/to/my-plugin-bundle

The Python call can also pass additional absolute patch paths in patches=(...); later files win. A selected profile must retain @deepseek-ai/dsh-sdk-app or another JSON-RPC server row. Complete standalone Cordis files in this directory remain test fixtures for lower-level composition coverage; they are not Python SDK launch interfaces.

See the Python SDK tutorial and SDK reference.