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
| kind | fields | output |
|---|---|---|
http | url, 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 |
signal | signal (the name it's sent under), output (the payload's type), timeout_ms, default, approvers | the payload; at the deadline default, or without one the run fails |
model | model, 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 |
agent | model, system, task (with references), tools (saved flows: flow, version, description, risky), max_turns (8 by default) | the agent's answer, a string |
flow | flow (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 |
sleep | ms: a number, or a reference to an integer | none |
event | event (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, default | the 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.
- An entry is
{org}/{name}. Each publish is a new version of it (1 and up) that never changes: the name, a summary (up to 280 characters), a readme (markdown, kept as text and shown escaped), tags, the visibility, the definition as it was (a flow's steps, or one step), its input and output types, and the secrets it sends, by name. Publishing what the newest version already holds makes nothing new (200). A version can be deprecated (with a reason): that's a record beside it, so the version itself stays as published, and it still installs. - A flow's entry is one version of a saved flow (
{"flow", "version"?}), published by the org that has the flow. A flow that runs other flows (as steps or an agent's tools) is published with them: every flow it runs, and theirs, each at the version it runs (a flow step always names one), go into the same entry version as its dependencies (deps, byname@version, each with its own definition). Refused (422) when they run each other in a circle (named), when they number more than 50 with the flow, when one isn't the publishing org's own (named), or when one writes out a secret (the refusal names that flow, its step and field). A dependency is never an entry of its own: it isn't listed, read or installed apart from the flow, unless it was also published itself. - A step's entry is one step with the input its
{{input…}}references read ({"org", "name", "step", "input"}), checked as a one-step flow: it reads nothing but its input. A flow or agent step isn't shared on its own. - Visibility, per version:
org(its members, any role; the default),lunaor(a member of any org on this Camshaft) orpublic(anyone, signed in or not). An operator (orgs:write) reads all. A version someone may not read is answered as not there (404). Public versions are also read with no token, throughGET /public/catalogandGET /public/catalog/{org}/{name}, which only read and leave out who published it; every other catalog route needs a token. - Installing a flow's entry copies its definition into a new flow in the installer's org (they must be its admin or owner, as for creating a flow there), under a name nobody has, and records the source (entry and version). It never links: a later version changes nothing in the copy, and
GET /flows/{name}/sourcesays when a newer version is out (newer,newest: the newest the caller may read) or the one installed is deprecated. Installing grants the publisher nothing: the copy is the installer's org's, and only its members reach it. The secrets it names (the install's answer lists them) are the installer's org's to set; its runs send those, never the publisher's ("Secrets"). An entry with dependencies installs all of them as copies too: each as a new flow of the installer's org named{name}--{dependency}(the next free of-2,-3, … when that name is a flow already or another org's; in the order ofname@version, so the same state gives the same names), and every reference in the copies points at the copies, so nothing runs the publisher's flows. The answer'sdependenciesmaps eachname@versionto its copy. It's one store transaction: every copy, its source and its place in the org, or (a store failure, a name taken meanwhile) none. Each copy's source names the entry, and a dependency's also which of the publisher's flows it is (dependencyinGET /flows/{name}/source). - Upgrading an install in place (2026-12-04):
POST /catalog/installs/{flow}/upgrade {"version"?, "force"?}on the flow installed (the root, not one of its copies) moves it and its copies to a newer version of the same entry (the newest the caller may read unless given). Each copy is written as its next version, pointing at the others' next, so a run going on keeps the versions it started with and new runs use the new ones, as after any edit. A flow the new version adds becomes a new copy, named as an install names them; a copy of one it no longer runs is left as it is, never deleted, and reported (left). It's refused (409) when the installer changed a copy since it was installed (its newest version unlike the one the install or last upgrade wrote) or deleted one, listing them (edited,gone), unless"force": true, which keeps the change in the version before. One store transaction, as an install: every version, every source record (now naming the new entry version) and new copies' places in the org, or nothing. Visibility and the secrets check are applied to the new version again, as at install.GET /flows/{name}/sourceon a root showsinstall: each copy with the flow it came from (dependency,name@version), the version written, its newest and whether it wasedited. - Inserting a step's entry copies the step into a flow the caller writes, saved as its next version: at a place (
at, the end by default), under a name (as), each input field wired to a reference in the flow ("wire": {"email": "{{steps.look.output.email}}"}; a field not wired reads the flow's own input). The save checks it as any save does, and the step's source is recorded under its name in the flow. - No secret is published. Camshaft has no stored connections, so a definition that writes out a secret is refused (422): a password in a URL's userinfo; anything but references and the scheme word in an
authorization,proxy-authorization,x-api-key,api-key,x-auth-token,x-access-token,x-goog-api-keyorcookieheader (a cookie's name before a reference is fine); or a well-known key anywhere in a step or the output (sk-,sk_live_,rk_live_,whsec_,ghp_and GitHub's others,github_pat_,xox?-,AKIA,ASIA,AIza,glpat-,SG.,npm_,hf_, a PEM private key). The refusal names the step and field, never the value.{{secrets.X}}references are fine and left for the installer's org to set.
| Route | Who | |
|---|---|---|
GET /catalog ?kind=&tag=&q= | a token | the entries the caller may read, each at the newest version they may read |
GET /catalog/{org}/{name} ?version= | a token | one version, its readable versions and which are deprecated |
POST /catalog | a token: the org's admin or owner | publish: 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 owner | the version marked deprecated |
POST /catalog/{org}/{name}/install {"name", "org"?, "version"?} | a token: admin or owner of the org it goes in | 201 {"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 flow | 201 {"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 org | 200 {"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}/source | flows: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} | nobody | the 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.
- Whose:
{{secrets.X}}in a run is the secretXof the org that has the run's flow (a child flow's run: the org that has the child flow), looked up as the step's attempt runs. Another org's secret of the same name is never read. A flow in no org has none. A flow installed from the catalog is a flow of the installer's org, so it sends the installer's secrets, never the publisher's. - Not set: the step's attempt fails with
secret "X" isn't set in this org (<org>), naming no value; with the step's attempts left, a later one finds it if an admin has set it meanwhile. Saving no longer checks secrets (a flow may be saved, or installed, before its org sets them); sending checks the name and the origin. - Replaced or deleted: counts from the next attempt that sends it. A step already recorded is never asked again (its call isn't made again on a replay), so deleting a secret never fails a run that's past the step that sent it.
- Managed by the org's admins and owners (and operators):
GET /orgs/{org}/secrets(each one's name, origins,set_msandupdated_ms),PUT /orgs/{org}/secrets/{name} {"value", "origins"}(201 set, 200 replaced),DELETE /orgs/{org}/secrets/{name}(204). A value is 8 to 8192 bytes with no control characters (it goes in a header). With Nod on, setting one is a nod of classaccess(actionsecret.set, resourcecamshaft:org:<org>:secret:<name>, in the org's Nod account; the person sees the name and origins, never the value), spent with the write; deleting needs none (it only narrows what runs send). MCP:secrets_list(free),secret_delete(limits),secret_set(nod). - Write-only: no route, tool, log line, error, run, journal, export, bundle or catalog entry gives a value back; an answer names the secret only, and a refusal never quotes the body it refused. A call's request isn't recorded, only its answer, and every value sent is masked (
[secret]) in the answer and in an error before either is recorded, should the far end quote it back. - Sealed at rest: AES-256-GCM (kit-seal, the copy Nod shares) under
CAMSHAFT_SECRET_KEY(base64 of 32 bytes), a fresh nonce each time, bound to its record (org-secret/<org>/<name>) so a sealed value moved to another record doesn't open; the envelope names the key (cs1:<key id>:…, the id the first 4 bytes of the key's SHA-256). kit-seal'shs1:opens too; seals staycs1:until a later release flips them (docs/decisions.md, 2026-12-04). Without a key, setting one is refused (409). Deleting an org deletes its secrets in the same transaction. - Rotating the key (2026-12-04; docs/operating.md, "Rotating the secret key"):
CAMSHAFT_SECRET_KEYis the current key, which seals every write;CAMSHAFT_SECRET_KEYS_OLD(comma-separated base64, or its_FILE) holds earlier keys, which only open. An envelope opens with the key its id names. While an old key is held, the service seals each envelope under it again under the current key, at start and every 5 minutes: a page of an org's secrets per store transaction that reads and writes them, so a crash leaves each envelope old or new (both open) and the next pass goes on; a re-seal keeps the secret's times.GET /secrets/keys(an operator,orgs:write; MCPsecret_keys, free) counts the envelopes under each key id, never a value:{"current", "keys": [{"id", "held": "current" | "old" | "no", "envelopes", "droppable"}], "done"}. An old key with none left isdroppable. An envelope under a key not held fails the step that sends it:the org's secret "X": sealed with key <id>, which this Camshaft doesn't hold, naming no value; the status counts it under"held": "no". Giving the key back inCAMSHAFT_SECRET_KEYS_OLDmends it. - The service-wide set (
CAMSHAFT_FLOW_SECRETS, how secrets were held before) is a fallback only for the orgs named inCAMSHAFT_FLOW_SECRETS_ORGS(comma-separated;-for flows in no org): an org named gets anXit doesn't hold itself from there; every other org gets nothing from it. Setting the set without naming orgs stops the service at start, so who uses it is always said.
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.
| To | By pointer (mouse, pen, touch) | By keyboard |
|---|---|---|
| Wire | drag a source onto a slot; the slots its type fits light up, the rest dim | focus a source, Enter, focus a slot, Enter (Escape cancels) |
| Reorder | drag a step by its title up or down | Alt+Up, Alt+Down on the step |
| Clear a wire | select it, then its × | focus the wire, Delete or Backspace |
| Undo | the Undo button | Ctrl/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
| Route | Scope | |
|---|---|---|
GET /flows | flows:read | every flow and its newest version |
GET /flows/{name} ?version= | flows:read | the flow, its versions, its input and output types, and its wires (from, path, to, slot, type: what a canvas draws) |
POST /flows/check a draft | flows:read | ok, 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-templates | flows:read | flows 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:write | 201 saved as a new version; 200 unchanged; 400 says what's wrong |
GET /flows/{name}/bundle ?version= | flows:read | the flow with every flow it runs, to import elsewhere (above) |
POST /flows/import {"bundle", "name"?} | flows:write | the 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:read | the 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:read | the 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:start | 201 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": …}
rate_limit: at mostlimitof the flow's runs are made in anyperiod_ms(in all, or per value ofkey); a start past it is dropped: it answers 200 withdropped: trueand no run is made, ever (sending the same id later is a new start). Use it where extra starts are noise (a webhook storm, a sensor); use a throttle where every start must run.throttle: at mostlimitof the flow's runs start in anyperiod_ms(in all, or per value ofkey, a reference into the input). The rest arequeued(queued_foristhrottle:flow/{name}/{value}) and start in order as the window allows, on any worker, held in the store through restarts.debounce: starts with the samekey(none: all of them) withinperiod_msof each other make one run, started once the period passes with no new start; the last input wins. The run iswaitingmeanwhile, and the answer to a start is the id of the run that will start (debounced: true), which isn't the id you sent when yours was collapsed into one waiting. Withmax_wait_ms(at least the period), the run starts no later than that after its first start, however many starts keep coming.priority: a whole number -1000 to 1000, or a reference into the input to one. Among queued runs (for a throttle's place or a concurrency slot) higher goes first, ties by arrival. A start can give its own (priorityin the request), which wins.
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.