Skip to content

Variables and Parallel Execution ​

Variables and parallel execution are what make workflows truly powerful. Variables let you customize each run without changing the template. Parallel execution lets you process many videos at once.

Variables ​

What Are Variables? ​

Variables are placeholders in your workflow steps that get replaced with actual values when the workflow runs. Instead of hardcoding "Episode 42" into your template, you use a placeholder like , and the actual value gets filled in at runtime.

How to Use Variables ​

Variables are written with double curly braces around the variable name:

"Create a 90-second cutdown from episode focusing on ."

When the workflow runs with episodeNumber = 42 and topic = "hiring mistakes", the AI receives:

"Create a 90-second cutdown from episode 42 focusing on hiring mistakes."

Where Do Variable Values Come From? ​

Variables can be set in several ways:

  • Workflow setup — You provide values when you launch the workflow (e.g., episode number, target duration, topic)
  • Starter variables — When creating a workflow instance (via the management UI or the API), you can supply starter variables as a JSON object. These values are available to all steps from the start. In the management UI, expand the Advanced: starter variables section to edit them with the built-in JSON editor, or copy/paste a JSON object directly. The same section lists the inputs the template expects, so you know what to fill in.
  • Clone branch data — Each parallel branch can receive its own set of variable values
  • Task results — Values generated during earlier steps can feed into later steps

Declaring Template Inputs ​

A template can advertise the starter variables it accepts — its inputs — so whoever runs it (a teammate, or another tool over the API) knows exactly what to send, even for a shared template whose steps they can't see.

In the template editor, the Inputs panel lets you declare each one:

  • Name — the variable name your steps use, like episodeNumber
  • Type — text, number, true/false, or a choice from a fixed list
  • List — tick this when the caller sends several values instead of one
  • Min / Max — an optional range for numbers
  • Choices — for a choice input, the allowed values, each with an optional friendly label
  • Description — one line on what the value does; the most helpful thing you can give someone running your template

You don't have to start from scratch. Below the panel, StarZero Agents suggests the variables your steps read that you haven't declared yet — click Add to turn one into an input. Prefer typing JSON? Switch the panel to JSON mode.

If a template declares no inputs, StarZero Agents works them out from the variables its steps read. That best guess can include variables an earlier step fills in while it runs, so declare the inputs yourself whenever you want the list to be exact, typed, and described.

Inputs are guidance, not a gate — a run still starts whatever variables you pass. You'll see a template's inputs on its detail page and when you start a new instance.

Built-in Operations ​

Variables support more than simple substitution. Templates can also perform:

  • Math operations — Add, subtract, multiply, divide values
  • String manipulation — Format text, change case, concatenate values
  • Comparisons — Check if values are equal, greater than, less than
  • Boolean logic — Combine conditions with AND, OR, NOT

These operations are useful for building templates that adapt to different inputs without needing separate templates for each scenario.

How Comparisons Treat Your Values ​

When a template compares or branches on a variable, it doesn't matter how the value was typed: true matches "true" and 1, and 5 matches "5". In a conditional block, the values false, "false", 0, "0", and empty text all count as "off" — everything else counts as "on". Number comparisons always compare numerically, so 1200 is greater than 200 even when both are written as text. Plain text (anything that isn't a number or true/false) still has to match exactly, including capitalization.

Previewing Templates ​

The template editor includes a live preview pane that shows what the rendered output will look like with your current variable values. As your templates grow and use nested blocks (loops and conditionals), the preview color-codes each nesting level so you can see which parts of the output come from which block. Hover over any highlighted section to see a tooltip showing the full nesting path — which blocks produced that piece of text, from outermost to innermost. This makes it easy to debug complex templates with multiple levels of looping or conditional logic.

Parallel Execution ​

How It Works ​

The Clone step is what makes parallel execution possible. When a workflow hits a Clone step, it splits into N independent branches. Each branch:

  • Runs completely separately from the others
  • Runs its remaining steps independently
  • Can have its own variable values
  • Runs simultaneously with all other branches

A Practical Example ​

Imagine you have 10 podcast episodes and want a 60-second cutdown from each:

  1. Message step — "You are creating podcast cutdowns."
  2. Clone step — Create 10 branches, each with a different episodeNumber variable
  3. Task step (runs in each branch) — "Create a 60-second cutdown from episode with captions. Render in 9:16."

All 10 branches run at the same time. Instead of processing episodes one by one, you get all 10 cutdowns produced in parallel.

Nested Clones ​

Cloned branches can themselves contain Clone steps, creating nested parallelism. For example, you could clone into 5 branches for 5 episodes, and then each branch clones into 3 sub-branches to create 3 different cutdowns per episode — giving you 15 cutdowns running simultaneously.

In practice, one level of cloning is usually enough. Nested clones are available for advanced use cases but aren't commonly needed.

What Happens When Branches Finish ​

Results from all branches are collected as they complete. The workflow tracks the status of each branch, so you can see which ones have finished and which are still running. When all branches complete, the workflow itself is marked as complete and can trigger callbacks.

Putting It All Together ​

Here's a real-world example of a batch processing workflow:

Template: "Weekly Podcast Batch"

  1. Message — "You are creating social media clips from podcast episodes. Target audience: tech professionals."
  2. Set Agent Settings — Use a capable model for creative work
  3. Clone — Create one branch per episode, with variables: episodeNumber, episodeTitle, guestName
  4. Task (in each branch) — "From episode ( with ), find a strong self-contained story. Create a 60-second cutdown. Add word-by-word captions. Render in 9:16 low quality."

Launch this workflow on Monday morning with 5 episodes, and come back to 5 ready-to-review cutdowns.

StarZero Agents by StarZero