Workflow Apps
A Workflow App is a registry of authored workflows for packaged execution surfaces. It provides one app identity, title, default workflow, signal descriptors, and a common runtime.
Define an app
import { workflowApp } from "@dromio/workflow";
export const reviewApp = workflowApp({
id: "review-app",
title: "Response Review",
defaultWorkflow: responseReview,
workflows: [responseReview, clarifyRequestWorkflow],
});
workflows must contain at least one authored workflow. If
defaultWorkflow is omitted, the first entry is used. An explicit default must
also be registered.
Inspect the registry
reviewApp.defaultWorkflowId;
reviewApp.workflowIds();
reviewApp.listWorkflows();
reviewApp.getWorkflow("response-review");
reviewApp.graph("response-review");
Each workflow remains independently runnable and inspectable; the app does not
merge graphs or outputs. reviewApp.definition contains serializable app,
workflow, trigger, and signal descriptors.
Prompt adapter constraint
The root CLI, TUI, GUI, and SVG adapters encode a text prompt into a workflow
with exactly one trigger input key. This is an adapter constraint, not a
limitation of workflow.start(). Richer workflow inputs can use direct
execution or a custom host adapter.
Keep entry points thin
#!/usr/bin/env bun
import { runWorkflowCli } from "@dromio/workflow";
import { reviewApp } from "./app.js";
await runWorkflowCli(reviewApp);
The app owns workflow registration. The entry point selects a surface and its host options; it must not reconstruct workflow topology.
Add durable hosting
createWorkflowAppHost() wraps the app runtime with a runtime store, signal
control plane, persistence after state changes, and a Fetch-compatible HTTP
adapter. Choose {kind: "memory"} for tests or {kind: "sqlite", path} for
local persistence. runWorkflowServer() serves that host with Bun.
Persisted runs contain state, events, checkpoints, pending questions, pending hooks, and durable attempt metadata. The host reconciles signal waits at startup and can run delivery passes. External authentication, tenant isolation, retention, and provider-side idempotency remain application responsibilities.
Let an external harness operate the app
A Workflow App is the registry and durable host boundary that an external
harness operates. It exposes the registered workflows, triggers, runs, and
pending interactions through the control plane; it does not embed the harness
or its model provider. See External harnesses
for MCP provider construction, transport, discovery, and dromio.resume_hook.