Workflows¶
Use moi-cli workflow to query, deploy, and run workflows from a terminal, read workflow-job state and results, and cancel a job when necessary. The CLI calls the Product API; it is not used to invoke Genesis models.
Prerequisites¶
moi-cliis available.The Product API endpoint, personal access token, and target workspace are configured.
You have a workflow ID; deploying a workflow also requires a checked workflow DSL.
Run the following command to see the subcommands actually provided by the current version:
moi-cli workflow --help
Inspect workflows¶
List workflows in the current workspace:
moi-cli -o workflow list --workspace-id "$WORKSPACE_ID"
Read one workflow’s details:
moi-cli -o workflow get \
--workspace-id "$WORKSPACE_ID" \
--workflow-id "$WORKFLOW_ID"
The global -o option returns JSON, which is suitable for reading workflow IDs, state, and available operations. If the workspace is saved in configuration, you can omit --workspace-id from a subcommand.
Start a workflow¶
moi-cli -o workflow run \
--workspace-id "$WORKSPACE_ID" \
--workflow-id "$WORKFLOW_ID"
Save workflow_run.execution_id from the response as the workflow-job ID:
export EXECUTION_ID='<EXECUTION_ID>'
The current workflow run command accepts only a workspace ID and workflow ID; it does not provide a runtime values parameter. To pass values to a run form, use the AI Studio API or AI Studio SDK.
Returning a workflow-job ID only means the platform accepted the run request; it does not mean the workflow has completed.
Query state and results¶
Query workflow-job details:
moi-cli -o workflow get-run \
--workspace-id "$WORKSPACE_ID" \
--workflow-id "$WORKFLOW_ID" \
--execution-id "$EXECUTION_ID"
Get workflow-job results:
moi-cli -o workflow get-run-result \
--workspace-id "$WORKSPACE_ID" \
--workflow-id "$WORKFLOW_ID" \
--execution-id "$EXECUTION_ID"
In a script, bound both the total wait time and number of polling attempts. Stop when a terminal state is returned or the limit is reached; after a timeout, retain the workflow-job ID and return its current state instead of automatically running the workflow again.
Cancel a workflow job¶
Before cancellation, run get-run and confirm the workflow job can still be cancelled:
moi-cli -o workflow cancel-run \
--workspace-id "$WORKSPACE_ID" \
--workflow-id "$WORKFLOW_ID" \
--execution-id "$EXECUTION_ID"
After the cancellation command returns, run get-run again to confirm server-side state. Cancelling a workflow job does not automatically roll back results already written by an operator to a database, file system, or external service.
Common subcommands¶
Task |
Subcommands |
|---|---|
List and read workflows |
|
Deploy a workflow |
|
Pause or resume a workflow |
|
Run a workflow |
|
Query workflow jobs |
|
Read results and operators |
|
Handle retries and operator reruns |
|
Cancel a workflow job or rerun |
|
WorkItem API Service |
|
Artifacts and lineage |
|
For commands that use --json or --json-file for complex input, see the relevant AI Studio API documentation. Do not infer argument names or request bodies from other subcommands.
Manage WorkItem services, operators, and templates¶
Task |
Commands |
Notes |
|---|---|---|
Inspect available WorkItems |
|
Confirm an item before publishing or invoking a service. |
Manage WorkItem API services |
|
Publishing, enabling, disabling, and invoking affect service availability. |
Invoke services dynamically |
|
Use confirmed service or workflow objects. |
Manage custom operators |
|
Read existing operators and state before a write or deletion. |
Manage workflow templates |
|
Use |
Publishing, enabling, disabling, invoking, and deleting can change availability or runtime state. Read the existing object and state first, and provide complex definitions with --json or --json-file.
Inspect artifacts and revisions¶
Task |
Commands |
Notes |
|---|---|---|
Inspect lineage and output |
|
Read artifacts, nodes, and outputs first. |
Manage artifact-block revisions |
|
Query state after creating or switching a revision. |
Manage node-block revisions |
|
Use artifact and node identifiers. |
Rerun an artifact node |
|
Submission only starts a later state change; inspect run records afterwards. |
Inspect import context and run details¶
Task |
Commands |
Notes |
|---|---|---|
Inspect import context with workflow and execution IDs |
|
Provide both workflow and execution IDs. |
Inspect import context with an execution ID only |
|
Use when only an execution ID is available. |
Inspect or adjust run state |
|
Inspect file-execution records before a state change. |
Inspect or cancel rerun branches |
|
Confirm the branch state before cancellation. |
Retry, cancel, or delete a run |
|
These commands change a run or its records. |