Skip to main content

Runtime platform

workflow.getRuntimePlatform() and workflow.isCli() / workflow.isWeb() / workflow.isDesktop() are used to determine the execution host of the current workflow. They describe where the code actually runs, not which entry the user clicked from.

Signature

workflow.getRuntimePlatform(): "cli" | "web" | "desktop"
workflow.isCli(): boolean
workflow.isWeb(): boolean
workflow.isDesktop(): boolean

platform semantics

Return valueDescription
"cli"Execute directly through workflow-code run/json/structure or the local process; this value is used by default when there is no hosting tag.
"desktop"A local Electron Desktop project run. Desktop Main starts the runtime.
"web"A Workflow Server run, including Server Web, External API, Webhook, and other remote triggers.

Example

const outputNode = workflow.createOutputNode<Input, OutputPayload>({
name: "output",
format() {
const platform = workflow.getRuntimePlatform();

return workflow.createOutputPayload({
items: [{
title: "Runtime Platform",
content: {
platform,
isCli: workflow.isCli(),
isWeb: workflow.isWeb(),
isDesktop: workflow.isDesktop(),
},
contentType: "json",
}],
});
},
});

Precautions

RulesDescription
function reads the current runtime tag each timeThe host or test can inject the platform tag when the process starts.
Server runner is fixed to webEven if the request comes from Desktop or Webhook, the remote execution host is still server/web.
Unrecognized marker fallback cliMaintaining compatible behavior for local terminals and legacy hosts.