> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usesynth.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Checkpoint Branching

> Create checkpoints and branch a run when a new direction is needed.

Use checkpoints when a run reaches a useful intermediate state before trying something risky.

## Create a checkpoint

```python theme={null}
checkpoint = run.create_checkpoint(reason="before trying a riskier refactor")
print(checkpoint.checkpoint_id)
```

## Branch from a checkpoint

```python theme={null}
retry = run.branch_from_checkpoint(
    checkpoint_id=checkpoint.checkpoint_id,
    mode="with_message",
    message="Try again from this checkpoint, but optimize for the smallest patch.",
)

print("branched run:", retry.child_run_id)
```

## When to branch

* the first attempt found a useful direction but overreached
* a risky patch needs a smaller alternative
* reviewer feedback changes the goal
* a benchmark direction needs a second controlled attempt

## Expected evidence

* parent run ID
* checkpoint ID
* child run ID
* message explaining the changed direction
* final report comparing the branch to the parent
