Documentation Index
Fetch the complete documentation index at: https://mintlify.com/BabySid/aether/llms.txt
Use this file to discover all available pages before exploring further.
Engine is the only struct exposed at the top level of the aether package. Its surface area is intentionally small: you construct it with functional options, call Start to activate background services, submit workflows, query their state, and tear down with Stop. Every capability is opt-in — the engine makes no assumptions about your infrastructure topology.
Constructor
New
ErrValidation if any required dependency is missing.
Required options (omitting any of these causes New to return an error):
Sets the state persistence backend. All workflow and task run state is
written here. See Store Interface.
Registers an executor plugin. Call multiple times to register multiple types.
At least one executor must be registered. See Executor Interface.
Sets the unique ID generator used to produce
RunID values for workflow
and task runs.Sets the task dispatch bridge between the engine and workers.
See Broker Interface.
Sets a pre-built executor registry. Use when you already have an
*executor.Registry shared with a broker and want to avoid registering
each plugin twice.Sets the expression evaluator used for
when conditions,
repeatCondition expressions, phaseConditions, and retry expressions.
Without this, expression fields are ignored (no conditional branching).Sets the artifact repository. Currently stored but not yet wired into task
execution; reserved for the artifact upload/download feature.
Sets the secret provider used to resolve
valueFrom.secretKeyRef references
in workflow parameters.Sets the hook notification backend. When configured, the engine calls the
notifier when workflow-level and task-level hooks fire.
Sets the error observation sink. The engine reports internal non-fatal errors
(hook failures, store errors in void callbacks) here for external monitoring.
Scheduling behaviour is identical whether or not a sink is configured.
Sets the timeout watchdog. Required to enforce
spec.timeout and per-task
timeout fields. The watchdog calls OnTaskTimeout and OnWorkflowTimeout
when deadlines are exceeded.Registers a global variable source available in all workflow templates.
Call multiple times to layer multiple providers (per-call providers have
higher priority). Intended for stable, run-independent data such as system
metadata.
Sets the worker registration and discovery backend. Used by distributed
broker implementations to route tasks to workers that support a given
executor type.
Sets the cron scheduling backend. Required to use any
*CronWorkflow
method. Without it, those methods return ErrNotSupported.Workflow lifecycle
Submit
runID string that identifies this specific execution. The call is non-blocking:
it returns as soon as the entrypoint task has been dispatched to the broker.
All validation (API version, kind, entrypoint resolution, template nesting depth,
hook template references) occurs before any state is written to the store. If
validation fails, the store is not modified.
Request context. Used for store and broker calls.
The workflow definition to execute. Must not be
nil.System-generated unique identifier for this workflow execution. Pass to
Get, Resume, and Cancel.ErrValidation if the workflow document is structurally invalid.
Store or broker errors are returned unwrapped.Get
Request context.
The
runID returned by Submit.Read-only snapshot of the workflow run state. See
WorkflowExecution below for field documentation.
store.ErrNotFound (wrapped) if the workflowID does not exist.Resume
Resume payloads on top of the original
resolved inputs. The executor then decides whether to remain suspended (return
ExecCodeSuspended again) or complete.
Resume is a no-op if the task is not in PhaseSuspended (e.g. already
timed out, cancelled, or completed by a concurrent Resume).
Request context.
The
runID of the workflow that owns the suspended task.The
RunID of the suspended TaskRun (available from WorkflowExecution.Tasks).Key/value pairs merged into the task’s inputs. Keys in
payload overwrite
matching parameter names; absent keys are left unchanged.ErrInvalidState if the task does not belong to the given workflowID.
store.ErrNotFound if either ID is invalid.Cancel
- Running / Suspended tasks: a cancellation signal is sent to the broker,
then the task is transitioned to
PhaseCancelled. - Created / Ready tasks: transitioned directly to
PhaseCancelled(no broker signal needed since dispatch has not completed).
Cancelled. Workflow-level and
task-level onCancel hooks fire after cancellation.
Request context.
The
runID to cancel.ErrInvalidState if the workflow is already in a terminal phase.
store.ErrNotFound if the ID is invalid.Background services
Start
Stop is called or the parent
ctx is cancelled. Pair every Start call with a Stop call.
If a timeout.Watcher is configured, Start begins the watchdog loop that
periodically scans for tasks and workflows that have exceeded their deadlines.
If a cron.Scheduler is configured, Start re-registers all non-suspended
CronWorkflows loaded from the store (crash recovery) and begins the cron loop.
Parent context. When cancelled, all background goroutines exit.
Returned if the timeout watcher or cron scheduler fails to start.
Stop
Start. Safe to call
concurrently or multiple times; only the first call takes effect. Stops the
timeout watcher and cron scheduler if configured.
Task callbacks (broker integration)
These methods implement thebroker.StartHandler and broker.CompletionHandler
callback signatures. Local broker implementations invoke them directly;
distributed brokers call them via a message consumer.
OnTaskStarted
Ready to Running, records StartedAt in task metrics, then walks ancestor
DAG/Loop containers and the WorkflowRun upward from Ready to Running.
Fires the workflow-level onStart hook (once per workflow) and the task-level
onStart hook.
Both the leaf transition and the ancestor walk use token-based optimistic locking
so duplicate or concurrent invocations are idempotent.
Request context.
The
RunID of the started task.OnTaskCompleted
- Guards against duplicate callbacks (ignores if task is not
RunningorSuspended). - Derives
PhasefromExecOutputs.Code, optionally overridden byphaseConditions. - Handles the suspend fast-path (
ExecCodeSuspended→PhaseSuspended, accumulates partial outputs, firesonSuspendhook, returns early). - Evaluates the retry policy; if a retry is needed, resets the task to
Createdand re-dispatches. - Computes
Metrics(FinishedAt, Duration, Retries). - Merges executor outputs with template-declared output defaults.
- Persists the final state via
UpdateTaskRun. - Fires task-level phase hooks.
- Calls
advanceScopeto dispatch newly-unblocked tasks or finalize the scope.
Request context.
The execution result from the worker. See TaskResult.
Watchdog callbacks
OnTaskTimeout
timeout.Watcher when a task run has exceeded its deadline.
Idempotent: if the task is already terminal the call is a no-op.
Sends a best-effort cancellation signal to the broker, then calls
OnTaskCompleted with ExecCodeTimeout — reusing the same completion path for
hooks, retry checks, metrics, and scope advancement.
Request context.
The timed-out task’s
RunID.OnWorkflowTimeout
timeout.Watcher when a workflow run has exceeded its deadline.
Idempotent and safe for concurrent invocation from multiple engine instances.
Marks all non-terminal task runs as Timeout, sends cancellation signals to
the broker for each, then marks the workflow run as Timeout. Fires
workflow-level onExit hooks.
Request context.
The timed-out workflow’s
RunID.CronWorkflow operations
All methods in this section requireWithCronScheduler to be configured.
Without it they return ErrNotSupported.
SubmitCronWorkflow
CronWorkflow for periodic execution. Returns the
system-generated cronID. The definition is stored as an immutable JSON
snapshot; only scheduling fields can be updated later via UpdateCronWorkflow.
Request context.
Must not be
nil.System-generated unique identifier. Pass to
GetCronWorkflow,
UpdateCronWorkflow, and DeleteCronWorkflow.ErrValidation if the document fails validation. ErrNotSupported if no
cron scheduler is configured.GetCronWorkflow
CronWorkflow and all WorkflowRuns it has
triggered.
Request context.
The ID returned by
SubmitCronWorkflow.See CronWorkflowExecution below.
UpdateCronWorkflow
CronWorkflow (schedule,
timezone, concurrencyPolicy, suspend, startAt, endAt,
startingDeadlineSeconds, history limits). Re-registers the schedule with
the cron backend automatically.
WorkflowSpec is immutable. Attempting to change it returns ErrValidation
with a message indicating that a delete-and-resubmit is required.
Request context.
The ID of the registered cron workflow.
Updated definition. Must not be
nil.DeleteCronWorkflow
CronWorkflow. WorkflowRun records previously
created by this cron workflow are not cascade-deleted.
Request context.
The ID to delete.
store.ErrNotFound if the ID does not exist.Return types
WorkflowExecution
The read-only return type of Engine.Get. Internal store fields (Token,
raw Workflow JSON, UpdatedAt) are deliberately excluded.
Unique identifier for this workflow execution.
Current phase. Empty string (
"") when not yet set (before first
OnTaskStarted). See Phase values.Human-readable status message. Set on cancellation, error, or timeout.
Workflow-level outputs.
nil until the workflow finalizes. The Phase,
Metrics, and Parameters embedded in Outputs reflect the final state.Timing metrics:
StartedAt, FinishedAt, Duration (Go duration string),
Retries.Wall clock time when
Submit persisted the workflow run."<completed>/<total>" task count string. Empty when no tasks exist.
A task is counted as completed when it reaches any terminal phase.All task runs in creation order, including intermediate DAG and Loop
container runs. See TaskExecution below.
TaskExecution
The read-only view of a single task run within a workflow.
Unique identifier for this task run.
Parent workflow run ID.
ID of the parent container task run (DAG or Loop). Empty string for
top-level scope tasks.
Tree depth from the root scope.
0 = top-level.Direct-parent path segment, e.g.
"main-pipeline/" or
"batch-review.loop[0]/". Used as part of the idempotency key in
CreateTaskRun.Task name within the current scope. Unique among siblings.
Name of the referenced template definition.
One of
"dag", "task", or "loop".Wall clock creation time.
Current phase of this task run.
Human-readable status message.
Resolved task inputs at dispatch time. For suspended tasks accumulates
successive
Resume payloads merged on top of the originals.Task outputs after completion.
Task timing metrics.
Number of retries already consumed.
0 = first attempt, 1 = first retry.CronWorkflowExecution
The read-only return type of Engine.GetCronWorkflow.
The
cronID returned by SubmitCronWorkflow.All
WorkflowRuns triggered by this cron workflow, each as a full
WorkflowExecution snapshot.Phase values
Themodel.Phase type is a string with the following values:
| Phase | Description |
|---|---|
"Created" | Task persisted; awaiting scheduling (dependencies not yet met). |
"Ready" | Engine has committed to execute; Broker.Dispatch has been called. |
"Running" | Worker has called StartTask; real execution has begun. |
"Suspended" | Executor returned ExecCodeSuspended; awaiting Resume. |
"Succeeded" | Completed successfully (ExecCodeSucceeded). |
"Failed" | Business-level failure (ExecCodeFailed). |
"Error" | System-level failure (ExecCodeError). |
"Timeout" | Exceeded the configured deadline (ExecCodeTimeout). |
"Skipped" | when condition evaluated to false. Engine-set only. |
"Cancelled" | User called Cancel or workflow was cancelled. Engine-set only. |
PhaseSkipped and PhaseCancelled are set exclusively by the engine and never
appear in ExecOutputs. Executor plugins must not attempt to return these codes.Error variables
Returned when an operation is invalid for the current state, e.g. cancelling
an already-terminal workflow or resuming a task that belongs to a different
workflow run.
Returned by
New, Submit, SubmitCronWorkflow, and UpdateCronWorkflow
when the workflow document fails structural or semantic validation.Returned by CronWorkflow methods when
WithCronScheduler was not provided
to New.errors.Is to match these sentinel errors through wrapped chains: