{$name} template. The Swift SDK ships a variable() helper that produces the correct token, plus typed shapes for declaring variables on a Task.
Declare task variables
Task variables live underTask.variables. Each entry is a TaskVariable with a type and a default value.
type is "string", "number", or "boolean". Additional fields are allowed on each variable entry, and unknown fields are preserved by the SDK’s flexible task type.
Reference variables in actions
Anywhere an action expects a string value, usevariable(name) to reference a task variable. The helper returns {$name}.
variable("") raises a precondition failure; names must not be empty or whitespace-only.
Override at runtime
Passvariables when executing a task to override the defaults for a single run. Runtime variables use plain JSONValue values, not the typed TaskVariable shape used at declaration time.
taskVariables, which sets task-scoped defaults for the run without changing the saved task.
Direct execution
scrape, agent, and headful accept the same runtime variable shape when called directly:
Auto-created variables
Some server-side flows auto-create variables (for example when a script writes a result to a new name). Those entries includeautoCreated: true. The SDK preserves the flag on read and write.
Related
Actions
Every action helper that accepts a template value.
Tasks resource
Full reference for saving and running tasks.