The SDK

A saved workflow is a URL. Run it with a key from a script, a server or another workflow.

Install

npm install @leumas/workflows-sdk — one fetch per call, no dependencies. createClient({ apiKey }) gives you list, get, save, run, runs, runStatus, resume, arm, disarm and webhook.

Run

POST /api/workflows/mine/ID/run with { input } and Authorization: Bearer lk_… answers { runId, status, steps, trace }. A key reaches only its owner’s workflows, and every run counts steps against the owner’s monthly allowance — a 402 carries { limit, used }.

Webhook

POST /api/workflows/mine/ID/webhook mints an inbound address. Anything POSTed to /api/automation/hook/HOOK_ID starts the workflow with the body as its input. The hook id is the secret; rotate it by disarming.

Dry run without a key

POST /api/workflows/dryrun with { workflow, input } walks any graph with nothing behind it and needs no account. It is how the builder checks a draft, and how an agent can check one before saving.

Agents

The same verbs are exposed as an adapter, so the leumas-mcp bridge hands a coding agent listTemplates, validateWorkflow and dryRun as tools.