Files
deepseek-harness/examples/python-sdk-agent/README.zh.md
T
Tianyi Cui f0f9b294dd docs(python): make the dsh profile runtime current
Document dsh as the only application launcher across architecture, CLI, SDK, app-boot, Python package, contributor, tutorial, and example references. Explain explicit home selection, profile and patch precedence, persistent external plugin installation, the Node-free runtime path, and the absence of complete-config or ~/.dsh fallbacks.

Record the Python profile-runtime decision and update the active naming, installed-wheel, and SEA packaging notes with precise supersession. Regenerate the configuration catalog and module graph after deleting the carrier, update both reviewed languages and pairing records, and classify the retained standalone Cordis files as lower-level test fixtures rather than launch interfaces.
2026-08-24 17:28:27 +08:00

2.3 KiB
Raw Blame History

python-sdk-agent

English | 中文

基于唯一应用启动器 dsh --profile sdk 的可运行 Python SDK 示例。Python 客户端负责 JSON-RPC stdioprofile 负责 agent 组合、持久化、权限与插件。

运行极简 agent

安装 deepseek-harness-sdk、导出模型凭据,然后提供隔离的 Harness home 与 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."

兼容代理使用 DEEPSEEK_BASE_URL,默认模型使用 DSH_MODELdeployment persona 使用 DSH_SYSTEM_PROMPT--model--profile 会覆盖脚本默认值。所选 home 保存生成的 profile,并在 sessions/ 下保存 Zstandard 会话日志;脚本绝不会隐式读取 ~/.dsh

minimal.patch.yml 是随附 SDK profile 上的有序 overlay。它保留 SDK 应用 bundle,但将模型可见行为收窄为:

  • agent 所有的持久 bash
  • 支持 viewcreatestr_replaceinsertstr_replace_editor

该 patch 会省略 Harness 身份与运行时上下文消息、本地指令发现、skill、compaction,以及 plangoaltaskwebsubagentworkflow 工具和 profile 的单次 Bash。它插入本地 PTY 与持久 Bash provider,并把 editor 输出上限设为 16,000 字符。

此变体刻意只支持 POSIX。其持久 PTY 与 editor 可以修改运行时进程可访问的任何路径,因此只应在一次性 checkout 或容器中使用。

添加插件

对同一个显式 home 使用运行时 wheel 提供的 dsh 命令,以进行持久 profile 变更:

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

Python 调用也可以在 patches=(...) 中传入更多绝对 patch 路径;后面的文件优先。所选 profile 必须保留 @deepseek-ai/dsh-sdk-app 或另一个 JSON-RPC server 配置项。本目录中的完整独立 Cordis 文件仍作为底层组合测试 fixture;它们不是 Python SDK 启动接口。

另见 Python SDK 教程SDK 参考