Skip to main content
Create several ephemeral branches from one commit when you want multiple agents to solve the same task. Each branch starts from the same files without a repository copy. This guide uses the session branch from Store Session State.

Pin the start state

Read the current tip SHA from your backend session record. Use the same SHA for every attempt.
TypeScript

Create the attempt branches

Create each attempt from the same SHA. Branch creation writes refs only and does not copy Git objects.
TypeScript
Give each sandbox one branch and one credential. Use expectedHeadSha: baseSha for its first commit, then use each returned commit SHA for the next write.
TypeScript

Compare the results

Read each attempt tip as a commit diff from the pinned start state. Evaluate each diff with tests, code review, or your own evaluation method.
TypeScript
See getCommitDiff() for path filters and response fields.

Promote the winner

Promote the best ephemeral branch to a normal branch. You can then review and merge the normal branch.
TypeScript
Delete the other refs after you no longer need their states.
TypeScript
Deletion removes the refs. Git objects remain available while another ref can reach them. See Ephemeral Namespace for promotion details and Branch Protection for per-attempt credentials.