Skip to contents

A workflow is a directed graph whose nodes transform a shared, explicit state list. Build it with agent_workflow() then add_node() and add_edge(); run it with run_workflow(). The runtime is minimal: sequential execution, one mutable state, and a checkpoint after each node. A run is therefore auditable and resumable. Reach for it only when a study genuinely needs branching, looping, or mid-run human review; agent_pipeline() and conversation() remain the simpler interfaces.

Usage

agent_workflow(name)

Arguments

name

A label for the workflow.

Value

An agent_workflow object (built up immutably by add_node() / add_edge()).

Examples

wf <- agent_workflow("classify") |>
  add_node("clean", function(state) { state$x <- trimws(state$input); state }) |>
  add_node("label", function(state) { state$label <- nchar(state$x) > 3; state }) |>
  add_edge("clean", "label")
run <- run_workflow(wf, input = "  hello  ")
run$state$label