Introduction¶
DeepSeek Harness (DSH) provides a plugin-based architecture. When an agent needs to operate a local ComfyUI instance directly, it often faces difficulties with queue management, interrupting tasks, retrieving history, or uploading assets. dsh-comfyui-ctl is a native DSH plugin designed to fill this gap, allowing agents to manage ComfyUI as if they were operating a local process.
What It Is¶
This is a network-based tool plugin maintained by liyi3068238601-oss. It provides a set of tools that allow the DSH host (Cordis) to communicate with a local ComfyUI instance, enabling queue control, history and output management, model inventory, and image upload and generation.
The core logic is encapsulated in the zero-dependency ComfyClient module, decoupled from DSH, and can be reused by other frameworks in the future.
Core Features¶
The plugin registers 11 tools, covering the core interaction scenarios of ComfyUI:
- Queue Control
comfyui_queue_get: View running and pending tasks.comfyui_interrupt: Interrupt the current generation task.comfyui_queue_delete: Clear the queue or delete a specific pending item.
- History and Outputs
comfyui_history_get: Query history (can be filtered by prompt id).comfyui_output_list: List output files (supportsauto/history/directorymodes).comfyui_output_get: Retrieve an output image by filename (returned inline).
- Models and System
comfyui_models_list: Inventory models (supports checkpoints, loras, vae, etc.).comfyui_system_stats: Get ComfyUI version, Python version, and VRAM/memory status.comfyui_nodes_list: List node classes and extensions.
- Upload and Generation
comfyui_upload_image: Upload a local image to the ComfyUI input directory.comfyui_generate: Submit an API-format workflow and wait for the result.
Installation and Enablement¶
Install the plugin into the Web profile:
dsh plugin --profile web add github:liyi3068238601-oss/dsh-comfyui-ctl
After installation, restart DSH. The plugin package includes cordis.patch.yml, which automatically adds the plugin to the profile with the comfyui-ctl ID, so no manual insert is required.
Configuration Options¶
The plugin configuration is located in cordis.patch.yml for the Web profile. The following are common configuration options:
| Key | Default | Description |
|---|---|---|
baseUrl |
http://127.0.0.1:8188 |
ComfyUI service address |
outputDir |
(empty) | ComfyUI output directory; if set, comfyui_output_list supports directory mode |
allowedUploadRoots |
[] |
List of allowed local absolute paths for uploads; an empty array disables path uploads |
requestTimeoutMs |
30000 |
Timeout for a single HTTP request |
pollIntervalMs |
1500 |
Polling interval while waiting for generation to complete |
generateTimeoutMs |
300000 |
Maximum wait time for synchronous generation tasks |
maxInlineImages |
4 |
Maximum number of images returned inline in generation results |
maxUploadBytes |
67108864 |
Size limit for a single uploaded file (64 MiB) |
Configuration Example:
- id: comfyui-ctl
config:
baseUrl: 'http://127.0.0.1:8188'
outputDir: 'C:\path\to\ComfyUI\output'
allowedUploadRoots:
- 'C:\Users\your-name\Pictures'
Typical Usage¶
1. View Queue and System Status¶
Use comfyui_queue_get to view current tasks, and use comfyui_system_stats to check VRAM usage.
2. Submit a Generation Task¶
Use comfyui_generate to submit an API-format prompt. Setting wait: true enables synchronous waiting for the result.
Example Prompt:
{
"prompt": {
"1": {
"class_type": "KSampler",
"inputs": {}
}
},
"wait": true,
"timeout_ms": 300000,
"inline_images": true
}
If wait is not set, only prompt_id is returned, and you can later query its status with comfyui_history_get.
3. Inventory Models¶
Use comfyui_models_list to retrieve the model inventory, with support for both JSON and plain-text response formats.
Use Cases and Notes¶
- Use Cases: DSH agents that need to run ComfyUI locally, for queue scheduling, generation task management, and asset processing.
- Permissions and Security: This plugin only reads from / controls a local ComfyUI instance. Do not point
baseUrlat an untrusted remote instance. - Security Mechanisms: Upload functionality is strictly restricted and requires configuring
allowedUploadRoots. The plugin normalizes and checks file paths, rejecting spoofed extensions, oversized files, and..subdirectory traversal. - Dependency Requirements: The runtime Node version must be >= 22.19. Dependencies include
@deepseek-ai/schemasteryand the DSH host (Cordis).
Conclusion¶
dsh-comfyui-ctl wraps the ComfyUI HTTP API as DSH tools, lowering the integration barrier between agents and local image generation workflows. Developers can override configuration directly in cordis.patch.yml to quickly enable local generation capabilities.