Introduction¶
DeepSeek Harness (DSH) adopts an “everything is a plugin” architecture and does not natively include image generation capabilities. When developing agent applications, agents often need to generate images. Directly calling commercial APIs poses cost and privacy issues, while deploying Stable Diffusion pipelines is usually complex.
The dsh-comfyui-image plugin solves this problem. It uses a locally running ComfyUI as the backend and only exposes a single Agent tool, generate_image, to the outside world. Developers do not need to worry about the internal implementation of ComfyUI; they can achieve text-to-image, image-to-image, inpainting, and background removal simply through this tool.
What is it¶
- Plugin Name:
dsh-comfyui-image - Maintainer: wbb316
- Core Value: Zero third-party runtime dependencies (only uses Node.js built-in
fetch/FormData), connects to local ComfyUI as the backend, and adds only one tool to the Agent side.
Core Features¶
This plugin provides the following capabilities through a unified Agent tool generate_image:
- Text-to-Image: Generate images based on text prompts.
- Image-to-Image: Redraw based on input images.
- Inpainting: Redraw images based on masked areas.
- Background Removal: Remove image backgrounds.
The plugin comes with a doctor self-check script and 88 tests to ensure the environment is correct. Generated images are accompanied by a .json metadata sidecar file containing full parameters and reproduction workflows.
Installation and Prerequisites¶
Before installing the plugin, the following environmental requirements must be met:
- DSH: Version must support the tool registry.
- Node.js: Version
>= 20(relies on built-infetch,FormData, andBlob). - ComfyUI: A locally accessible service, default address is
http://127.0.0.1:8188, and there must be base model files in themodels/checkpointsdirectory.
The installation command is as follows:
dsh plugin --profile <your profile> add dsh-comfyui-image
Agent Usage¶
After enabling the plugin, the Agent will automatically recognize and be able to use the generate_image tool. Developers only need to input natural language, and the Agent will automatically fill in the parameters.
For example:
Help me generate an image of a Corgi astronaut on the moon, digital art style
The result returned by the tool includes the absolute path of the generated image, the metadata path, and detailed generation parameters.
Configuration Mechanism¶
The configuration priority from high to low is as follows:
- Plugin configuration (profile’s cordis.patch.yml)
- Configuration file (
~/.dsh-comfyui-image/config.json) - Environment variables (such as
COMFYUI_URL) - Built-in default values
Changes to the configuration file take effect immediately without restarting DSH.
Notes¶
- Background Removal: This feature requires ComfyUI to have third-party background removal nodes installed (such as
ComfyUI_essentials,ComfyUI-BRIA_AI-RMBG, etc.); otherwise, it cannot be used. - File Overwriting: The plugin automatically handles file overwriting. If the target file already exists, it will automatically add suffixes like
-1,-2, etc.
Conclusion¶
dsh-comfyui-image provides a low-cost local image generation solution for the DSH ecosystem. Through a standardized tool interface, it allows Agents to conveniently call local ComfyUI capabilities, making it suitable for scenarios with high requirements for data privacy and generation costs.
- GitHub Repository: wbb316/dsh-comfyui-image
- Plugin Directory: dsh-comfyui-image - SkillHub