Starlark and Temporal
Remediation Orchestrator is a Temporal-backed DSL system. Starlark belongs to the workflow side of Temporal execution: it is workflow code interpreted by the orchestrator. Temporal is the async, event-sourced runtime for that interpreter.
That split lets a script branch, wait, call modules, handle failures, and return values in a direct style. Temporal records the durable workflow state underneath.
Why Starlark
Starlark gives Remediation Orchestrator a battle-tested interpreter that is easy to embed in Go. It is a deterministic subset of Python, which fits durable workflow execution well.
Many languages could fill this role. The original authors chose Starlark because it lets Remediation Orchestrator run durable, deterministic Python-shaped workflow code without arbitrary imports, third-party libraries, or the assumptions of a general-purpose Python runtime.
For top-level names, modules, and value types available in scripts, see the Starlark reference.
What Temporal Runs
Every registered Starlark workflow runs inside the same Temporal workflow type: script-workflow.
The Go workflow runs Remediation Orchestrator’s Starlark interpreter. At workflow start, Remediation Orchestrator:
- selects and fetches the script version through activities
- resolves
load()dependencies through activities - constructs the module set
- creates a Starlark runtime session
- finds the registered workflow function
- calls that function with Temporal attached to the Starlark thread
Script selection and dependency resolution are recorded in Temporal history, so a running workflow keeps using the script inputs it started with.
A workflow run uses the script inputs recorded at its start. To pick up a newer script version, the workflow run must be restarted with that version.
The Starlark function is workflow code. Activity code lives behind module calls.
What Starlark Controls
Starlark controls the workflow policy:
- which state comes next
- which module function to call
- when to wait
- when to return, retry, fail, or hand work to a human
A repair workflow might define its state machine like this:
The script decides the sequence. Modules perform the reusable system actions.
Modules As Workflow Operations
Modules expose reusable workflow operations to Starlark. They are written in Go and can use Temporal directly: activities, timers, signals, queries, parallel workflow branches, cancellation handling, and any other Temporal SDK behavior that fits the module.
From a script author’s view, a module function is a named operation that moves the current workflow forward while keeping the current Starlark interpreter state in memory.
Calls that touch external systems have to cross a module boundary. That includes SSH, Slurm, BCM, Jira, object storage, and node registry. Inside a workflow, those module functions usually become Temporal activities or Temporal-safe commands.
Use Starlark for environment-specific orchestration. Use Go modules for reusable effects, API details, polling, retries, authentication, and typed data conversion.
Queries And Identity
The Temporal module exposes workflow identity and links back to Starlark:
Scripts use this to connect tickets, Slack messages, history records, and monitor pages back to the workflow run that produced them.