Skip to content

Branching

Decide which rollout states are eligible for another continuation. Implement BranchPoints.eligible(state) or use one of the supplied rules. Search priorities rank the eligible states; checkpoint storage is configured separately.

Choose which completed states search may continue from. Implement eligible(); the agent calls it after every decision.

from focus.branching import BranchPoints

Definition

class BranchPoints(Protocol)
def eligible(self, state: AnyRollout) -> bool

Whether search may continue from this state.

Make each decision boundary available for branching. Use it to assign credit to individual task decisions.

from focus.branching import EveryDecision

checkpoints = EveryDecision()

Pass it as Agent(branch_points=checkpoints, ...) so search can revisit intermediate decisions as well as the root.

Definition

class EveryDecision
def eligible(self, state: AnyRollout) -> bool

Make the root and committed compaction or context-change boundaries available for branching. A segment can then span several task decisions.

from focus.branching import SparseCheckpoints

checkpoints = SparseCheckpoints()

Pass it as Agent(branch_points=checkpoints, ...). Ordinary task turns remain in the same segment until the next selected context boundary.

Definition

class SparseCheckpoints
def eligible(self, state: AnyRollout) -> bool