Media generation

From ahang1598/doubao-workbuddy-qwenwork-skills · View interactive version

Media generation is an AI agent skill from the GitHub repository ahang1598/doubao-workbuddy-qwenwork-skills. Generate or edit images with automatic model selection or a supported model explicitly requested by the user, generate videos, or create music as asynchronous media artifacts. Use this skill when the user asks for text-to-image, image editing, image variations, choosing a supported model for image g

How to use this skill

Skill file

Media Generation

Use QwenWork built-in media tools. Do not invoke a media provider directly and do not use text-to-speech for music requests. Do not invoke native ImageGen/image_gen or WebSearch/web_search/websearch tools; use the canonical QwenWork tools below. The web_search image-generation parameter is a grounding option, not a tool name.

Required workflow

  1. Choose exactly one submit tool:
  1. Keep the returned task_id.
  2. Classify the generated files before waiting:
  1. Call qwenwork_media_task with action: "wait", that task_id, the chosen artifact_purpose, and a friendly semantic output_name.
  2. When wait returns success: true, follow should_present:
  1. Only after the final deliverable files are presented successfully, tell the user the requested media artifacts are ready.

The submit tools are asynchronous. Never describe a submitted task as a completed artifact.

Output naming

Always pass output_name when waiting for a completed artifact:

Model selection

Omit model by default. QwenWork selects a compatible logical model alias when the user does not name a supported model.

When the user explicitly requests a supported model, you must pass its canonical public alias instead of refusing the request or claiming that the image tool only supports a default model:

Pass only the canonical aliases shown above. Do not pass gpt-image-2 or gpt-image2 to the tool, expose provider endpoint paths or internal model IDs, invoke any native ImageGen/image_gen tool, or direct the user to a provider API for a supported request.

Image capability mapping

Use qwenwork_image_generate for every image request. Do not call native ImageGen or image_gen tools.

For local images, use absolute paths. The files must be inside the current workspace or an additional directory granted to the conversation. HTTPS URLs and image data URLs are also accepted.

Omit model by default. QwenWork selects a compatible image model from the requested controls. Do not combine model-specific controls unless the selected model supports them:

For Open Image 2 generation and editing, size accepts auto or WIDTHxHEIGHT with a lowercase x. Width and height must each be positive integers divisible by 16 and no greater than 3840; width divided by height must be between 1/3 and 3, inclusive, and width multiplied by height must be between 655360 and 8294400 pixels, inclusive. Sizes such as 1280x1024, 3840x2160, and 2160x3840 are valid examples, not an exhaustive list. Preserve a requested valid size; if the size is invalid, explain the constraint before choosing a different size. If the user does not request a size, omit it and leave the default to the upstream provider.

Text to image

Call qwenwork_image_generate with:

{
  "mode": "generate",
  "prompt": "A premium wireless earbud on a matte-black pedestal, soft rim lighting, editorial product photography, no text.",
  "aspect_ratio": "1:1",
  "resolution": "2K"
}

Image editing with a requested model, size, and quality

Call qwenwork_image_generate with:

{
  "mode": "edit",
  "model": "open-image-2",
  "prompt": "Keep the product shape and logo unchanged. Replace the background with a warm minimalist studio and add a soft natural shadow.",
  "images": ["/absolute/path/product.png"],
  "size": "1280x1024",
  "quality": "medium",
  "output_format": "png"
}

Open Image 2 generation with a requested custom size and quality

Call qwenwork_image_generate with:

{
  "mode": "generate",
  "model": "open-image-2",
  "prompt": "A silver travel mug on a plain white background, front-facing product photography, crisp edges, no text.",
  "size": "1280x1024",
  "quality": "high"
}

Video capability mapping

Select the mode from the user's inputs:

Supported scope:

For local images, use absolute paths. The files must be inside the current workspace or an additional directory granted to the conversation. For multi-reference video, pass 1–9 images.

Seedance 2.0's 4k output uses 10-bit H.265 in an MP4 container. Present the original generated file without silently transcoding or reducing its resolution. If the preview cannot play it, keep the original downloadable artifact and explain that playback requires a player with 10-bit H.265 support. Do not promise a fixed width and height solely from the 4k setting.

Video submission examples

All examples intentionally omit model. Let QwenWork select a compatible model unless the user explicitly names one.

Text to video

Call qwenwork_video_generate with:

{
  "mode": "text_to_video",
  "prompt": "A matte-black wireless earbud rotates slowly in a clean studio, with soft rim lighting and a smooth camera push-in.",
  "duration_seconds": 10,
  "resolution": "4k",
  "aspect_ratio": "16:9",
  "generate_audio": true
}

Single image to video

Call qwenwork_video_generate with:

{
  "mode": "image_to_video",
  "prompt": "Keep the product design unchanged. Add a slow turntable rotation, subtle reflections, and a steady camera push-in.",
  "image": "/absolute/path/product.png",
  "duration_seconds": 8,
  "resolution": "1080p"
}

First and last frames to video

Call qwenwork_video_generate with:

{
  "mode": "first_last_frame_to_video",
  "prompt": "Create a smooth cinematic transition from the opening frame to the closing frame while preserving the subject.",
  "first_frame_image": "/absolute/path/opening-frame.png",
  "last_frame_image": "/absolute/path/closing-frame.png",
  "duration_seconds": 6,
  "resolution": "1080p"
}

Multiple reference images to video

Call qwenwork_video_generate with:

{
  "mode": "reference_images_to_video",
  "prompt": "Use the references to preserve the character, clothing, and visual style across a continuous walking shot.",
  "reference_images": [
    "/absolute/path/character-front.png",
    "/absolute/path/character-side.png",
    "/absolute/path/style-reference.png"
  ],
  "duration_seconds": 10,
  "resolution": "1080p",
  "aspect_ratio": "16:9"
}

Music behavior

qwenwork_music_generate creates music or songs, not spoken narration.

Waiting, interruption, and resume

Waiting is local:

If wait times out with timed_out: true, tell the user that the upstream task is still processing and can be resumed later. Do not submit a duplicate task unless the user asks to regenerate.

The current qwenwork-router contract has no active cancellation API. Do not claim that an upstream media task has been cancelled.

Delivery

qwenwork_media_task action=wait downloads completed artifacts into the current conversation output directory:

Call qwenwork_file_present_files after a successful wait only when the result says should_present: true. This creates the clickable Feed artifact card and lets the user preview or play the final file using their existing artifact-preview preference. Do not present intermediate files; consume them as working inputs and present only the derived final deliverables.

After the artifact card is presented, finish with a concise delivery summary:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.