Flow Authoring
Breyta flow authoring guide for production workflows: structure definitions, publish safely, configure runtime requirements, and promote releases.
Quick Answer
Author in a strict sequence: define shape, push updates, configure + check runtime requirements, optionally validate, release an immutable version, then run.
Keep orchestration thin in :flow and move shaping logic/content into :functions and :templates as complexity grows.
Do This Now
Design your flow in this order:
- define
:slugand:name - set
:concurrency - declare setup in
:requires - declare per-run input in
:invocations - expose manual/client ingress in
:interfacesand time automation in:schedules - define the final output contract
- implement
:flowwith deterministic logic
For public/end-user flows, define the output contract as a human presentation surface before release. Default to one readable Markdown artifact; use a curated table or dedicated media viewer only when that viewer is clearly better for the user. When a Markdown report needs real Breyta tables, charts, downloads, images, video, nested Markdown, or JSON resources, embed them with fenced breyta-resource blocks so they render in the document flow. Keep raw structured/debug payloads out of the final public result unless they are explicitly the intended output.
What This Does
- keeps flow behavior predictable
- separates runtime bindings from authoring
- reduces replay and debugging issues
For the exact command lifecycle (push/validate/release/configure/run), use CLI Workflow.
When To Use
Use this once your first flow works and you need production-ready structure.
Advanced Options
- keyed concurrency
- multi-interface and scheduled flows
- reusable requirements/bindings
- templates for prompts, request bodies, and SQL
- function refs for reusable deterministic transforms
:persistrefs for data-heavy step outputs: inline results should stay
under 512 KB, 1 MB is the hard step/DB/code/notify payload cap, and persisted
blob writes cap at 50 MB retained or 4 GB ephemeral:meteringon steps with known API/tool costs, so creator-facing run cost estimates have readable line items- child-flow orchestration with
flow/call-flowfor complex branches - bounded child-workflow batch spawn/collect with
:fanoutwhen every item is{:type :call-flow ...}
Production Pattern: Parent + Child Flows
When a single :flow starts mixing ingress logic, routing, and domain application behavior, split it:
- parent flow does ingress + normalization
- parent delegates specialized branches with
flow/call-flow - parent uses
:fanoutonly for bounded sibling child-workflow batches when spawn/collect semantics are needed - each child flow owns one domain concern (routing, apply/update, reporting)
This keeps orchestration readable and reduces duplicate branching logic across flows.
Common Anti-Patterns
- adding bindings commands before push succeeds
- hiding side effects in non-step code
- changing many steps at once without isolation checks
- using unclear step ids that make timelines hard to read
- returning internal tables,
res://refs, or raw debug maps as public manual-run output - pasting EDN/JSON maps into Markdown paragraphs instead of using a raw viewer, JSON resource embed, or fenced code block