std
is a globally available
module, there to help you interact with the runtime.
You create flows using std.flow
. It takes two parameters:
- Name of the flow
- An instance of a class
std.flow
lets you go through the looking glass. It lets you provide a new state machine to the runtime, such that
when it ticks, it manages this newly given state machine as well.
FlowExecutor

A standard flow, lazily evaluated.
What's a FlowGenerator?
What's a FlowGenerator?
std.flow
returns a FlowGenerator
, which is an object that closely resembles the class instance that you provided.
With one key difference, it still has methods, but all of them are FlowFunction
s.What's a FlowFunction?
What's a FlowFunction?
This is as close as we can get to referring the underlying state-machine. A
FlowFunction
represents a factory that
can produce one.It returns a ScheduledFlow
if a schedule is provided to std.flow
, or a FlowExecutor
if not.std.flow
and call a FlowFunction
, you get a FlowExecutor
. This is a handle that encapsulates work.
A FlowExecutor
doesn’t start its work unless explcitly told to do so. It has two function through which
you can start execution:
We will look at
await
in next section.RT
captures the return type of the FlowFunction that spawned it, M
we can ignore for now.
Given a FlowExecutor
is a handle, we can do this:
You can pass around flows like values, but be mindful of type arguments. They are essential to creating
the call graph.
Scheduled Flows

A scheduled flow, eagerly evaluated, run immediately.
std.flow
to get a ScheduledFlow
. A schedule
is an object and it can
have of the following keys:
Start the flow after given number of
ticks
have passed.Start a flow every time given number of
ticks
pass.ScheduledFlow
is evaluated immediately, and it begins its work in the same tick it’s created.
Check out the playground to see how we can emulate a polling job using it.