DeconWork 使用教程(中文版)
DeconWork 是独立程序,klynx 仅作为底层依赖库使用。
运行形态分为两个独立进程:
- 主进程:终端对话(ReAct)。
- 心跳进程:定时读取
heartbeat.md并触发自动化任务。
1. 安装
发布安装:
pip install -U deconwork
安装后可直接执行:
DeconWork
首次执行任意 DeconWork 命令时,会自动初始化安装目录下的 deconwork.env 与 deconwork_runtime/。
2. 快速开始
- 初始化配置与运行时文件:
DeconWork config init
- 选择模型并配置 API Key:
DeconWork config model
- 启动主进程(对话):
DeconWork
# 或 DeconWork run
如果当前未完成模型配置(例如缺少 API key),会自动进入 DeconWork config model 向导。
- (可选)在另一个终端启动心跳进程:
DeconWork heartbeat
3. 主进程对话命令
启动 DeconWork 后支持以下命令:
/new:新建会话(生成新会话 ID)。/sessions:查看最近保存的会话 ID。/resume <session_id>:恢复历史会话。/status:查看当前状态(含权限模式/命令执行开关)。/clear:等价于/new。/quit:退出主进程。
说明:每轮对话后会自动将会话按 ID 持久化。
4. 心跳进程命令
持续运行心跳:
DeconWork heartbeat
只触发一次心跳后退出:
DeconWork heartbeat --once
5. 配置命令
DeconWork config show
DeconWork config init
DeconWork config set <KEY> <VALUE>
DeconWork config model --list
DeconWork config model
DeconWork config model --select kimi-k2.5
DeconWork config env path
DeconWork config env show
DeconWork config env show --raw
DeconWork config env set <KEY> <VALUE>
DeconWork config env unset <KEY>
配置工作目录(可选,不配置则默认安装目录):
DeconWork config set DECONWORK_WORKING_DIR <你的项目目录>
6. 权限与沙箱配置
DeconWork 支持两种权限模式:
workspace:工作目录沙箱。global:全局权限(默认,可访问工作目录外路径)。
当前权限实现方式:属于 Agent 工具层约束。workspace 模式通过工具路径校验(virtual_root)限制文件操作范围,并通过 allow-shell 控制命令执行开关。
注意:这不是 OS 级强隔离沙箱;如果需要系统级隔离,请自行配置容器或操作系统沙箱(如 Windows Sandbox / 容器 / 虚拟机)。
查看当前权限配置:
DeconWork config permission
切换权限模式:
DeconWork config permission --mode workspace
DeconWork config permission --mode global
用沙箱语义切换(等价模式切换):
DeconWork config permission --sandbox on # 等价 workspace
DeconWork config permission --sandbox off # 等价 global
控制是否允许 execute_command:
DeconWork config permission --allow-shell true
DeconWork config permission --allow-shell false
分别控制关键文件是否允许写入(默认都为 true):
DeconWork config permission --write-rules false
DeconWork config permission --write-memory false
DeconWork config permission --write-heartbeat false
7. 常用环境变量
DECONWORK_MODEL_PROVIDERDECONWORK_MODEL_NAMEDECONWORK_API_BASEDECONWORK_HEARTBEAT_ENABLEDDECONWORK_HEARTBEAT_INTERVALDECONWORK_HEARTBEAT_LOCK_POLICY(skip_if_busy/wait)DECONWORK_WORKING_DIR(Agent 工作目录,默认安装目录)DECONWORK_MAX_ITERATIONS(单轮最大循环次数,默认200)DECONWORK_APPEND_MAX_TOKENSDECONWORK_PERMISSION_MODE(workspace/global,默认global)DECONWORK_ALLOW_SHELL_COMMANDS(true/false)DECONWORK_ALLOW_WRITE_RULES_FILE(true/false)DECONWORK_ALLOW_WRITE_MEMORY_FILE(true/false)DECONWORK_ALLOW_WRITE_HEARTBEAT_FILE(true/false)
8. 安装目录中的文件布局
DeconWork 会把配置和运行时文件固定到安装目录下:
<install_dir>/
deconwork.env
deconwork_runtime/
rules.md
memory.md
heartbeat.md
conversations/
index.json
<session_id>.json
其中 rules.md、memory.md、heartbeat.md 会作为运行时附加上下文输入。
说明:以上是配置与运行时文件位置;Agent 实际执行的工作目录由 DECONWORK_WORKING_DIR 决定。
9. 本地源码运行
在仓库源码中运行时,可直接使用模块入口:
cd DeconBear/DeconWork
python -m deconwork.runtime
该入口与安装后的 DeconWork CLI 复用同一套实现。
Metadata
Release files for deconwork 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| deconwork-0.0.2.tar.gz | 25.1 kB | Without provenance | Details for deconwork-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deconwork-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for deconwork-0.0.2-py3-none-any.whl |
Total release size: 52.0 kB
Release files / deconwork-0.0.2.tar.gz
| Download URL | deconwork-0.0.2.tar.gz |
|---|---|
| Size | 25.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53a3b48d06219a5421bd805698100f619c4f8ee9fc3383d8b7865f777f666905
|
|
BLAKE2b-256 checksum How to use checksums |
6fe6030e763d988b26efcac979ceb3f78f1f8be5b52b37c1d94734e5d4bec16b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / deconwork-0.0.2-py3-none-any.whl
| Download URL | deconwork-0.0.2-py3-none-any.whl |
|---|---|
| Size | 26.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4404e5d3f42285e71b9952cb174e6e5dc10c7676b28ec4847e17ef1821eecb03
|
|
BLAKE2b-256 checksum How to use checksums |
529710a63a1f30ebbd5f5f0e3c8add3e69e461049da94dc7b13f811ca8297f74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for deconwork 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.