Mutable shared state passed between graph nodes. Each named channel has a default value and a reducer function that controls how updates are merged.
Value
A new WorkflowState object.
The current channel value.
Invisibly, self.
Invisibly, self.
Named list.
Invisibly, self.
Character vector.
The value of the output channel.
Invisibly, self.
Active bindings
schemaThe raw schema list (read-only). Used by GraphRunner to reconstruct a fresh state on each
$invoke()call.
Methods
Method new()
Create a new WorkflowState.
Usage
WorkflowState$new(schema)Arguments
schemaNamed list where each element is
list(default = <value>, reducer = <function>). Ifreduceris omitted,reducer_last_n()with a window of 20 is used for list channels andreducer_overwrite()for all other channels.
Method get()
Get the current value of a channel.
Method update()
Apply a named list of updates to the state.
Method output()
Return the primary output of the workflow.
Convenience wrapper around $get() for the channel nominated as the
output channel when the graph was compiled. For workflows that accumulate
a list (e.g. messages), returns the full list; use [[length(...)]]
to extract the final entry.
Method set_output_channel()
Set the output channel. Called internally by GraphRunner.