Fluent API
The Fluent API is the public authoring spec for ECP (Execution Control Protocol) workflows. You write TypeScript, compile to a JSON manifest, and run that manifest in any compatible environment. Import builders from@executioncontrolprotocol/core.
Hello workflow
workflow(label)— create a builderstep(capabilityId, label)— invoke a capability.with({…})— step input.as("echo")— write output into run state underecho.run([...])— ordered root steps (and flow nodes)
.toManifest(), or on the CLI with ecp compile.
Multi-step and refs
ref("signals.results") becomes a $ref into run state. Keep secrets out of workflows; bind credentials in the environment.
Flow control
From@executioncontrolprotocol/core:
Compose them inside
.run([...]) alongside step(...) nodes. Step IDs are globally unique in the compiled manifest (required for patch paths).
State write modes
.as("name") can take an optional mode (for example create vs replace semantics). Prefer explicit .as() for every step whose output later steps need.
Manifest shape
Compiled workflows use:Render Fluent from a manifest
Core can encode a workflow back to Fluent source (encode path). There is no separate@executioncontrolprotocol/format-fluent npm package — Fluent encode is built into core. Fluent decode is not supported; use ecp compile for TS → JSON.