---
title: Batch with a coding agent | FLORA API
description: Combine FLORA MCP with any coding agent and external data sources to batch-run Techniques.
---

For batch jobs — 12 markets, 50 SKUs, an entire content library — pair FLORA MCP with a **coding agent** (Claude Code, Cursor agent mode, VS Code agent mode, …) and any other MCP that has your source data (Drive, Notion, GitHub, a CSV in your repo). The coding agent writes a short script that loops over the inputs and calls the `@flora-ai/flora` SDK client for each one.

**Prerequisite:** FLORA MCP installed in your coding agent — see [Claude Code](/mcp/install/claude-code/index.md), [Cursor](/mcp/install/cursor/index.md), or [VS Code](/mcp/install/vscode/index.md). If you’re using external data, install the relevant MCP too (e.g. Drive, GitHub).

## What you type

> I need the Q3 thumbnails localized for 12 markets. Same visual direction we just locked in, but with each market’s headline. The localization sheet is in Drive — file ID `1abc...xyz`. Pull the headlines and generate one thumbnail per market.

## What the agent does

1. Reads the localization data

   The agent uses the Drive MCP (or whichever source you named) to fetch the spreadsheet. It identifies a `market_code` column and a `headline` column.

2. Writes a loop

   The agent drafts a short script — 8–10 lines — that iterates over the 12 rows. For each row, it calls `client.techniques.runs.create(techniqueId, { inputs: [...] })` with the locked visual direction plus that market’s headline.

3. Polls and saves

   The script polls each run, downloads each finished output, and names files by market code: `thumbnail_DE.png`, `thumbnail_FR.png`, etc.

4. Packages the result

   The agent zips the 12 assets into `q3_campaign_thumbnails.zip` and shows the file tree so you can download or hand off.

## What you see

A code window appears in your editor with the readable loop. A progress indicator runs from 1/12 through 12/12. When it finishes, the file tree expands to show:

```
q3_campaign_thumbnails.zip
├── thumbnail_DE.png
├── thumbnail_ES.png
├── thumbnail_FR.png
├── thumbnail_IT.png
├── thumbnail_JP.png
├── thumbnail_KR.png
├── thumbnail_NL.png
├── thumbnail_PT.png
├── thumbnail_PL.png
├── thumbnail_SE.png
├── thumbnail_TR.png
└── thumbnail_US.png
```

You never left your editor. The MCPs did all the lifting.

## Example: minimum viable script

For reference, here’s what the loop typically looks like. Your coding agent writes this for you — you don’t need to type or maintain it.

```
import Flora from "@flora-ai/flora";
const client = new Flora();


// pseudo-code — actual implementation varies by Technique schema
const markets = await drive.readSheet("1abc...xyz");
const techniqueId = "tech_thumbnail-v3";
const lockedDirection = ["<url for approved still #4>", "<url for approved still #7>"];


for (const { market_code, headline } of markets) {
  const run = await client.techniques.runs.create(techniqueId, {
    inputs: [
      { id: "headline", type: "text", value: headline },
      { id: "image_references", type: "imageUrl", value: lockedDirection[0] },
      { id: "brief", type: "text", value: "..." }
    ]
  });


  let status;
  do {
    status = await client.techniques.runs.retrieve(run.run_id, { techniqueId });
  } while (status.status !== "completed" && status.status !== "failed");


  await downloadOutput(status.outputs, `thumbnail_${market_code}.png`);
}
```

## Variations

- **From a CSV in your repo** — *“Use `markets.csv` in this repo as the source.”*
- **To a Project, not a zip** — *“Attach each output to the Q3 Campaign Project in FLORA.”* The agent adds a `client.projects.assets.attachAsset(...)` call after each run.
- **With approval gate** — *“Generate one, show it to me, only continue if I approve.”* The agent stops at run 1/12 and waits.
- **Parallelize** — for large batches, run N at a time instead of serially. Mention the limit you want: *“Run 4 at a time.”*

## When to use a coding agent vs chat or background mode

\| | Inline chat | Background mode | Coding agent | | --- | --- | --- | --- | | 1–10 runs | Yes | Yes (for motion) | Overkill | | 10–50 runs with external data | No | Maybe | Yes | | Full automation, scheduled | No | No | Yes — wrap in a CI job | | Approval gates | Awkward | OK | Easy |

## Tips

- The MCP layer is identical across surfaces. If a recipe works in chat for one item, the same FLORA tool calls will work in a coding agent for 100 items.
- Output URLs are long-lived but not permanent. If you need archival storage, have the agent copy outputs to S3, GCS, or your own asset store as part of the loop.
- For runs that take significant time each, parallelize. Set `--max-concurrent 4` (or similar) in the script so you don’t wait serially.
- Big batches add up faster than you’d expect. Confirm `run_cost × N` (in USD) before kicking off. The script can pre-check with `client.techniques.retrieve(techniqueId)`.

## Related

- [Stills to motion](/mcp/recipes/stills-to-motion/index.md) — branching to another Technique with the same context.
- [Iterate on favorites](/mcp/recipes/iterate-on-favorites/index.md) — single-shot iteration in chat.
- [Authentication](/mcp/authentication/index.md) — your client’s OAuth token is workspace-scoped; all batch runs charge that workspace.
