CREATE AND RUN A WORKFLOW
Prerequisites: Swamp installed, a repository with at least one model. If you need a model first, see Create and Run a Model.
Create a workflow
swamp workflow create deploy-pipelineCreated: deploy-pipeline
Path: workflows/workflow-<uuid>.yaml
Jobs:
main - Main job (edit or replace)
Steps:
example (model_method) - Example step (edit or replace)This writes a scaffold YAML file under workflows/.
Edit the workflow definition
Open the generated file and replace the placeholder step with your model. A minimal workflow with one step:
id: <uuid>
name: deploy-pipeline
tags: {}
jobs:
- name: main
description: Run the greeter
steps:
- name: greet
description: Say hello
task:
type: model_method
modelIdOrName: my-greeter
methodName: execute
inputs:
run: "echo Deploying..."
dependsOn: []
weight: 0
allowFailure: false
dependsOn: []
weight: 0
version: 1For the full YAML schema, see the workflows reference.
Validate the workflow
swamp workflow validate deploy-pipelineValidating: deploy-pipeline
✓ Schema validation
✓ Unique job names
✓ Unique step names in job 'main'
✓ Valid job dependency references
✓ Valid step dependency references in job 'main'
✓ No cyclic job dependencies
✓ No cyclic step dependencies in job 'main'
✓ Step inputs for 'greet' in job 'main' (my-greeter.execute)
✓ GlobalArgument input references for 'greet' in job 'main' (my-greeter.execute)
Summary: 9 passed
Result: PASSEDValidation checks schema, naming, dependency cycles, and that referenced models and methods exist.
Run the workflow
swamp workflow run blocks until the run completes, fails, or suspends at an
approval gate. The exit code reflects the outcome — 0 for success, non-zero
otherwise. See the
workflows reference for
the full flag set.
For scripted or CI use, pass --json:
swamp workflow run deploy-pipeline --json{
"workflowName": "deploy-pipeline",
"status": "succeeded",
"jobs": [
{
"name": "main",
"status": "succeeded",
"steps": [
{
"name": "greet",
"status": "succeeded",
"duration": 23
}
]
}
],
"duration": 28
}Pass inputs at run time
If your workflow defines an inputs schema, supply values with --input:
swamp workflow run deploy-pipeline --input env=stagingYou can also load inputs from a YAML file:
swamp workflow run deploy-pipeline --input-file params.yamlView run history
To see the most recent run:
swamp workflow history deploy-pipelineWorkflow: "deploy-pipeline" (Run ID: "<uuid>")
✓ main (24ms)
✓ greet (23ms)
Result: SUCCEEDED (28ms)To search past runs:
swamp workflow history search deploy-pipelineFor approval gates, see Gate a Workflow with Manual Approval.