---
question: How do I start a workflow from Nexus, Python or HTTP?
kind: task
via_web: available
via_cli: na
via_python: available
via_api: available
via_config: na
ref_web: System › Jobs › Run now
ref_python: get_workflow(name).run()
ref_api: POST /api/workflows/{module_id}/{name}/runs
prereq: You need a workflow in a module that runs, with discovery and the `document` service, as `abi new module` writes it. [Create a workflow](/capabilities/build/agents/creating-a-workflow) first.
next:
  - /capabilities/build/workflows/monitor-and-cancel-a-run
  - /capabilities/build/workflows/schedule-a-workflow
  - /capabilities/build/workflows/expose-as-a-tool
---

# Run a workflow

A workflow runs in one of two ways:

- **A direct call.** Code of the module, or an agent tool, awaits a class's `run(parameters)` in process. It returns at once, and nothing records it.
- **A durable run.** A caller starts the workflow by name: a `@workflow`, or a class through its published name `workflow.<slug>`. The trigger is stored in JetStream, one replica of the module runs it, and the run is recorded with its input, steps and output in System › Jobs. A durable start answers with a run, and the caller waits for it as long as it chooses.

## Web UI

### Open the workflow

Open **System** from the Nexus sidebar, then the **Jobs** tab. Pick **Workflows** in the kind filter, then click the workflow. A class shows under its published name, such as `workflow.customers_workflow`.

![System app on the Jobs tab, filtered](/abi/Screenshot_System_Jobs.png)

*System › Jobs: jobs and workflows, with their schedules and recent runs.*

### Fill in the input

Click **Run now**. The dialog shows the module id and a form built from the workflow's input schema, required fields first; **JSON** switches to an editor for the same input. The input is checked against the schema before anything is sent: a field that does not fit is named in the form, and nothing starts.

### Start it

Click **Run** (or press ⌘↵). The start is written to the audit log. The run shows in the workflow's **Runs**, `QUEUED` until a replica takes it. Click it to follow its steps: see [Monitor and cancel a run](/capabilities/build/workflows/monitor-and-cancel-a-run?via=web).

The System app is for platform super admins only.

## CLI

Not applicable. No `abi` command starts a workflow run. From a terminal, use `curl` as in the [REST API steps](/capabilities/build/workflows/run-a-workflow?via=api).

## Python

### Call `run` directly

Inside the module, the instance is already built. `run` is `async`:

```python
workflow = self.get_workflow_instance("customers_workflow")
result = await workflow.run(CustomersWorkflowParameters(entity_id="42"))
```

The module builds its classes after `on_initialized`; to call one inside that hook, `await self.build_processes()` first.

### Start a durable run

`get_workflow(name)` returns a proxy with two methods, both coroutines:

```python
report = self.get_workflow("daily_report")          # one of this module's workflows

output = await report.run({"day": "2026-10-31"})    # start, wait, return the output
run = await report.start({"day": "2026-10-31"}, idempotency_key="report-2026-10-31")
```

- `run(input, timeout=)` returns the output, or raises `WorkflowRunFailed` when the run did not succeed. `timeout` bounds the wait (`asyncio.TimeoutError`); the run goes on.
- `start(input, idempotency_key=)` returns a `WorkflowRun` at once: `status()`, `wait()`, `result()`, `steps()`, `cancel()`. A repeated key within two minutes is the same run.
- The input is a dict or the input model. A class takes its parameters: `self.get_workflow("workflow.customers_workflow").run({"entity_id": "42"})`.
- The module's own workflows are hosted from the end of `on_initialized` until the module stops: `self.get_workflow` raises `JobsNotHosted` outside that time.

### Start another module's workflow

| From | Call |
|---|---|
| A module | `await self.engine.modules["<module id>"].get_workflow(name)`, with the module in `ModuleDependencies(modules=...)`. It raises `RPCError` with `WORKFLOW_NOT_FOUND` when that module declares no such workflow. |
| Code outside a module | `ABIClient(url=..., token=...).get_workflow("<module id>", name, project="<project>")` (`naas_abi_sdk.client`). It checks nothing before the start: a run of a workflow nobody hosts stays `QUEUED`. Pass `project=` the project's discovery project, `nats.discovery.project` in `config.yaml` (the module runs with it as `ABI_DISCOVERY_PROJECT`): it defaults to `"default"`, and a run sent to another project stays `QUEUED`. |

A module's id is its `module_id`. Inside a durable workflow, start a child run with `ctx.call` instead: see [Write a durable workflow](/capabilities/build/workflows/write-a-durable-workflow?via=python#call-other-workflows).

## REST API

### Start a durable run

`POST /api/workflows/{module_id}/{name}/runs` on Nexus starts any durable workflow, of any module. The body is the input (`{}` when empty). Auth: `Authorization: Bearer $ABI_API_KEY`, or the session token of a platform super admin.

```bash
curl -s -X POST "http://localhost:9879/api/workflows/acme.reports/daily_report/runs?wait=30" \
  -H "Authorization: Bearer $ABI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: report-2026-10-31" \
  -d '{"day": "2026-10-31"}'
```

A class is started by its published name: `/api/workflows/acme.reports/workflow.customers_workflow/runs`, with its parameters as the body.

- Without `wait`, the answer is `202` with the run, `QUEUED`. With `?wait=<seconds>` (0 to 120) and a run that ends in time, it is `200` with its `status`, `result` and `steps`. A run that failed also answers 200: check `status`.
- `Idempotency-Key` (at most 200 printable ASCII characters) makes a repeated start the same run, for two minutes.
- An input that does not match the schema answers 422 with `{source, reason, errors: [{path, message}]}`, and nothing starts. A plain job or an unknown name answers 404.
- Every start is written to the audit log first. These routes are not in the generated API reference.

With `abi dev up`, use the `api` port that `abi dev ports` prints. To read or cancel the run, see [Monitor and cancel a run](/capabilities/build/workflows/monitor-and-cancel-a-run?via=api).

## Config

Not applicable. `config.yaml` does not run a workflow. A schedule is a trigger in the module's code: see [Schedule a workflow](/capabilities/build/workflows/schedule-a-workflow).
