Batches of images on ComfyUI

You write one line. It makes every combination.

Bowl of Scenes makes images, video or 3D models in bulk. You keep reusable pieces of prompt in groups, such as characters, poses, places and styles. A one-line command combines them, and the server runs every combination as a job on one or more ComfyUI servers.

Install it GitHub

# What would this line make? Nothing is stored yet
$ bosctl command preview 'gpu1 -$ anime: characters * poses where not #acrobatic'
The command is valid.
  combinations: 9
  after where:  6
  kept:         6
  jobs:         6
  the servers share the jobs as they become free
# A typo is caught, and does not make a smaller batch
$ bosctl command preview 'gpu1 -$ anime: characters * pose'
The command is not valid:
  SEM at 28: group "pose" does not exist

Three characters, three poses, and one pose that is tagged acrobatic: six jobs.

3

ways in: a web page, bosctl in a terminal and a REST API. All three do the same things

62

commands in bosctl, each one documented with the endpoint that it calls

14

example workflows in the repository: 7 that make a picture and 7 that improve one

1 file

is the database. The settings are in it too, so there is no configuration file

  • Pieces that you reuse

    A character, a pose or a style is an item of a group, with its prompts, its LoRAs and its tags. A command names groups and items, and the program joins their prompts for each job.

  • A preview before anything runs

    The preview says how many jobs a line makes, how they split across the servers and what is missing. It changes nothing, and it marks a mistake in your text.

  • Several servers at once

    List more than one ComfyUI server and they share the jobs as they become free. A server that goes away does not lose work: its jobs run elsewhere.

A small language for a large batch

A command is one line of text. It says where to run, what to combine, how to shape the list, which settings to change, how to split the work, and which fixers to run afterwards. Line breaks and extra spaces do not matter.

  • gpu1, gpu2 -$ anime: names the servers and the generator
  • * makes every combination, && joins lists and || pairs them
  • where, limit, sample and repeat shape the list
  • with changes settings, spread splits the work and > adds a fixer
gpu1, gpu2 -$ anime:
    characters * poses(~jumping)
    * emotions(cry) * "masterpiece"
    where not #acrobatic
    sample 20 seed 7  repeat 3
    with steps=30, cfg=6.5
    spread blocks
    > upscale on gpu2

From the line to the pictures

You set up the catalogue once, with your servers, workflows and groups. Then you write commands.

Preview

See the batch before it exists

In the web page the preview answers as you type: whether the line is valid, how many combinations it has, how many remain after where, and how many jobs that makes. Save command stays disabled until the command is valid.

  • Names complete as you type: servers, generators, groups, items, tags and fixers
  • Each problem has a rule name, its position in the text and a sentence
  • Warnings for a server that is offline and for a LoRA that a server does not have
The Add command dialog with the line gpu1 -$ anime: characters * poses where not #acrobatic and its preview: 9 combinations, 6 after where, 6 jobs

Jobs

Every job keeps its prompts, its seed and its result

A job is a snapshot. It copies the prompts and the settings that it needs, so a group that you change later does not change a job that exists. The page of a command updates by itself while jobs start and finish.

  • Edit the prompt of one job and run only that job again
  • Download a command as a ZIP, with summary.json beside the results
  • A job whose server vanishes is queued again and counted, and after max_job_attempts it fails
The jobs of the command Portraits, six of six finished, each with its status, server, prompt and seed. The small pictures are placeholders, because the screenshot was made with a stand-in for ComfyUI

Several servers

Split a batch over your GPUs

Without anything else the servers share the work as they become free, so a faster card does more. With spread you decide in advance, and the preview shows the plan.

  • even: the jobs go round the servers in turn
  • blocks: consecutive jobs stay on one server, which reuses the LoRAs it has loaded
  • by characters: every job with the same character goes to the same server
  • pinned: a job waits for its server, also when another is free
# Three quarters of the work for gpu1.
$ bosctl command preview 'gpu1=3, gpu2=1 -$ anime:
    characters * poses * "masterpiece"
    with seed=42 spread blocks'
The command is valid.
  combinations: 9
  after where:  9
  kept:         9
  jobs:         9
  gpu1: 7 jobs
  gpu2: 2 jobs

Fixers

Improve each result with a second workflow

A fixer is a workflow that takes a finished picture and returns a better one: an upscale, a face repair, a background removal. Everything after > is a fixer step. It runs on the server that made the picture, or on the server that is named after on.

  • Each step replaces the result with the improved picture
  • The examples are in examples/workflows/fixers/
gpu1 -$ anime: characters > upscale > face
gpu1 -$ anime: characters > upscale on gpu2 > face

Terminal

The same from a terminal

bosctl does everything that the web page does. It talks to the running server, so what you do in one shows in the other at once.

  • --json prints the answer exactly as the server sent it
  • Exit codes: 0 done, 1 an error from the server, 2 a mistake in the call, 3 the server cannot be reached
  • It never asks a question, so a script or an AI agent can drive it. docs/agents.md is the guide for one
# Add the command to project 1.
# Its jobs exist at once, and nothing runs yet.
$ bosctl command add 1 \
    'gpu1 -$ anime: characters * poses where not #acrobatic' \
    --name Portraits
$ bosctl job list 1 --page-size 3
ID  STATUS  SERVER  SEED            PROMPT                                    ERROR
1   idle            41754494229476  1girl, alice, long blond hair, blue dre…
2   idle            41754494229476  1girl, alice, long blond hair, blue dre…
3   idle            41754494229476  1boy, bob, short brown hair, green jack…
page 1 of 2 (6 in all)

# Run it, wait for the end, and take the results.
$ bosctl command run 1 --wait --timeout 5m
$ bosctl command download 1 --output tutorial-results.zip

Catalogue

Your ComfyUI servers, and whether they are online

A server is one ComfyUI installation, with a code name for the commands and a limit on the jobs it runs at once. The program probes every server about once a second and tells you when one goes away or comes back.

  • A generator is a ComfyUI workflow in API format. The program writes the prompts, the seed and the settings into it for every job
  • The dialog analyses a workflow by itself and finds its prompt nodes and its output node
The Servers page with the server My GPU, its address, the code name gpu1, one job at once and a green online badge

More in the language and the catalogue

The command language guide has each of these with examples and the common mistakes.

  • Templates

    The prompt of an item can have a placeholder such as <tmpl:subject>, and a template term fills it from other groups.

  • Regions

    A group whose items define regions, as a painted mask or as boxes, takes a prompt for each region.

  • LoRAs from Civitai

    Give the model ids. The program downloads the LoRAs, uploads them to a ComfyUI server and makes a group of them.

  • ControlNet and IP-Adapter

    An item can carry ControlNet images and an IP-Adapter reference. The program adds their nodes to the workflow.

  • Seeds that repeat

    Every job records the seed it ran with. sample 10 seed 7 gives the same choice each time.

  • A REPL

    One quick picture without a project: choose a server and a generator, write a prompt, and run.

  • It stays yours

    It runs on your machine, contacts only your ComfyUI servers (and Civitai if you ask), and has no telemetry.

  • Every error has a name

    An error carries a stable tag, and the troubleshooting guide says what each one means and what to do.

How a command chooses

Every name or pattern in a filter must match something, so a typo is an error and not a smaller batch.

You writeYou get
charactersEvery item of the group, in the order they were created
characters(alice, bob)Those items
characters(~alice)Every item except alice
poses(run%)Every item whose code name starts with run
poses(#acrobatic)Every item that is tagged acrobatic
"masterpiece, best quality"One item without a name that only adds positive text
!"blurry, lowres"One item without a name that only adds negative text
where characters = alice and poses = runningOnly the combinations that have both
limit 20 repeat 4The first 20 combinations, four jobs of each: 80 jobs

A repeat needs the seed to vary: set one with with seed=42, or use a generator that has a new random seed for every job. Otherwise the command is refused, because it would make the same picture four times.

A REST API under both

The web page, bosctl and the REST API are three front ends over the same core. Everything is under /api/v1, and the running server serves its OpenAPI description at /api/v1/openapi.json.

  • A preview answers 200 also for a command that is not valid, with "valid": false and the problems
  • An error is always a tag, a message and metadata. A program looks at the tag
  • The events are a list to ask for, or a live stream with Accept: text/event-stream
$ curl -s localhost:8080/api/v1/commands/preview \
     -H 'Content-Type: application/json' \
     -d '{"code": "gpu1 -$ anime: characters * poses"}'

Errors with a tag and a route

The errors of Bowl of Scenes are made with my errors package. Their tags are the names that the API and the troubleshooting guide use.

What Bowl of Scenes does not do

Better to read it here than to find it out.

  • It is not a workflow editor. You bring workflows that you saved from ComfyUI in API format.
  • It does not stop a job that ComfyUI is already running. Stop sends the queued jobs back to idle, and a running job finishes.
  • There are no user accounts. One access token is for everyone who knows it, and by default the server listens only on 127.0.0.1.
  • Every ComfyUI server must run the comfyui-model-crud extension, which has no login of its own. Keep ComfyUI on a network that you trust.
  • It does not find the people in a picture. Regions are masks that you paint, or boxes that you give.
  • The build needs a C compiler, because SQLite is built from source.

Under the hood#

You keep reusable pieces of prompt in groups (characters, poses, places, styles) and write a one-line command that combines them. The server runs every combination as a job on one or more ComfyUI servers.

gpu1, gpu2 -$ anime: characters * poses(~jumping) * "masterpiece" where not #acrobatic limit 20 > upscale

That line says: on the servers gpu1 and gpu2, with the generator anime, make every character in every pose except jumping, add the text “masterpiece” to each prompt, leave out anything tagged acrobatic, keep the first 20, and run each result through the fixer upscale.

You work in a web page, from a terminal with bosctl, or through a REST API. All three do the same things, because they are thin layers over the same use cases.

Everything you create is in one SQLite database, and the queue is that database: jobs run in the order the commands were run. The pictures are files in folders next to it. If you stop the program while jobs run, it asks ComfyUI about them at the next start, collects the ones that ComfyUI still knows and queues the others again.

Kind
Tool
Language
Go
License
MIT

Build it and open the web page

You need Go 1.26.3 or newer, a C compiler, and one or more ComfyUI servers with the models that your workflows use. The first build compiles SQLite and takes a minute. Then follow the tutorial: from an empty program to a finished batch.

Source on GitHub

# Get the source and build both programs
$ git clone https://github.com/rm4n0s/bos
$ cd bos
$ go build -o bin/ ./cmd/bos ./cmd/bosctl
# Start it, and open http://127.0.0.1:8080
$ ./bin/bos
# Or with every request in the log
$ ./bin/bos -log-level debug