# `Cyclium.WorkflowEngine`
[🔗](https://github.com/Cyclium/cyclium_ex/blob/main/lib/cyclium/workflow_engine.ex#L1)

GenServer that coordinates multi-actor workflows.

Subscribes to Bus events for workflow triggers and episode terminal events,
advances step execution based on dependency graphs and failure policies.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `register_dynamic_workflow`

```elixir
@spec register_dynamic_workflow(
  GenServer.server(),
  Cyclium.Workflow.Config.t(),
  map()
) :: :ok
```

Register a dynamic workflow (DB-defined) with pre-built config and input maps.

# `register_workflow`

```elixir
@spec register_workflow(GenServer.server(), module()) :: :ok
```

Register a workflow module at runtime.

# `start_dynamic_workflow`

```elixir
@spec start_dynamic_workflow(GenServer.server(), binary(), map(), keyword()) ::
  {:ok, binary()} | {:error, term()}
```

Start a new dynamic workflow instance by workflow_id.

## Options

  - `:mode` — `:live` (default) or `:dry_run`
  - `:dry_run_opts` — map of dry run options (e.g., `%{persist_findings: true}`)

# `start_link`

# `start_workflow`

```elixir
@spec start_workflow(GenServer.server(), module(), map(), keyword()) ::
  {:ok, binary()} | {:error, term()}
```

Start a new workflow instance from a trigger (compiled workflow module).

## Options

  - `:mode` — `:live` (default) or `:dry_run`
  - `:dry_run_opts` — map of dry run options (e.g., `%{persist_findings: true}`)

# `unregister_workflow`

```elixir
@spec unregister_workflow(GenServer.server(), binary()) :: :ok
```

Unregister a workflow by workflow_id.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
