Skip to main content
By the end of this guide you have a workflow that gives two coding agents the same task at the same time, each in its own git worktree on its own branch. A join waits for both, and a reviewer agent reads both checkouts and picks one. Two agents in one checkout overwrite each other’s files. In two workspaces they edit, test and commit without touching each other or your main checkout.

Before you begin

1

Create the workflow file

Save this as .reliant/workflows/two-approaches.yaml:
.reliant/workflows/two-approaches.yaml
What each part does:
  • entry lists two nodes, so both branches start together.
  • create_worktree makes a workspace and outputs its path and branch. base_branch starts from the chat’s workspace branch, or the main checkout’s current commit (HEAD). Add copy_files for untracked files such as .env (Workspaces).
  • project.path runs each agent inside its workspace. Without it, both would work in your main checkout.
  • thread: mode: fork gives each agent your request; each inject adds a different approach.
  • join waits for both implementers. A skipped source counts as finished (How workflows run).
  • The reviewer answers through a schema, so report can name the winning branch.
2

Validate, lint and test it with a scenario

A scenario checks the fan-out and join with mocked results, without spending tokens. Save it as .reliant/workflows/two-approaches/scenarios/reviewer_picks_b.yaml:
.reliant/workflows/two-approaches/scenarios/reviewer_picks_b.yaml
terminal
3

Run it

Commit your work first: each workspace starts from the current commit, so uncommitted edits are not in it.
terminal
Both workspaces were created in the same second, then both agents ran side by side.
4

Verify the result

Check the run, then look at the workspaces from the repository:
terminal
Each candidate’s change is in its own workspace. Here A used re.sub and B used str.isalnum(), as their prompts asked:
terminal
The report message, in the run under Runs in the app, names the winner and its branch:
5

Keep the winner and clean up

Open the winner in the app’s Workspaces panel and commit, push or open a pull request from its Changes tab (Git integration). Then Archive both workspaces. An archived workspace leaves the disk once nothing in it would be lost, so one with uncommitted or unpushed work stays.locked in git worktree list is Reliant’s lock, so plain git worktree remove refuses. To discard an archived candidate for good:
terminal

From a chat: spawn with a workspace

Without a workflow file, ask a chat’s agent to create the workspaces with its worktree tool and start a sub-agent in each:
Chat message
In a real run the agent called worktree with action: create twice, then spawn twice in one turn:
spawn call
Each sub-agent committed on its own branch (worktree/wc-split-1795170372, worktree/wc-regex-1795170372), and the main agent recommended one (Delegate work to parallel sub-agents). Use a workflow for the same steps every time, and a chat when the split depends on what the agent finds.

The built-in version: Best of Three

Best of Three runs three candidates in a parallel loop, after rewriting your prompt into a specification. It then applies the winner’s changes with git apply, or has an agent merge the best parts, and runs your test and build commands.

What this does not do

  • It does not merge anything. Committing, pushing and merging are yours, or a git_publish node’s.
  • The pick is a model’s judgment. To make your test command the gate, add a run node per workspace and route on exit_code.
  • Workspaces are not a sandbox. They isolate the agents’ files from each other, not from your machine.
  • Everything runs on one machine. A workspace exists on one machine’s disk, so every agent working in it runs there (chats, workspaces and machines).
  • Each candidate costs tokens. Two cost about twice one implementation, plus the review.

Troubleshooting

A node’s save_message reads only output, inputs, workflow and iter. Read nodes.workspace_a.branch in a later node, as report does.
The first run on a new folder creates the project before its machine has synced .reliant/workflows/. Wait about 20 seconds and run it again.
Reliant locks the worktrees it creates. Archive the workspace in the app first. To delete its directory anyway, run git worktree remove -f -f <path>.

Next steps

Best of Three

Three candidates, a reviewer, and the winner applied with git apply.

Delegate work to parallel sub-agents

Fan work out from a chat with spawn, a plan and briefing files.

How sub-agents and threads isolate context

Threads, nesting depth, concurrency caps and workspaces.

Workspaces

Create, open, archive and clean up workspaces.