Skip to content

Workflow definition

The workflowDefinition { } block of a workflow type is the dataflow graph: which operations run, in what order, with what input and output data mappings, and with any breakpoints for human-in-the-loop pauses. This page covers each operation kind, the data-mapping rules that wire them together, and the analysis strategy that determines whether the graph can branch at run time.

Operations

Seven operation kinds, all subclasses of AbstractOperationDefinition:

Kind When you'd use it
Method operation Delegate computation to a registered method. The most common kind.
Inline operation Compute a value directly from inputs and configuration using value models — no external method call.
Nested workflow operation Invoke another workflow type as if it were a method.
Operation group Group a set of operations as a single unit for organization.
Conditional group Execute a sub-graph if a boolean condition holds; skip otherwise. Requires analysisStrategy = DYNAMIC.
Parametric group Execute a sub-graph repeatedly across a range of parameter values. Requires analysisStrategy = DYNAMIC.
Atomic operation Common base for the leaves above; not directly authored.

All operations have a name, a label (for the UI), an input list, and an output list. The names are unique within the workflow definition.

Method operation

The most common shape — a call to a method declared in dependencies:

nativeTest(
    solverLog = solverLog,
) {
    executionControl = configValueModel.execution
    solverLog       = configValueModel.solverLogConfig
}

nativeTest(...) is auto-generated from the method dependency (simscale.test:native-test:1.0.0 → nativeTest). Named arguments match the method's outputs; the lambda body assigns workflow configuration to method configuration. See methods.md for the code generation contract.

Inline operation

Express a computation in value models — no method call:

operation(
    operationName = "double_length",
    operationLabel = "Double the length",
    inputData = listOf(),
    outputData = listOf(outputLength),
) {
    mapOf(outputLength to (configValueModel.inputLength * 2.asValueModel()))
}

The lambda returns a Map<DataReference, Value> — for each output, a value-model expression that produces it. The platform evaluates the expression directly; no Docker image, no method-engine round-trip.

For when to pick inline vs method, see methods-vs-inline-vs-nested.md.

Nested workflow operation

Invoke another workflow type:

testInlineOperations(
    result = innerResult,
) {
    edgeLength = configValueModel.edgeLength
}

Like a method call, the function is auto-generated from the nested workflow type's reference. The nested workflow's outputs become the calling workflow's named results; the calling workflow maps its own config / inputs into the nested workflow's config / inputs in the lambda.

Operation group

Wraps a sequence of operations as a single named unit:

operationGroup("preprocess") {
    operation(/* … */)
    nativeTest(/* … */)
}

Useful for visual grouping in run inspection (SimKit Web UI, Workbench) and for scoping data-mapping clarity.

Conditional group

operationGroupWithCondition("optional_remesh", condition = configValueModel.refineMesh equal true.asValueModel()) {
    nativeTest(/* the remesh step */)
}

The body executes if the condition holds at run time. Inputs that flow into the group's downstream operations need fallbacks for the "skipped" case — see reference: workflow-definition operations.

Parametric group

operationGroupWithParameter("sweep_edge_length",
    parameter = configValueModel.edgeLengths,
) { currentEdgeLength ->
    nativeTest(/* … */) {
        edgeLength = currentEdgeLength
    }
}

Iterates over a list-typed parameter and executes the body once per element. Use cases: mesh refinement studies, parametric optimization, sensitivity analysis.

Data mapping

Each operation's inputData and outputData lists reference data by symbol. The symbols come from: - The workflow's dataInterface { } (its own inputs and outputs). - A previous operation's outputs. - A parametric group's iteration parameter.

The compiler validates that each input is connected to a producer of the right data type. Configuration values flow separately — configValueModel.<field> is in scope inside operation bodies.

For deeper data mapping topics (default values, input transformations, optional outputs), see reference: workflow-definition operations.

Breakpoints

Breakpoints pause a workflow run between operations for inspection and resume:

breakpoint("after_meshing")
nativeTest(/* solver step */)

When a run reaches a breakpoint, the run state goes to PAUSED; the user resumes via simkit run resume <run-id> (or from Workbench). Useful for debugging long workflows or for human-in-the-loop review.

Analysis strategy

analysisStrategy { ... } declares how the workflow graph is analyzed:

  • STATIC (default) — graph shape is fixed at parse time. No conditional or parametric groups at the top level. Most production workflows are static.
  • DYNAMIC — graph shape depends on configuration. Required for top-level conditional / parametric groups. The runner re-analyzes the graph when the configuration is set.

If you use a conditional or parametric group at top level and forget to flip to DYNAMIC, the build fails with a clear error.

Generated symbols inside workflowDefinition { }

The body has these in scope: - configValueModel — the typed view of the workflow's configuration. Field names match the configurationSchema { } declarations. - A symbol per dataInterface entry — typed to the data type declared. E.g. output("result", "...:mock-result:1.0.0") makes result available as a MockResultDataReference. When the data type has a data schema, the reference's value property exposes the instance content as the data type's value model (result.value.…) — the same class that types configuration fields embedding this data type, so data plugs into configuration type-safely (see data types — type-safe reuse). A metadata property exposes the metadata-schema view when one is declared, and present tests optional data for presence. - A method-call function per method dependency — nativeTest(...) etc. - A nested-workflow-call function per workflow-type dependency — testInlineOperations(...) etc. - Schema-DSL functions for in-line value construction — when building value models for inline operations, helpers from data-type dependencies (MockMeshValueModel.fromDefaults { ... }, etc.) are available.

Output JSON

workflowDefinition { } serializes into the package.workflowDefinition field of the component's JSON envelope (<ref>.workflow-type.json). The platform stores it on register and loads it at run-start to build the operation graph for the run.

Cross-references