Skip to contents

Copies the state at a chosen step into a new directory with a fresh run id, optionally mutating it, and runs forward from there. The original run is untouched: resume continues the same run, fork branches a new one.

Usage

fork_workflow(
  x,
  wf,
  at = NULL,
  new_dir = NULL,
  mutate = NULL,
  max_steps = 64L,
  quiet = TRUE,
  ...
)

Arguments

x

A checkpoint_dir or agent_workflow_run.

wf

The agent_workflow (needed to run the branch).

at

Step index to fork from (default: the last completed step).

new_dir

Directory for the branch (default: a fresh temp dir).

mutate

Optional function(state) -> state applied before running.

max_steps, quiet, ...

As in run_workflow().

Value

An agent_workflow_run for the branch.