Flow Basics
Breyta flow basics for authoring deterministic workflow automation with :slug, :concurrency, :triggers, and :flow.
Quick Answer
Start with a minimal deterministic flow, confirm it runs, then add one external requirement and one step at a time.
Keep :flow focused on orchestration, label branch nodes with metadata, and use top-level :functions for shaping logic.
Do This Now
Use this minimal structure as your base:
{:slug :hello-world
:name "Hello World"
:concurrency {:type :singleton :on-new-version :supersede}
:functions [{:id :build-response
:language :clojure
:code "(fn [input] {:message (str \"Hello, \" (:name input) \"!\") :input input})"}]
:triggers [{:type :manual :label "Run" :enabled true :config {}}]
:flow
'(let [input (flow/input)
greeting-input ^{:label "Greeting input"
:yes "Use provided name"
:no "Default to World"}
(if (:name input)
input
(assoc input :name "World"))
output (flow/step :function :build-output
{:ref :build-response
:input greeting-input})]
output)}
What This Does
- defines a unique flow identity
- enables manual execution
- returns deterministic output
- models orchestration in
:flowand shaping in top-level:functions
Field intent:
:slug: stable machine id for CLI/API operations:name: human-readable label:concurrency: controls overlap/version handoff behavior:triggers: run entry points. For manual triggers,:labelalso controls the user-facing run CTA copy in Resource UI.:flow: deterministic orchestration body
When To Use
Use this before adding external systems or advanced step chains.
First Extension Path
After this runs successfully:
- add
:requiresfor an external system - add one
flow/stepconsuming that requirement - keep output shape simple and explicit
- push -> validate -> configure (if required) -> run before adding more steps
This keeps failures easy to isolate and fix.
Draft Vs Live In Practice
- Use
draft(default) while building:push,validate,configure, thenrun. pushaffectsdraftonly (latest working copy), not installedlive.- Use
livewhen you need to verify what installed consumers run:breyta flows run <slug> --target live --wait. breyta flows release <slug>publishes a release and updates live for the selected workspace by default.