Executes the graph from its entry node, threading one explicit state list,
writing a checkpoint (state snapshot + event line) after each node. Stops at a
terminal node (no outgoing edge taken), when a human gate pauses the run, or
when a node or an edge predicate raises an error, which ends the run as
"failed". Exceeding max_steps raises llmragent_workflow_error.
Usage
run_workflow(
wf,
input = NULL,
state = NULL,
checkpoint_dir = NULL,
max_steps = 64L,
quiet = TRUE,
...
)Arguments
- wf
An
agent_workflow.- input
The initial input, placed at
state$input.- state
Optional initial state list (merged with
input).- checkpoint_dir
Optional directory for checkpoints (state RDS + a
run.jsonlevent log + acursor.json). WhenNULL, a temporary directory is used so resume/replay still work within the session.- max_steps
Maximum number of steps, counting visits to human gates (loop guard).
- quiet
If
FALSE, print one line per node.- ...
Passed to agent nodes'
reply().
Value
An object of class agent_workflow_run: a list with status
("done", "paused", or "failed"), state, checkpoint_dir, steps
(a tibble of node/status/state_hash for the nodes visited in this call),
(when paused) checkpoint, and (when failed) error, the error message.
Details
When an edge predicate fails, the node before it has completed and its
state is saved; the event log records the failed edge separately from the
node visits, and resume_workflow() retries only the edge selection.
