Examples
Each example answers one question and shows the real command and its output. The label on each card says whether you can run it today.
Examples labelled available live in the examples/ directory of the openflange-go repository, each with a README and portable tests. Their commands and output are copied from there. Clone the repository once and run every command from its root:
git clone https://github.com/openflange/openflange-go
cd openflange-go
go build -o openflange ./cmd/openflange && export PATH="$PWD:$PATH"Looking for a task rather than a feature? The recipes solve seven common jobs end to end, with every file and the real output: CSV cleaning, a join with a database, deduplication, API calls in batches, LLM summaries, moving averages and masking.
- How do I connect two steps?
Mask an email
Two small pipes — lowercase, then mask — joined by one short pipeline file.
- Can two things read the same output?
Branch without running twice
One lowercase step feeds two consumers. It runs once; both get every record.
- Do I have to rewrite my script?
Use the tool you already have
An R script that reads stdin and writes stdout is already a valid pipe. Values 10, 20, 30 in; count, mean, median and sd out.
- How do I compute window statistics without loading the whole stream?
A moving average in R
std:window cuts the stream into windows of three; an R script answers one window at a time. Memory is bounded by the window size.
- What about the records that fail?
More than one output
Good orders go to one stream, orders that cannot be processed to another. Errors are data you route, not log lines you grep.
- Can a step run somewhere else?
Call a remote step
A remote pipe is four HTTP requests: open a session, POST the input, GET the output, read the status. Here openflange serve is the server and curl is the client.
- Does my query language need a function for this?
Call a pipe from a query
A query language shouldn’t grow a function for everything. Pipe the result through a step instead: the same lowercase and mask pipes, applied to rows from a TugQL query. The syntax is a draft and no released tool runs it yet.
- Can I trust a model inside a pipeline?
Let an LLM decide, keep it honest
Feedback is routed to positive, negative or uncertain. “Uncertain” is an output, not a failure — and a rules-based pipe with the same ports can replace the model. The verified run uses a mock provider.
- Will it do the same thing tomorrow?
Lock what you ran
A lockfile pins every reference to an exact version and an integrity hash. A locked run refuses anything that changed.
- How do I write more than a one-liner without a subprocess?
Transform records with Starlark
A Starlark script — a process(item, params) function — runs inside the runner, sandboxed, with no I/O. No subprocess, no permissions.
- How do I ship a pipe as an npm package?
An npm package that is a pipe
Add a manifest and one line to package.json. The code stays an ordinary Node.js script that reads stdin and writes stdout.
- Can I reuse a package that knows nothing about OpenFlange?
Wrap an npm package
A short Node wrapper turns a library that is already on npm — here ms, which parses durations — into a pipe. The library itself is not modified.
- Can a SQL query be a step?
Aggregate with DuckDB SQL
A SQL aggregation as a pipe: order records in, one total per customer out. A .sql file plus a manifest is a pipe.
- How does a program get a second input or output?
Go multi-port validation
One compiled program, three output streams. stdout carries the main one; the others are POSTed to loopback endpoints the runner hands it. No SDK: standard library only.
- Can my existing web service be a step?
Python HTTP enrichment
A Python service adds a field to each record over the HTTP Pipe Protocol. Plain curl can drive it; a pipeline references it and must grant the network destination.
- How does a Python process get a batch per line instead of a record per line?
A Python script in batch mode
The manifest declares batch: {maxItems: 500, maxWaitMs: 100}; the script reads one JSON array per line and prints one JSON array per line. Standard library only.
- How do I run vectorised R over batches?
Vectorised R over batches
R is fast on vectors and slow when it is called once per record. In batch mode each line is a JSON array that becomes a data frame, so toupper, nchar and cut run once per batch. A second pipe does the same over batch files.
- What does a pipe in batch mode look like in Starlark?
A Starlark pipe in batch mode
The mask-email pipe declared with batch: {maxItems: 256} and written as process_batch(items, params): the runner calls it with a list instead of once per address.
- Can a file-in/file-out tool be a step with no glue code?
DuckDB over batch files
With batch file delivery a tool that reads a file and writes a file becomes a pipe: the command contains {batch.input} and {batch.output}, and the runner starts it once per batch. The manifest is the whole pipe.