Compile a StateGraph into a GraphRunner
Arguments
- graph
A StateGraph object.
- agents
Named list of
Agentobjects.- checkpointer
A Checkpointer or
NULL. Required wheninterrupt_beforeorinterrupt_afteris non-empty.- termination
A termination condition or
NULL.- output_channel
Character or
NULL. Channel returned byWorkflowState$output()after$invoke().- interrupt_before
Character vector of node names. Execution pauses before each listed node and returns control to the caller. Requires a checkpointer and a
thread_idinconfig.- interrupt_after
Character vector of node names. Execution pauses after each listed node and returns control to the caller. Requires a checkpointer and a
thread_idinconfig.
Value
A GraphRunner object.
Examples
schema <- workflow_state(result = list(default = NULL))
runner <- state_graph(schema) |>
add_node("step1", function(state, config) list(result = "done")) |>
add_edge(START, "step1") |>
add_edge("step1", END) |>
compile(output_channel = "result")