Skip to content

Workflow types

A workflow type is the reusable shape of a workflow. It declares inputs and outputs (data interface), user-tunable parameters (configuration schema), validation rules, and the execution graph (workflow definition). Users create workflows from a workflow type by configuring it; running a workflow produces a workflow run.

If a method is "what to do," a workflow type is "what sequence of things to do, and how to map data between them." A workflow type can compose methods, inline operations, and other workflow types.

Anatomy of a .workflow-type.kts

workflowType {
    dependencies {
        // dataType / method / workflowType dependencies, e.g.
        // dataType("data-type:ref:1.0.0")
    }

    metadata {
        reference = "group:id:version"
        name = "…"
        description = "…"
    }

    dataInterface {
        // input("inputName", "data-type:ref:1.0.0") { … }
        // output("outputName", "data-type:ref:1.0.0") { … }
    }

    configurationSchema {
        // user-tunable parameters using the schema description language
    }

    workflowDefinition {
        // operations: method calls, inline ops, nested workflows,
        // parametric / conditional / group operations.
    }

    // Optional:
    // migrationRoutes  { … }
    // analysisStrategy { WorkflowDefinitionAnalysisStrategy.DYNAMIC }   // default: STATIC
    // uiConfiguration  { /* return a UiConfiguration */ }
    // validationRuleSet { /* return a ValidationRuleSet */ }
    // nonInteractiveValidationRuleSet { /* return a ValidationRuleSet */ }
    // migrationRuleSet  { /* return a MigrationRuleSet */ }
}

Required: dependencies (can be empty), metadata, dataInterface (can be empty), configurationSchema (can be empty), workflowDefinition.

Data interface

Declares the workflow's inputs and outputs:

dataInterface {
    input("geometry", "simscale.test:mock-geometry:1.0.0") {
        label("Geometry")
    }

    output("result", "simscale.test:mock-result:1.0.0") {
        label("Result")
    }
}

These are what the user provides at run time (-i geometry:<file>) and what the run returns (-o result:<file>). Inside the workflow definition, each entry is in scope as a typed reference (here geometry and result) — operations consume and produce them.

Fixed input data

An input can be fixed to one specific data, making the data part of the workflow type itself rather than something the user provides — for example the trained model weights of a prediction workflow type:

input("weights", "simscale.ai:model-weights:1.0.0") {
    label("Model weights")
    fixedData("data:3fa85f64-5717-4562-b3fc-2c963f66afa6")
}

A fixed input is never assigned by workflows of the type (validation rejects an assignment) and every run reads the fixed data automatically. The data must exist when the workflow type version is registered, and the registrant needs write access to the data's project. Registration establishes a data reference held by the workflow type version — analogous to the references held by workflow versions and runs — which protects the data from deletion for as long as the version exists: deleting the data (or its project) is refused or the data is spared, and anyone who can use the workflow type can read the data through it. Deleting the workflow type version releases the claim. Only developers of the workflow type can change or release its references; re-registering a snapshot with other fixed data, or deleting it, does not need access to the previous data's project. A fixed input cannot be parametric.

Configuration schema

User-tunable parameters, same DSL as data types' dataSchema { } and methods' configurationSchema { }:

configurationSchema {
    length("edgeLength") {
        label("Edge length")
    }
}

Accessed at run time inside operations as configValueModel.<name>.

Data-type dependencies with a schema can be embedded here as field types (length above is one — and any of your own data types works the same way). That makes configuration and data of the same data type interchangeable inside the workflow definition. See data types — embedding.

Workflow definition

The dataflow graph. The richest block — see workflow-definition.md for full coverage. A summary of what's available:

  • Method operations — call a method declared in dependencies. The method's auto-generated DSL function shows up in scope; you pass workflow output references as named args, configure inside the lambda.
  • Inline operations — value-model lambdas that compute outputs directly, no method call with dedicated provisioning.
  • Nested workflow operations — call another workflow type as if it were a method.
  • Operation groups — group several operations as a unit.
  • Conditional groups — execute or skip a sub-graph based on a boolean condition (requires analysisStrategy = DYNAMIC).
  • Parametric groups — execute a sub-graph repeatedly across a range of parameter values (also requires analysisStrategy = DYNAMIC).
  • Breakpoints — pause-points inserted between operations for user-driven step-through.

Analysis strategy

analysisStrategy { WorkflowDefinitionAnalysisStrategy.STATIC } (the default, can be omitted) is sufficient for workflows whose graph shape is fully known at parse time — no conditionals, no parametric loops at the top level.

DYNAMIC is required when the graph has branching or parametric control flow at the workflow level. Most production workflows are static; advanced workflows that drive optimization loops or branch on configuration are dynamic.

Migration routes and rule sets

When a workflow type evolves (new field, removed field, renamed), existing workflows configured against the old version need a path forward.

  • migrationRoutes { ... } declares which old version(s) can be migrated to which new version(s).
  • migrationRuleSet { ... } transforms the user's old configuration data into the new version's shape along the route.

See migration.md for the rules.

UI configuration

uiConfiguration { ... } returns a UiConfiguration describing how SimScale Workbench renders the workflow's configuration form (where users actually configure their workflow): section grouping, slider controls, conditional field visibility, navigation panes. Optional; basic workflows work without it. The same UiConfiguration shows up in the SimKit Web UI's read-only inspection view.

The schema description language has built-in label("…") and doc("…") calls that handle most simple cases; explicit uiConfiguration is for richer behaviours (visibility based on other fields, custom widgets, etc.).

Validation rule set

validationRuleSet { ... } returns a ValidationRuleSet of configuration-time validation rules. Cases evaluate against configValueModel and emit errors / warnings before the workflow is allowed to run. nonInteractiveValidationRuleSet { ... } holds the expensive rules instead: the workflow runner evaluates them when a run is started, in its VALIDATING state, and fails the run on an error. See validation-rules.md.

Simulation connections

A workflow type whose analysis needs to know which faces of the CAD model touch declares a simulationConnections field in its configuration schema, naming the input that holds the CAD model. The platform combines the contacts it detects on the assigned CAD with the user's corrections and hands the effective connections to the methods. See the simulation connections reference.

Output

simkit component build produces a single <ref>.workflow-type.json envelope. Inside its package field are the description, workflow definition, UI configuration, validation rule set, and migration rule set — each block from the .kts lands in its own slot. Empty blocks emit empty defaults.

Live example

The first-workflow-type tutorial walks through building a workflow type that wraps the simscale.test:native-test:1.0.0 method.

Cross-references