aion/workflow/run
workflow.run (recorded activity dispatch) + now + random (determinism bindings)
Types
Values
pub fn now() -> Result(Timestamp, error.EngineError)
Return AD’s recorded deterministic timestamp.
This is the only time source exposed to workflow code. Workflow authors must not call wall-clock APIs such as Gleam/Erlang clocks from workflow logic, as ambient time would desynchronise replay.
pub fn random() -> Result(Float, error.EngineError)
Draw a deterministic floating-point value from AD’s seeded RNG.
The engine keys the RNG seed on WorkflowId + RunId so replay observes the same sequence. Workflow authors must not call ambient entropy sources.
pub fn random_int(
min: Int,
max: Int,
) -> Result(Int, error.EngineError)
Draw a deterministic integer in the engine-defined inclusive range.
Values come from AD’s seeded RNG through the FFI boundary; no wall-clock or ambient entropy binding is exposed by the SDK.
pub fn run(
activity_value: activity.Activity(i, o),
) -> Result(o, error.ActivityError)
Dispatch an activity through the single recorded side-effect boundary.
Plain Gleam workflow code is re-run on replay. The only recorded
side-effectful path exposed by this SDK is run (and later concurrency
combinators over activities); there is intentionally no generic
side_effect(fn) escape hatch. The activity input is encoded with the
activity’s input Codec, the engine dispatches and records via AD, and the
returned payload is decoded with the output Codec.
pub fn timestamp_to_milliseconds(timestamp: Timestamp) -> Int
Return the canonical millisecond representation of a deterministic timestamp.