UniteLabs
Guides

Run a workflow

Trigger a workflow run from the platform UI, the UniteLabs SDK, or the REST API.

Once a workflow is deployed, you can run it from the platform UI, a Python script, or directly via the REST API.

Prerequisites

  • A deployed workflow (see Deploy a workflow)
  • API credentials if triggering programmatically

From the platform UI

  1. Go to the Workflows section and select the workflow you want to run.
  2. Click Run. If the workflow has required inputs, a form appears — fill them in and confirm.
  3. The run appears in the Runs list with status SCHEDULED, transitioning to RUNNING within seconds.
  4. Click the run to see phase progress, step-level logs, and any artifacts produced.

If the workflow reaches a phase that pauses for operator input, the run transitions to AWAITING_INPUT. Fill in the form that appears and click Submit to continue, or Resume for a simple pause with no form.

From Python

Use the AsyncApiClient from the SDK to trigger a run programmatically:

trigger.py
import asyncio
from unitelabs.sdk import AsyncApiClient

async def main():
    async with AsyncApiClient(
        base_url="https://api.unitelabs.io/{tenant-id}",
        auth_url="https://auth.unitelabs.io/realms/{tenant-id}/protocol/openid-connect",
        client_id="{client-id}",
        client_secret="{client-secret}",
    ) as client:
        response = await client.post(
            url="/workflows/{workflow-id}/runs",
            json={
                "name": "Plate QC — Batch 42",
                "parameters": {
                    "sample_id": "B42",
                    "min_concentration": 250.0,
                },
            },
        )
        run = response.json()
        print(f"Run started: {run['id']} ({run['status']})")

asyncio.run(main())

Replace {tenant-id}, {client-id}, {client-secret}, and {workflow-id} with your actual values. The workflow ID appears in the platform URL when you open a workflow.

Watching run progress

Poll the run status until it reaches a terminal state:

wait_for_run.py
import asyncio
import time
from unitelabs.sdk import AsyncApiClient

TERMINAL = {"COMPLETED", "FAILED", "CANCELLED"}

async def wait_for_run(client, run_id: str, poll_interval: int = 5):
    while True:
        response = await client.get(f"/runs/{run_id}")
        run = response.json()
        print(f"[{run['statusSince']}] {run['status']}")
        if run["status"] in TERMINAL:
            return run
        await asyncio.sleep(poll_interval)

Running specific phases

You can start execution from a particular phase — useful when resuming after an interruption or replaying a stage with different inputs. From the platform UI, select the phase from the run detail view and click Run from here.

Next steps