> For the complete documentation index, see [llms.txt](https://docs.flora.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flora.ai/mcp/recipes/iterate.md).

# Iterate on favorites

Ask your agent for more like your favorite FLORA results: reuse earlier outputs as references, keep the winners together, and refine toward a goal.

After a first round, the natural next ask is "more like #2 and #4." With [FLORA MCP](https://flora.ai/mcp), earlier outputs become references for the next round, so the direction you liked carries forward. Use this after [Generate an image or video](https://docs.flora.ai/mcp/recipes/generate.md); for a whole list of items, use [batch](https://docs.flora.ai/mcp/recipes/batch.md) instead.

**Works in:** Claude · Claude Code · ChatGPT · Codex · Cursor

**You need:** a connected client, a project with earlier results, about $0.07 per new image (Nano Banana 2 at 1K)

**Use when:** you like some results and want variations that hold their look.

**Don't use when:** you're starting from nothing (use [generate](https://docs.flora.ai/mcp/recipes/generate.md)).

## Ask your agent

> In my FLORA project "Mug launch", take the 2nd and 4th images and make 4 more variations of each: same lighting and palette, new compositions. Show me the cost first and wait for my OK.

<a href="https://claude.ai/new?q=In%20my%20FLORA%20project%20%22Mug%20launch%22%2C%20take%20the%202nd%20and%204th%20images%20and%20make%204%20more%20variations%20of%20each%3A%20same%20lighting%20and%20palette%2C%20new%20compositions.%20Show%20me%20the%20cost%20first%20and%20wait%20for%20my%20OK." class="button primary">Open in Claude</a> <a href="https://chatgpt.com/?q=In%20my%20FLORA%20project%20%22Mug%20launch%22%2C%20take%20the%202nd%20and%204th%20images%20and%20make%204%20more%20variations%20of%20each%3A%20same%20lighting%20and%20palette%2C%20new%20compositions.%20Show%20me%20the%20cost%20first%20and%20wait%20for%20my%20OK." class="button secondary">Open in ChatGPT</a>

## What the agent does

1. **Resolve your favorites to node IDs.** "#2" and "#4" map to the `node_id`s from the earlier `flora_create_generations` response, in order. In a new conversation, the agent reads the canvas with `flora_get_canvas` and uses the short IDs (`n12`, `n14`).
2. **Quote, then generate with references.** Each new item passes the favorites in `reference_node_ids`, with a prompt that says what to keep and what to change. Four variations of each favorite is eight items in one call:

   ```json
   {
     "generations": [
       {
         "project_id": "prj_abc",
         "type": "image",
         "prompt": "Keep the lighting, palette and mug from the reference. New composition: low angle, mug at left third, window light behind",
         "model": "i2i-gemini-3.1-flash-image",
         "reference_node_ids": ["n12"]
       },
       {
         "project_id": "prj_abc",
         "type": "image",
         "prompt": "Keep the lighting, palette and mug from the reference. New composition: overhead, mug centred on a linen napkin",
         "model": "i2i-gemini-3.1-flash-image",
         "reference_node_ids": ["n14"]
       }
     ]
   }
   ```

   To blend two favorites (layout from one, color from the other), pass both IDs in one item and use a multi-image model such as `is2i-gemini-3.1-flash-image`.
3. **Poll** with `flora_list_generations` and the new `run_ids`, as in [generate](https://docs.flora.ai/mcp/recipes/generate.md#what-the-agent-does).
4. **Keep the winners together.** `flora_organize_canvas_fields` moves the favorites into a "Finals" field so the next round is easy to find. See [Put results on a canvas](https://docs.flora.ai/mcp/recipes/canvas.md#sort-work-into-fields).

The new nodes are wired to their references on the canvas, so you can see which round each one came from.

## Let a skill drive the loop

Two FLORA skills handle iteration for you:

* **flora-refine-loop** for a precise target ("closer, but the handle is wrong"). It generates, has a vision model check each result against your goal, names the defect, changes the prompt to fix it, and stops when the goal is met, progress stalls, or a budget cap is hit.
* **flora-canvas-iterate** for building on work that's already in a project ("the hero images from last week"). It inspects the canvas, reviews what each generation cost, and regenerates only the pieces you name.

See [FLORA MCP skills and plugins](https://docs.flora.ai/mcp/skills.md) to install them.

## Check it worked

* Each new node on the canvas has an edge from the favorite it was based on.
* The new results hold the lighting and palette you asked to keep.

## If it fails

| Symptom                                                | Cause                                                              | Fix                                                                                            |
| ------------------------------------------------------ | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
| Results ignore the favorites                           | `reference_node_ids` was left out, or the model has no image input | Pass the node IDs and an image-to-image model.                                                 |
| Rejected with an unknown node ID                       | The ID came from another project or was guessed                    | Read IDs from `flora_get_canvas` for the same project.                                         |
| `input_validation_error` (HTTP 400) with a video model | Video models don't take `reference_node_ids`                       | Follow [Turn a product photo into video](https://docs.flora.ai/mcp/recipes/image-to-video.md). |
| Variations drift too far                               | The prompt doesn't say what to keep                                | Name what stays (lighting, palette, framing) and the one thing to change.                      |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flora.ai/mcp/recipes/iterate.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
