Build your first workflow type¶
End-to-end walkthrough: scaffold a workflow type that wraps a real production method, register it, run it, see the result. The whole thing takes about 30–40 minutes the first time.
You'll touch every layer of the platform: the unified .kts DSL, the
schema description language, the build pipeline, the component registry,
and the run model. Subsequent docs go deeper into each one — this
tutorial stays surface-level on purpose.
Prerequisites¶
- SimKit CLI installed. See installation. Download from the SimKit Web UI's CLI downloads page.
- API key for your SimScale account. Your account needs
MEMBERpermission or higher on the component group you'll register components under (directly or inherited from a parent group), or you must be an admin of your organization. - A SimScale project ID. Workflow runs live inside projects. Projects are created and managed in SimScale Dashboard — create a tutorial project there and copy its ID from the URL or the project's overview page.
- A working directory. Anywhere on disk, no Gradle project required.
For end-users, workflows are created, configured, and run inside projects in SimScale Workbench. Component developers can use Workbench for manual testing. For early technical tests, though, the SimKit CLI is the fastest path, and that's what this tutorial uses. The SimKit Web UI is read-only — a place to inspect registered components and the runs of your workflows, not to drive them.
Conventions¶
- Each code block shows the command to run, ready to copy; the resulting output is described in the surrounding text.
<your-namespace>and<your-project-id>are placeholders to substitute.<your-namespace>is the component group the workflow type is placed in — the organizational namespace for components, shaped as a tree (e.g.simscale.test). Pick one you haveMEMBERpermission or higher on (typically<org>.<team>.tutorialor similar). All1.0.0references in this tutorial are snapshots — re-registerable while you iterate, so collisions with other tutorial-followers don't matter.
Step 1 — Configure simkit¶
Step 2 — Inspect the method you'll wrap¶
You'll build a workflow type that delegates its work to a single
real method, simscale.test:native-test:1.0.0. It's a publicly
available test method that simulates a solver run for a configurable
number of seconds and produces a structured output. Look at it first:
The output shows the method's data interface — two optional outputs,
resultPlots and convergencePlot, both typed
simscale.test:mock-table:1.0.0 (convergencePlot is externally
managed) — and its configuration schema: executionControl, the
solverLog/progressReport/convergencePlot output toggles, a
resultPlots list, and a responseProtocol selector. You'll mirror
these into your workflow in a moment.
Step 3 — Make a working directory and scaffold¶
mkdir hello-workflow && cd hello-workflow
simkit component init workflow-type <your-namespace>:hello-native-test:1.0.0
simkit component init creates a single <id>.workflow-type.kts file
in the current directory — the .kts is the whole component. The
filename uses snake-case (hello_native_test); the component
reference uses the original casing (hello-native-test).
Step 4 — Declare dependencies¶
Open hello_native_test.workflow-type.kts. Replace the empty
dependencies { } block with:
dependencies {
method("simscale.test:native-test:1.0.0-SNAPSHOT-latest")
dataType("simscale.test:mock-table:1.0.0-SNAPSHOT-latest")
dataType("simscale.test:native-test-method-execution-control:1.0.0-SNAPSHOT-latest")
dataType("simscale.test:native-test-method-output-item:1.0.0-SNAPSHOT-latest")
dataType("simscale.test:native-test-method-plot-output:1.0.0-SNAPSHOT-latest")
}
The method dependency brings in the call surface; the data-type
dependencies are required because your workflow's data interface and
configuration schema reference them (mock-table types the two
outputs; the three native-test-method-* types back the config
fields). (If you forget a dependency, the build will fail in phase 2
with the missing reference named — easy to fix.)
Each reference carries the -SNAPSHOT-latest qualifier, which resolves
the newest snapshot of that base version — appropriate for tutorial
use. A concrete snapshot can be pinned instead by spelling out its full
suffix (…:1.0.0-SNAPSHOT-2026-05-15-1). Released components pin to
released versions (a bare …:1.0.0).
Step 5 — Define the data interface¶
The data interface declares the workflow's outputs (and inputs, if
any). Mirror the method's two outputs — both typed mock-table, both
optional, and convergencePlot externally managed:
dataInterface {
output("resultPlots", "simscale.test:mock-table:1.0.0") {
label("Result plots")
optional = true
}
output("convergencePlot", "simscale.test:mock-table:1.0.0") {
label("Convergence plot")
optional = true
dataProviderType = DataProviderType.EXTERNAL
}
}
The names resultPlots and convergencePlot are what the run command
will reference with -o resultPlots:<dir> / -o convergencePlot:<file>
later. dataProviderType = DataProviderType.EXTERNAL marks the
convergence plot as externally managed — the method reports it as a
reference rather than a local file.
Step 6 — Define the configuration schema¶
This exposes user-tunable parameters. Mirror the method's configuration — the execution control (how long to run, success/failure outcome), the three output toggles (solver log, progress report, convergence plot: whether each is produced and at what interval), and the list of result plots to generate:
configurationSchema {
nativeTestMethodExecutionControl("executionControl") {
doc("Configure the duration and terminal state of the method's execution.")
}
nativeTestMethodOutputItem("solverLog") {
doc("Configure solver log output.")
}
nativeTestMethodOutputItem("progressReport") {
doc("Configure progress report output.")
}
nativeTestMethodOutputItem("convergencePlot") {
doc("Configure convergence plot output.")
}
nativeTestMethodPlotOutputList("resultPlots") {
doc("Configure result plot output.")
}
}
The function names (nativeTestMethodExecutionControl,
nativeTestMethodOutputItem, nativeTestMethodPlotOutputList) are
auto-generated from the data-type references you declared as
dependencies in Step 4. The name argument becomes a field on the
workflow's runtime configuration.
Step 7 — Define the workflow¶
The workflow definition is the dataflow graph. With one method-call operation that hands off everything to native-test:
workflowDefinition {
nativeTest(
resultPlots = resultPlots,
convergencePlot = convergencePlot,
) {
// Use the response.json protocol that the current method controller understands.
responseProtocol = ResponseProtocolType.JSON.asValueModel()
// 1-to-1 mapping from workflow config to method config
executionControl = configValueModel.executionControl
solverLog = configValueModel.solverLog
progressReport = configValueModel.progressReport
convergencePlot = configValueModel.convergencePlot
resultPlots = configValueModel.resultPlots
}
}
What's happening:
nativeTest(…) { … }is a function auto-generated from the method dependency. Its named arguments bind the method's outputs to your workflow's outputs (resultPlots = resultPlots,convergencePlot = convergencePlot— the right-hand side is the workflow output you declared in Step 5); the trailing lambda carries the configuration.responseProtocol = ResponseProtocolType.JSON.asValueModel()selects theresponse.jsonoutput protocol. This is required: the current method controller cannot consume the streamingJSON_LINESprotocol inside a workflow.- The remaining assignments map each of the method's configuration
fields from your workflow's
configValueModel— left of=is the method's field, right of=is your workflow's field. Here they share names for a 1-to-1 mapping, but they need not.
Save the file.
Step 8 — Build the component package¶
→ Pre-processing
→ Dependency resolution
→ Description interpretation
→ Definition interpretation
✓ Built <your-namespace>:hello-native-test:1.0.0 → ./hello_native_test.workflow-type.json
The build runs four phases — pre-processing, dependency resolution,
description interpretation, and definition interpretation — and writes
the output JSON envelope next to the .kts
(hello_native_test.workflow-type.json). Phase 2 fetches the method's
description and the two data types' schemas from the registry; the
generated code is what made the function calls in Step 6 and Step 7
type-check.
Step 9 — Register the package¶
register walks the transitive dependency closure: anything your
component depends on that the registry doesn't already have is
registered first. native-test and its data types are already registered,
so this run is a single-component register. On success the CLI confirms
the registered workflow type version.
Step 10 — Verify it landed¶
Or open the SimKit Web UI and find your component under your namespace.
Step 11 — Write a configuration JSON¶
Save the following as config.json next to the package:
{
"executionControl": { "duration": 10, "terminalState": "SUCCESS" },
"solverLog": { "enabled": true, "outputInterval": 2 },
"progressReport": { "enabled": true, "outputInterval": 2 },
"convergencePlot": { "enabled": true, "outputInterval": 2 },
"resultPlots": [
{ "resultFieldType": "AVERAGE_TEMPERATURE", "meshPart": "Face 1", "outputInterval": 3 }
]
}
The JSON keys match the field names you declared in the configuration
schema in Step 6. Their values match the schemas of the corresponding
data types: duration (integer, seconds), terminalState (SUCCESS
or FAILURE), enabled (boolean), outputInterval (integer,
seconds), and each result plot's resultFieldType
(AVERAGE_TEMPERATURE or AVERAGE_PRESSURE) and meshPart. Note that
responseProtocol is fixed in the workflow definition (Step 7), so it
is not part of the runtime configuration here.
Step 12 — Run the workflow¶
simkit run start <your-namespace>:hello-native-test:1.0.0 \
-p <your-project-id> \
-c config.json \
-o resultPlots:./result-plots \
-o convergencePlot:./convergence-plot
Flags:
- -p — your SimScale project ID (run lives inside this project).
- -c — the configuration JSON file from Step 11.
- -o resultPlots:<path> / -o convergencePlot:<path> — output
bindings: when the run produces each output, write it to the given
local path.
The CLI prints a workflow-run id and a link to the run in the simkit web UI.
Step 13 — Track the run¶
Watches state transitions live: CREATED → RUNNING → SUCCEEDED.
The native-test method runs for the duration you configured (ten
seconds in the example config), then the workflow run completes.
Step 14 — See the result¶
resultPlots is downloaded as the produced result-plot data (one entry
per configured resultFieldType/meshPart combination). Because
convergencePlot is an externally managed output, its downloaded file
contains the external reference the method reported for it, not a plot
file.
You can also open the run in the SimKit Web UI for a read-only visual: operation tree, state transitions, resource usage, errors if any.
What you learned¶
- The
.ktsfile is the whole component — one file is everything the SimKit CLI needs. - A workflow type composes methods (and other workflow types, and inline operations — the latter is more advanced and uses value models directly; see the where-to-next links).
- The method-call function is auto-generated from the method's description; its arguments mirror the method's data interface.
- The build → register → run loop is the same whether the workflow has one operation or fifty.
- The SimKit Web UI is for exploring runs, not for starting them. For non-CLI runs, end-users use SimScale Workbench.
Where to next¶
- Concepts: workflow types — full
anatomy of a
.workflow-type.kts. - Concepts: workflow definition — every operation kind (methods, inline operations, nested workflows, parametric and conditional groups), data mapping, breakpoints.
- Concepts: methods — what's inside a method, how the method-call code generation works.
- Concepts: run lifecycle — workflow run / operation run / method run state machines.
- How-to: add a validation rule — guard against bad configurations.
- How-to: release a component — promote a snapshot to a released, frozen version.