dsh-agnes-image: Generate and save Agnes Image 2.5 Flash images within DSH sessions

Preface

In DeepSeek Harness (DSH), the common difficulty in letting agents “draw” lies not in the prompt itself, but in the reliability of the pipeline: whether the interface returns an external link or raw bytes, whether the second-hop download fails after successful generation, long connection timeouts caused by IPv6 and happy-eyeballs, and whether error messages are sufficient for the model to continue reasoning. Many image-related plugins only provide a thin layer of fetch encapsulation; the agent receives a URL or an empty error, making it difficult to directly display, compare, or reference the image within the session workspace.

The following introduces the community plugin dsh-agnes-image (maintained by Lijianan-123). It exposes a single tool in DSH, connecting to Agnes Image 2.5 Flash (agnes-image-2.5-flash). It supports text-to-image, single-image reference editing, and multi-image composition, writing the results as PNG files within the session workspace. This facilitates subsequent viewing via read_image or passing them back into the image parameter.

What is this

dsh-agnes-image is the DSH plugin corresponding to the npm package @dsh-external/dsh-agnes-image (current version 0.2.0, MIT license). For source code and documentation, see GitHub: Lijianan-123/dsh-agnes-image; community directory page: skillhub.cn/plugins/Lijianan-123/dsh-agnes-image. The directory site is an independent community site and has no official affiliation with DeepSeek / High-Flyer.

The plugin is aimed at developers already using DSH web, desktop, or headless profiles: it can be invoked via natural language or tool parameters on the agent side, requiring no additional runtime npm dependencies (the implementation relies only on node:https and the harness SDK).

Core Features

Three modes, one set of parameters

Whether to pass a reference image is determined by the image parameter; the model does not need to choose between multiple tools:

Behavior Condition
Text-to-Image Omit image
Image-to-Image Provide one reference image (public https URL or data: URI)
Multi-image Composition Provide multiple reference images

Files saved to disk, not just URLs returned

Generation results are retrieved from the API as inline base64 and written to a PNG path within the current session workspace (defaulting to the agnes-images/ directory). The agent receives a local path, facilitating rendering, diffing, or use as input for the image parameter in the next turn.

Connection and Retry (Implementation Highlights)

The author documented empirical conclusions in the README (not just generic advice): forcing IPv4 for the Agnes endpoint and disabling happy-eyeballs can converge the frequent 20s+ ETIMEDOUT issues across all addresses to a stable connection of approximately 9s. It performs limited retries (default 3 times, backoff 600/1200 ms) only on connection-level failures where no HTTP response is received; HTTP status codes and AbortError are not retried. Errors are normalized into single-line descriptions including the attempt count. By default, it uses a single-hop inline base64 flow to avoid the two-stage pipeline issue of “generation successful, but second-hop download failed.”

Hot-swapping API Keys

The API Key is resolved in order for every call and is not cached: Plugin inline config → harness credential storage → environment variables (AGONES_API_KEY / AGNES_API_KEY) → key file. After rotating keys, the change takes effect on the next call without needing to restart the harness.

Environment and Installation

Requires Node.js 22+ and a configured DSH profile (one of web, desktop, or headless).

Install from GitHub (based on the README original; web is just an example profile, replace it according to your environment):

dsh plugin --profile web add github:Lijianan-123/dsh-agnes-image

Restart the harness after installation, then configure the API Key (choose one):

# Environment variable
export AGNES_API_KEY=sk-...

Or via the harness credential storage ~/.dsh/.credentials.yaml using refs.AGONES_API_KEY, or the key file ~/.dsh/agnes-image.json (formatted as {"apiKey": "sk-..."}).

The plugin runs with the permissions of the current dsh process; it is recommended to review the repository source code and license before installation, and to keep keys secure.

Typical Usage

After installation, simply describe your request in natural language within the conversation. For example, as illustrated in the README:

Generate a 16:9 hero image for my landing page: a glass-and-steel medical device on a dark background, soft rim light, product photography style.

Take this UI screenshot and this logo, compose them into a clean App Store preview card.

Tool parameters (summary; see the repository README for full details):

Parameter Required Description
prompt Yes Visual or editing intent; recommended structure: Subject + Scene + Style + Lighting + Composition + Quality
size No 1K / 2K / 3K / 4K, default 2K
ratio No 1:1, 3:4, 4:3, 16:9, 9:16, 2:3, 3:2, 21:9, default 1:1
image No Reference image; one for Image-to-Image, multiple for Composition
model No Default agnes-image-2.5-flash
output_path No Output path relative to session workspace; default agnes-images/<timestamp>-<prompt-slug>.png

Example resolutions aligned with official docs (measured table in README): e.g., 1:1 at 2K is 2048×2048, 16:9 at 2K is 2624×1472.

Optional Configuration

The Loader can override the following fields on top of default values (all optional):

{
  "apiKey": "",
  "credentialRef": "AGONES_API_KEY",
  "endpoint": "https://apihub.agnes-ai.com/v1/images/generations",
  "model": "agnes-image-2.5-flash",
  "defaultSize": "2K",
  "defaultRatio": "1:1",
  "outputDir": "",
  "timeoutMs": 300000,
  "attempts": 3
}

When outputDir is empty, the output directory is <session cwd>/agnes-images.

Use Cases and Notes

Suitable for: Developers already building agents in DSH who need Agnes Image 2.5 Flash for text-to-image / reference image editing / multi-image composition, and want results saved directly to the session workspace to reduce external links and second-hop download failures.

Notes:

  • You need to apply for and configure an Agnes API Key yourself; network behavior (forcing IPv4, retry strategy) is tested against the endpoint documented by the author, so watch for plugin updates if the upstream changes.
  • Reference images must be public HTTPS or data: URIs; generation time is bounded by timeoutMs (default 300000 ms).
  • For community plugin stars and evolution, refer to GitHub; reading the Engineering deep-dive in the README before use helps understand failure surfaces and payload details (e.g., in reference mode, response_format must be placed inside extra_body).

Conclusion

dsh-agnes-image consolidates the three generation modes of Agnes Image 2.5 Flash into a single DSH tool, writes PNGs to the session workspace, and makes verifiable technical trade-offs regarding connections and image retrieval paths. If you are expanding “practical image capabilities” within the harness ecosystem, you can obtain the plugin from the community directory or GitHub, install it according to the README, configure the key, and try it directly in your conversation.

  • Directory Page: https://www.skillhub.cn/plugins/Lijianan-123/dsh-agnes-image
  • GitHub: https://github.com/Lijianan-123/dsh-agnes-image
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye