Test mode: plans are proposed and nobody is charged yet.

← Docs

Flows: workflows as typed data

A flow is a workflow written as JSON rather than code: what the builder's canvas saves, and what anyone can write and send to the API. It's a list of steps run in order, wired by references, and every wire is typed. The engine runs it like any other workflow (camshaft.flow), so each step is recorded exactly once, sleeps and waits outlast any process, and a run can be read, answered, cancelled and retried the same way. The crate is crates/flows.

{
  "input": {"object": {"order": "string"}},
  "steps": [
    {"kind": "http", "name": "look", "url": "https://shop.example/orders/{{input.order}}",
     "output": {"object": {"amount": "integer", "email": "string"}}},
    {"kind": "signal", "name": "approve", "signal": "approve", "output": "boolean",
     "timeout_ms": 86400000, "default": false},
    {"kind": "sleep", "name": "cool", "ms": 60000},
    {"kind": "http", "name": "refund", "method": "POST", "url": "https://pay.example/refunds",
     "headers": {"idempotency-key": "refund-{{input.order}}"},
     "body": {"amount": "{{steps.look.output.amount}}", "approved": "{{steps.approve.output}}"},
     "output": {"object": {"id": "string"}}}
  ],
  "output": {"refund": "{{steps.refund.output.id}}"}
}

Types

"string", "number", "integer", "boolean", "any", {"object": {"field": type, …}} and {"list": type}. An object value has every field its type declares; extra fields are allowed and can't be referred to. An integer goes where a number is wanted, never the reverse. any goes only where any is wanted, and nothing inside it can be referred to: declare the type to wire from it.

Steps

kindfieldsoutput
httpurl, method (GET, POST, PUT, PATCH, DELETE; GET by default), headers, body (not for GET), output (its type), attempts (1–20, 3 by default)the JSON answer (the text for a string output), checked against output
signalsignal (the name it's sent under), output (the payload's type), timeout_ms, default, approversthe payload; at the deadline default, or without one the run fails
modelmodel, prompt (a string, with references), system, output (its type), attempts (3 by default)the model's answer: its text for a string output, else the JSON it answered, checked against output
agentmodel, system, task (with references), tools (saved flows: flow, version, description, risky), max_turns (8 by default)the agent's answer, a string
flowflow (a saved flow's name), version, input (with references)the flow's output; its type is the flow's, written in when this flow is saved
sleepms: a number, or a reference to an integernone
eventevent (its name: letters, digits, -, _, .), match (field, a dotted path into its data; equals, a value or a reference), output (the data's type), timeout_ms, defaultthe event's data; at the deadline default, or without one the run fails

Names are 1–64 letters, digits, - and _. Each signal name is waited for by one step only (a signal is taken once).

A non-2xx answer, an answer that isn't JSON, or one not of its type, is a failed attempt; it's retried after 1 s, then 2 s, and so on, and the run fails when the attempts are used up. Since an attempt can be repeated (the engine records exactly once and runs at least once, see decisions.md), give calls that change something an idempotency key, as in the example.

A signal sent through the API (POST /runs/{id}/signals/{name} with {"value"}) arrives as {"value", "by", "client_id"}. The step takes value, and who answered stays in the run's journal. A program that embeds the engine and signals directly sends the value itself.

Flows that run flows

A flow step runs another saved flow, at the version written, as a child run, and gives its output. Saving looks the flow up: it must exist at that version, the input given must fit its input type, and the step's output becomes the flow's output type, so later wires are typed by it. A run carries every flow it runs (and theirs) from when it starts, as it carries its own definition, so nothing saved later changes it. Flows run flows at most 8 deep; the chain is checked when saved. The child is a run of its own (<run>.<step>), each of its steps recorded once. Code made from a flow runs a flow step as a child run of camshaft.flow, with the definitions written in, as the flow's own run does.

Agents

An agent step gives a model a task and lets it call tools, saved flows at the versions written, until it answers (or max_turns pass). Each tool's JSON Schema is its flow's input type, and each call runs that flow as a child run with the model's arguments, checked against the input type first: arguments that don't fit are told to the model as the tool failing, and nothing runs. A risky tool's calls wait for a person (the signal approve.{step}.{call id}, the agent step's name and the call's id, Approve and Decline on the dashboard). Model calls go through SocketLLM, each turn a recorded step, so a replay asks nothing twice (docs/agents.md). The step's output is the answer. Code made from a flow can't run an agent step yet.

Asking a model

A model step asks a model through SocketLLM, Lunaor's gateway (CAMSHAFT_SOCKETLLM_URL, with Camshaft's key in CAMSHAFT_SOCKETLLM_KEY; neither is ever in a flow). For a string output the answer is the text. For any other type the model is told to answer with JSON only, of that type as JSON Schema, after any system text of the step's own. The answer is read (from a fenced block, or the prose around it) and checked against the type. An answer that isn't JSON, or isn't of the type, is a failed attempt, retried (attempts, 3 by default), so the wire after it carries the declared type or the run fails. The answer is recorded like any step's, so a replay never asks again.

{"kind": "model", "name": "triage", "model": "claude-haiku", "system": "You triage support tickets.",
 "prompt": "Ticket: {{input.text}}", "output": {"object": {"urgent": "boolean", "team": "string"}}}

Conditions

Any step can have when: a reference to a boolean ("{{steps.approve.output}}"), or a comparison, {"left": …, "op": …, "right": …} with ==, !=, <, <=, > or >=. Equality works between two numbers (an integer and a number compare as numbers), two strings or two booleans; order works between numbers or between strings. Either side is a reference or a constant, and the check refuses a comparison of mismatched types. A step that may not run gives otherwise when it doesn't: a value of its output type, so later wires keep their types. (A sleep gives nothing, so it needs none.) The decision uses only recorded values, so every execution of a run decides the same. A step that doesn't run leaves nothing in the journal.

{"kind": "http", "name": "refund", "method": "POST", "url": "https://pay.example/refunds",
 "when": {"left": "{{steps.look.output.amount}}", "op": "<=", "right": 500},
 "otherwise": {"id": "too big for automatic refunds"},
 "output": {"object": {"id": "string"}}}

Who may answer

A signal step with "approvers": "refunds:approve" is answered through the API only by someone whose Harpora token holds that permission: in its permissions (every permission the person's roles give on Camshaft's API), or in its scope. Patterns work as in Harpora (refunds:* holds refunds:approve). Anyone else gets 403, naming the permission. Give the permission to a role in Harpora, and the role to the people who approve. Without approvers, anyone with runs:signal may answer. Who answered is kept in the journal either way. An agent step takes approvers too, for its risky calls; and those are answered only by a person, never an agent or a machine, whatever they hold (docs/agents.md).

References

{{input…}} is the run's input. {{steps.<name>.output…}} is an earlier step's output. A path goes on with field names, or indexes into lists ({{steps.look.output.lines.0.sku}}). A string that is exactly one reference carries the value itself, with its type. References inside a longer string are written into it, so they must be strings, numbers or booleans. {{ always starts a reference.

Checked when saved

Saving (PUT /flows/{name}) checks every step and wire. It refuses a reference to a later step, to nothing, or to a field the type doesn't declare, and a value whose type doesn't fit its slot (a URL or header takes a string, a sleep an integer). A default must be of its step's output type. The error names the step and what's wrong. While a run goes, each value is checked when it's made (an HTTP answer, a signal's payload) against the type the check assumed, so a wire never carries something else.

Versions

Each save of a changed flow is a new version, 1 and up. Saving the newest version unchanged makes nothing new. Versions never change. A run starts on a version (the newest, or one asked for) and carries that definition in its input, so it keeps to it whatever's saved later.

Taking a flow elsewhere, and forking it

A flow's bundle (Flows::export, GET /flows/{name}/bundle) is one version of it with every flow it runs (as steps or an agent's tools, and theirs), keyed name@version, and the names of the secrets they send; never a secret's value. Importing one (Flows::import, POST /flows/import) saves the flows it brings deepest first, each under its own name: a version already there with the same definition is used, otherwise it's saved as a new version, checked as any save is (an embedding program checks the secrets it names there; the service checks them when a run sends them, from the run's org: "Secrets"). Each flow is then pointed at the versions its children got there. Saved versions never change, so a flow already there that runs one of them keeps running what it ran. A bundle that names a flow it doesn't bring, runs in a circle, goes deeper than flows may, or brings more than 256 flows is refused before anything is saved.

A fork is an import under a new name in the same Camshaft: a flow of its own, starting as the version forked, the flows it runs shared at the versions it ran. The dashboard has each: a bundle link and a fork form on a flow's page, and an import form on the flows page.

Catalog

A place to publish flows, and single steps, for others (camshaft_flows::catalog, routes in crates/api/src/catalog.rs). An org's admin or owner publishes; anyone who may read a version installs it.

RouteWho
GET /catalog ?kind=&tag=&q=a tokenthe entries the caller may read, each at the newest version they may read
GET /catalog/{org}/{name} ?version=a tokenone version, its readable versions and which are deprecated
POST /cataloga token: the org's admin or ownerpublish: 201 a new version, 200 the same as the newest, 422 refused (a secret, flows it runs in a circle, over 50 or not the org's, a field's limits)
POST /catalog/{org}/{name}/deprecate {"version", "reason"?}a token: the org's admin or ownerthe version marked deprecated
POST /catalog/{org}/{name}/install {"name", "org"?, "version"?}a token: admin or owner of the org it goes in201 {"name", "version", "org", "source", "secrets", "deprecated", "dependencies"}; 409 a name taken (nothing made)
POST /catalog/{org}/{name}/insert {"flow", "version"?, "as"?, "at"?, "wire"?}flows:write on the flow201 {"name", "version", "step", "source", "deprecated"}; 400 if the flow with it doesn't check
POST /catalog/installs/{flow}/upgrade {"version"?, "force"?}flows:write on the flow; admin or owner of its org200 {"name", "version", "org", "from", "source", "secrets", "deprecated", "dependencies", "added", "left", "forced"}; 409 changed copies (edited, gone), not newer, or not an install's root (nothing written)
GET /flows/{name}/sourceflows:read on the flow{"flow", "steps", "dependency", "install"}: each source with newest, newer and deprecated; install on an install's root
GET /public/catalog, GET /public/catalog/{org}/{name}nobodythe public versions only, read-only

The MCP tools are catalog_list, catalog_get and flow_source (free), catalog_publish, catalog_install, catalog_upgrade, catalog_insert and catalog_deprecate (limits: a publish, an install, an upgrade and an insert each count as one of the caller's publishes a day, as saving a flow does). The portal's screen is view_catalog {org?, name?, installed?} (ui://camshaft/catalog): the list; one entry with its readme, versions, the flows it runs (name@version, step count), definition, Install or Insert and Deprecate; and, with installed (a flow installed from the catalog), its entry at the version installed with the copy each flow became (marked when changed since), whether a newer version is out, and Upgrade. The dashboard (ui/) has the same as pages: /catalog lists and finds entries, /catalog/{org}/{name} shows one (its readme as plain text, never markup) and installs a flow's as a copy or inserts a step's into one of your flows, through the same routes.

Where calls go

A flow's author chooses its URLs, so a call goes only to a public address. The host is resolved, every address it has must be public (not loopback, private, link-local, shared, multicast, documentation or reserved; IPv6 inside global unicast, with embedded IPv4 checked), and the call is pinned to the address checked, so a second lookup can't change it. Redirects aren't followed, answers over 255 KiB are refused (the engine keeps at most 256 KiB of JSON in one value), and each call has 30 s. Hosts of your own go in CAMSHAFT_FLOWS_ALLOW (exact names or addresses).

Secrets

A flow names a secret, never holds one: "headers": {"authorization": "Bearer {{secrets.shop}}"}. Each org holds its own secrets (2026-12-03), each with the origins it may be sent to, so whoever writes the org's flows can use a key but can't read it or send it anywhere else. A secret goes only into a header's value. In a URL, a body or an output it would be recorded, so the check refuses it there.

An embedding program (no orgs) still gives Http::secrets one set for every flow, and Flows::with_secrets checks them at save as before.

The canvas

On a flow's page the dashboard draws the flow as boxes top to bottom: the input, each step, the output. Each box lists its slots (◂: the fields that take a reference, with what they take) and its sources (▸: the input's fields, a step's output and the fields inside it). A wire is a curve from a source to a slot. The drawing is a place to edit the flow, and changes nothing about its format: no positions are saved (free positioning would need a layout field in the flow, a later decision), and the order is the steps' order.

ToBy pointer (mouse, pen, touch)By keyboard
Wiredrag a source onto a slot; the slots its type fits light up, the rest dimfocus a source, Enter, focus a slot, Enter (Escape cancels)
Reorderdrag a step by its title up or downAlt+Up, Alt+Down on the step
Clear a wireselect it, then its ×focus the wire, Delete or Backspace
Undothe Undo buttonCtrl/Cmd+Z on the canvas

A drop sets the slot as the editor's picker does (same type rule: text takes strings, numbers and booleans; an integer or boolean slot takes only that type; JSON takes anything): an integer or boolean slot becomes the reference alone, text gets it at its end, and a JSON slot becomes it, or gets a new key (an object) or item (a list) when it already holds one. Clearing a wire takes that reference out of the slot (text around it stays; a required slot falls back to empty or 0, an optional one is removed; a condition that compared it is removed). Refused, with the reason in the canvas's status line and nothing changed: a source that doesn't fit the slot ("input.meta is {a: string}, and prompt of note takes text"), a source at or below its step, and a move that would put a step above one whose output it uses. Every change is a new flow handed to the editor, which redraws its form, updates the JSON and has Camshaft check it, as any other edit does. Undo takes back the last change while the flow is as it left it; edited elsewhere since, it says so. The wires are drawn from the flow's references, typed by the check's sources; they match the API's wires (a test compares them).

The API

RouteScope
GET /flowsflows:readevery flow and its newest version
GET /flows/{name} ?version=flows:readthe flow, its versions, its input and output types, and its wires (from, path, to, slot, type: what a canvas draws)
POST /flows/check a draftflows:readok, or the error saving would give; the wires when it passes; and always the sources, per step (then the output): every reference it can use, with its type
GET /flow-templatesflows:readflows to start from (a refund with an approval, ticket triage with a model, a webhook relay, a reminder after a wait), each checked like a saved flow
PUT /flows/{name}flows:write201 saved as a new version; 200 unchanged; 400 says what's wrong
GET /flows/{name}/bundle ?version=flows:readthe flow with every flow it runs, to import elsewhere (above)
POST /flows/import {"bundle", "name"?}flows:writethe bundle's flows saved here, the flow as name if given (a fork): 201 when it got a new version, 200 when it was there already; {"name", "version", "children"}, each flow brought and the version it is here
GET /flows/{name}/code ?version=&lang=flows:readthe flow as code for an SDK, TypeScript or lang=python: the same steps under the same names, so it records the journal the flow does (answers' types are cast, not checked)
POST /flows/{name}/from-code {"language", "code"}flows:readthe code view's code, edited, read back to a flow (see below), checked as saving would, and not saved: {"ok", "flow"?, "error"?, "line"?, "wires"?, "output_type"?, "sources"?}; code that isn't in the code view's shapes is ok: false with the line and what was expected; 400 for another language
POST /flows/{name}/runs {"id", "input", "version"?}runs:start201 started, 200 already there; 400 if the input isn't of the flow's input type

Code back to a flow. The code view's TypeScript or Python is read back (camshaft_flows::from_code): parsed by a small hand-written parser, never run. It reads exactly the shapes the code view writes, with a developer's edits inside them: changed literals, arguments and references; steps added, removed or reordered in the same forms; a renamed step (references follow the step's variable). A loop, a helper function, an import the code view doesn't write, or any other shape is refused with its line and what was expected. What code can't say (limits and pacing, an integer against a number, a step's attempts and approvers, an agent's or an event's fields, Python's types) is in comments the code view writes, camshaft-flow: at the top and camshaft: above a step; keep them. A step a developer adds without a note gets its type from the code (TypeScript) or any (Python; string for a text call or an untyped model call). Flow steps are read by name, version and input; the definitions in the code are read for their shape only. Flow to code to flow gives the same JSON, for every template and the tests' flows (crates/flows/tests/from_code.rs). The editor's "From code" box applies code to the editor; saving stays PUT /flows/{name}.

camshaft.flow can't be started through POST /runs (as with every camshaft.… workflow), so a run's definition is always one that was checked and saved.

Events

An event step waits for an event sent to the flow (POST /flows/{flow}/events/{event} with {"id", "data"}, runs:signal; camshaftctl event; the MCP tool event_send), naming no run. Every run of the flow waiting for that event whose match holds (the data's field equals the run's equals) takes it once, typed by output. An event is kept for five minutes, so a run that reaches the step just after the event came takes it then; the same id again within those minutes changes nothing. Each flow has its own events (flow:{flow}:{event} in the engine), so one org's sender never reaches another's runs. Code made from a flow can't wait for events yet.

{"kind": "event", "name": "paid", "event": "order.paid", "match": {"field": "order", "equals": "{{input.order}}"},
 "output": {"object": {"amount": "integer"}}, "timeout_ms": 86400000}

Concurrency

{"concurrency": [{"limit": 10}, {"limit": 1, "key": "{{input.customer}}"}], "input": …, "steps": …}

At most limit of the flow's runs go on at once (its versions together), and with a key (a reference into the input) at most that many per value of it. At most two limits, one of each. The rest are queued, oldest first, and go on as slots free, on any worker; a run waiting (a signal, an event, a sleep, a child) holds no slot. A flow run by another flow or by an agent's tool is under its own limits. GET /flows/{name}/concurrency?key= (runs:read; camshaftctl concurrency; the MCP tool flow_concurrency) shows who holds the slots and who's queued. Code made from a flow carries the limits in a note (camshaft-flow:) and brings them back.

Rate limit, throttle, debounce and priority

{"rate_limit": {"limit": 100, "period_ms": 3600000, "key": "{{input.customer}}"},
 "throttle": {"limit": 5, "period_ms": 60000, "key": "{{input.customer}}"},
 "debounce": {"period_ms": 10000, "key": "{{input.customer}}"},
 "priority": "{{input.tier}}", "input": …, "steps": …}

A period is 100 ms to 7 days. Order is rate limit, then debounce, then throttle, then concurrency. Rate limits and debounce apply to starts through the API (not schedules or a flow run as a step); a throttle and priority apply however a run starts. Pacing is set by publishing, as concurrency is; GET /flows/{name}/pacing?key= (runs:read; camshaftctl pacing; the MCP tool flow_pacing) shows a throttle's window and queue and a debounce's waiting run. Code made from a flow carries them in the same note and brings them back.