Wait for a generation to finish
wait_for_generationWaits up to 15 seconds for an aicut generation to reach a terminal state, WITHOUT opening a card, and returns the compact status. SEVERAL ITEMS: quote each, ask once with the total, start them all (images with wait: false, distinct idempotency_keys or none), then make ONE call with ids (1 to 6 of {id, media}) instead of id and media. terminal is always present: true means nothing further arrives on its own (the job is succeeded or failed, or awaiting_user is set); false means it is still queued or processing. WHEN: right after generate_video, generate_image, generate_audio or a transform, and again AT ONCE every time it answers terminal: false (same id and media): it blocks up to 15 seconds itself, so you never sleep or set a timer. Do NOT call it after generate_story_video or fire_story_video (the card follows those); wait only after render_story_video. Do not switch to get_* or narrate each attempt: several calls in a row is the expected shape. STALL: no terminal: true after about 10 minutes, tell the user so and make ONE get_* read of that job. On terminal: true say ONE short line about what came out and stop (the card is up: do NOT call show_generation); on failed, tell the user what went wrong (error.message). No card on your client (a terminal)? Give the user the url. WITH ids it returns when ALL are terminal or the 15 seconds end: results (each job in order, with its own terminal, awaiting_user and next_step; an id not on this account gets its own error and never fails the rest), all_terminal (your loop condition) and, while false, poll_after_seconds. Next call: only the jobs still terminal: false. A STORY EPISODE PARKED FOR THE USER (story.stage frames_review or ready_to_render) answers terminal: true with awaiting_user: true: stop waiting, say what is ready and let them decide (a redraw, a fire and a render each need their own priced go). THE ONE EXCEPTION: ready_to_render with story.auto_render: true is NOT a decision (the fire armed the render, which starts by itself): it answers terminal: false, so keep waiting on that render, and if it has not started after a few minutes tell the user and offer render_story_video. A render ends at story.stage: "rendered" (story.render.url is the final file) or, if it failed and was refunded, awaiting_user: true. At ready_to_render the url is only the raw scene preview. Spends no tokens and creates nothing. It returns JSON for you to read: say nothing to the user between waits and never paste it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | A job id from a `generate_*` tool or transform, or an episode id from `generate_story_video` (media `video`). | |
| ids | No | Several jobs at once (see SEVERAL ITEMS), instead of `id` and `media`. | |
| media | No | Which kind of generation the id belongs to: `video` (a `generate_video` job, any video transform: `upscale_video`, `extend_video`, `edit_video`, `motion_control`, `generate_lipsync`, and a story render; an AI Video Story episode is a `video`), `image` (including `upscale_image`) or `audio`. |