Guides
Run a workflow & stream events
Execute a multi-node graph and follow its progress — on every surface.
A workflow chains nodes. Provide either a published
reference (<id>@<version>, see Versioning) or an
inline definition, plus the workflow's inputs, and follow the
event stream to the final outputs. All tabs call the
runs.create contract op (scope: run).
{
"name": "runs_create",
"arguments": {
"workflowRef": "abc123@2.1.0", // or "workflow": { …inline definition… }
"inputs": {
"prompt": { "kind": "text", "value": "a cozy isometric office" },
},
"maxCostUsd": 0.75,
},
}The tool consumes the event stream internally and returns the final output artifacts.
import { BlitClient, run, startRun } from "@blitflow/sdk";
const client = new BlitClient({ apiKey: process.env.BLITFLOW_TOKEN });
const inputs = { prompt: { kind: "text", value: "a cozy isometric office" } };
// Just the final outputs:
const outputs = await run(client, "abc123@2.1.0", inputs, { maxCostUsd: 0.75 });
// Or follow per-step progress:
const handle = await startRun(client, "abc123@2.1.0", inputs, {
maxCostUsd: 0.75,
});
for await (const event of handle.events()) {
console.log(event.type);
if (event.type === "run.completed") return event.outputs;
}# published workflow by reference
blitflow run abc123@2.1.0 \
--input prompt="a cozy isometric office" \
--max-cost 0.75
# or a local YAML definition
blitflow run workflow.yaml --input prompt="a cozy isometric office"Progress streams to stderr; final outputs print to stdout.
curl -N -X POST "https://studio.blitflow.com/api/v1/runs" \
-H "Authorization: Bearer $BLITFLOW_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"workflowRef": "abc123@2.1.0",
"inputs": { "prompt": { "kind": "text", "value": "a cozy isometric office" } },
"maxCostUsd": 0.75
}'The response is a Server-Sent Events stream — read data: lines until
run.completed / run.failed. See POST /v1/runs.