CX · Reference guiderun
PlaygroundDownloadsAboutv0.17.0

run

The Runnable convention + combinator library (EXPERIMENTAL x/ tier, #6 D2/M2). A Runnable is any callable value — a [?def], [?fn], $-bound closure, or transport proxy; the convention unifies local fn / MCP tool / A2A skill / pipeline step under one structural contract, with no language trait system (#37). invoke applies a Runnable one→one; batch maps it many→many; pipe / compose / fan-out wire Runnables into Runnables (an LCEL-style algebra). Pure and homoiconic — relies only on uniform lexical scoping + applying a bound callable as a call head. stream + with-config are deferred to their first consumer (S10 LLM provider / streaming).

Experimental x/ tier — imported as cx-x/run. Bundled and gated in-tree like any other module, but EXEMPT from the frozen-surface stability promise (std-lib README, decision D3): a semver-breaking change is allowed here while the surface settles, and the frozen-surface canary never counts it. Pin behaviour you depend on with your own fixtures.

run:invoke

[$run:invoke] -> any — Apply a Runnable to one input (one→one). [$run:invoke R input] = [R input].

run:batch

[$run:batch] -> any — Apply a Runnable to each input in a sequence, collecting results in order (many→many).

run:pipe

[$run:pipe] -> any — Left-to-right composition: returns a Runnable that feeds input through f then g (nests to any depth).

run:compose

[$run:compose] -> any — Right-to-left (mathematical) composition: returns a Runnable computing f after g.

run:fan-out

[$run:fan-out] -> any — Apply each Runnable in a sequence to the same input, collecting results in order (structural parallel).