Authoring a workflow
Workflows are authored with the@voyant-travel/workflows package. You define a workflow with an id, a typed input, and a run function that receives the input and a context object:
ctx:
ctx.step(name, fn)runs a unit of work and records its result. On resume, a completed step returns its saved result instead of running again, so steps must be idempotent in spirit.ctx.sleep(duration)durably pauses the workflow. The runtime wakes it when the duration elapses, even if that is days later.trigger.on(...)lets a workflow react to external events.
Triggering workflows
Application code triggers workflows through a separate, app-safe entry point so your app bundle never has to import workflow definitions or runner code:@voyant-travel/workflows/client subpath is the managed Cloud client. It is safe to import from app and server code because it only knows how to trigger and forward events, not how to execute workflow bodies.
SDK subpaths
The authoring package exposes focused subpaths so each runtime imports only what it needs:| Subpath | Purpose |
|---|---|
@voyant-travel/workflows | Authoring API: workflow, trigger, conditions, errors. |
@voyant-travel/workflows/client | App and server-safe managed Cloud client. |
@voyant-travel/workflows/testing | In-process test harness (runWorkflowForTest, resumeWorkflowForTest). |
@voyant-travel/workflows/handler | Node-side step handler for the wire protocol. |
@voyant-travel/workflows/auth | Paired HMAC signer and verifier for dispatch authentication. |
@voyant-travel/workflows/errors | Typed errors: FatalError, RetryableError, TimeoutError. |
Where workflows run
The same workflow definition runs in two modes:- Self-host. Use the
@voyant-travel/workflows-orchestratorengine with the Node and Postgres driver to run workflows on your own infrastructure. - Managed Cloud. Voyant Cloud runs your workflow bundles in a hosted Node runtime. Cloud creates releases from your deployments, artifacts, hashes, and environment snapshots, and injects the runtime configuration your app needs (
VOYANT_CLOUD_WORKFLOWS_URL, a trigger token, the app slug, and the environment).
Developing and inspecting workflows
The CLI drives the full workflow lifecycle locally. Watch and hot-reload definitions while you build:workflows subcommands:
build, deploy, manifest, doctor, trigger, and prune.
Inspecting runs in the UI
The@voyant-travel/workflows-react package ships hooks and an importable admin UI for inspecting workflow runs, so you can surface run status and step history inside your own admin console.
Next steps
CLI commands
Every workflow subcommand and flag.
Deploy to Cloud
Run workflows on the managed hosted runtime.