Lightweight graph primitives used by LLMAgentR's workflow agents. These utilities are exported so users can build custom state-machine agents.
make_node(func, name = NULL)make_edge(from, to, condition = NULL, label = NULL)
make_command(goto = NULL, update = list())
interrupt(value)
StateGraph()
A list with `func` and `name`.
A list with `from`, `to`, `condition`, and `label`.
A command-like list with `goto` and `update`.
A character string from `readline()`.
A list with methods: - `add_node(name, func)` - `add_edge(from, to)` - `add_conditional_edges(node_name, condition_fun, mapping_list)` - `set_entry_point(node_name)` - `compile(checkpointer = NULL)` - `END_NODE_NAME`
A function that accepts a `state` list and returns either: 1) a named list of state updates, or 2) a command list created by [make_command()].
Optional node name label.
Source node name.
Destination node name.
Optional function `function(state)` that returns a label used for conditional routing.
Optional label matched against the value returned by `condition`.
Next node name to jump to.
Named list of state fields to merge before jumping.
Prompt text shown to the user.