Start runs

Run linear defineWorkflow steps as one multi-step SDK Execution.

Use lunnoa.runs.start for a linear multi-step ad-hoc Execution (source: SDK) without deploying a workflow first. Each step is a catalogue action. The result is one Execution with a multi-step executionPath, not a soft batch or correlation id.

For a single catalogue action, prefer Run actions (actions.run). To persist a workflow in Automate, use the CLI.

Start from a definition or steps

start-run.ts
import { LunnoaClient, defineAction, defineWorkflow } from '@lunnoa/client';

const lunnoa = new LunnoaClient({
  baseUrl: process.env.LUNNOA_URL!,
  apiKey: process.env.LUNNOA_API_KEY!,
});

const workflow = defineWorkflow({
  slug: 'ping',
  steps: [
    {
      use: defineAction({
        id: 'http_action_send-request',
        input: { method: 'GET', url: 'https://example.com' },
      }),
    },
  ],
});

// Synchronous response: id, status, output, executionPath
const result = await lunnoa.runs.start(workflow);

// Or wait until terminal / NEEDS_INPUT
const execution = await lunnoa.runs.startAndWait(workflow, {
  expansion: ['executionPath', 'source'],
});

You can also pass { steps, name? } or a raw step array. Connection resolution per step matches actions.run: sole usable connection, else workspace default, else 400 with candidates.

runs.start uses the steps only. A trigger on the definition is not sent. Deploy the workflow when the trigger must be saved. See Define locally.

Related