Concepts

Where a step runs

How Kraft hands each agent session and test command to a worker, on this computer or another, and what that worker is trusted with.

Added in 2.4

Kraft's server schedules each step, but it doesn't start an agent or a command itself. It hands the step to a worker process: the local worker on the server's own computer, or a machine you registered.

This page explains why it works that way, what travels each way, and how Kraft picks the place. To set one up, see Run a step on another machine. For every field, see workers.yaml.

Every step goes through a worker

A step has two places to run:

  • The local worker is one process for each installed Kraft, on the server's computer. Kraft starts it, and starts another if it dies. It needs no entry in workers.yaml.
  • A machine is another computer listed in workers.yaml, with kraft, git and the agent CLIs installed.

A step with no runner: runs on the local worker. The server itself runs only builtin and forge tasks, such as making the worktree, opening the merge request and merging. Every agent session and every test command goes to a worker.

The local worker exists so a step doesn't depend on the server staying up. Restart the server and the steps of worktree items that the local worker holds carry on, and the next server picks them up. A machine gives the same separation across a network, and lets a step use a computer other than the server's.

The two differ in where the files are. The local worker works in the item's own worktree. A machine works in a copy of it, so something has to carry the work there and back.

What travels

A machine never talks to your forge. The server sends it everything a step needs and takes back what the step made. A machine needs no forge credentials, and the server stays the only place that pushes.

  1. 1server to machineasks which of the item's commits the machine already has
  2. 2server to machinesends the missing commits as a git bundle, the files the step may read and write, and the jobThe machine runs the repo's setup command, then the agent or command, in its own copy.
  3. 3machine to serverstreams the log as the step writes it
  4. 4machine to serversends back its new commits as a bundle, and the files that changedThe server checks both, then moves the item's branch. Only then does it look at the step.
One step on a machine. The server learns which commits the machine has, sends only the missing ones and the files the step may touch, and then watches the log. When the step ends, the machine sends back its new commits and changed files, and the server checks them before it moves the item's branch.

Out. The machine reports which commits it already holds, and the server sends the rest of the item's branch as a git bundle. Each item has its own copy on the machine, so an item's first step there receives its whole branch, and later steps only the new commits.

With the bundle go the files the step may read and write: the item's docs/ folder and earlier sessions' results and summaries. The files and, in a Git LFS repo, the objects travel within the limits in What the server checks on a result. The job says what to run, with its environment, git identity, time limits and the repo's setup command.

Back. The log streams home as it is written. After the step come the new commits, again as a bundle, and the files the step changed in the places it may write.

Never. The database, the gates and every decision on them stay on the server, as do the pushes and merges to the forge, and its credentials. A machine is never asked to push or merge.

No secrets. A machine comes set up: you install kraft and the agent CLIs there and log them in. The agent runs on the machine's own login, so no API key or token leaves the server. The env: values in repos.yaml do travel, so a secret doesn't belong there.

The machine looks up env_passthrough: names in its own environment. A sandboxed item sends declarations of its credentials, never their values.

A step's own calls to Kraft, such as kraft item progress or a reply to a review thread, cross the same connection. The server answers only what a worker session may call, and only for its own item.

A step may also read its own item's merge request and CI through kraft view mr, pipelines, jobs, job-log, merged and labels. The server asks the forge, so the machine holds no token or forge CLI login. See Reading the forge.

What the server checks

A machine is trusted to run a step, not to describe its result: the server checks every commit, file and call that comes back, and a result it doesn't take fails the step and leaves the branch as it was. What the server checks on a result lists the checks.

How Kraft picks where

A step's runner: says where. An override on one node of the item beats an item-wide override, which beats the library's runner: (step, then node, then chain). The value is one of these:

ValueMeaning
localThe local worker. This is the default.
A machine's nameThat machine, and no other.
anyThe first remote machine, in name order, that is online, may work on the repo and has a free slot. Never the local worker.
A group's nameLike any, but only the group's members. The local worker may be one, and is tried last.

A machine group is a name you give several machines, so a step can ask for "a GPU machine" without choosing which. Machines and groups share one namespace.

Resuming goes back

A resumed step goes back to where it started, because the agent CLI's resume state lives there. A step on any also stays on the machine its node first ran on, for the rest of that pass of the node. Groups holds the rule for resumes and fix-loop relaunches.

Capacity is checked on both sides

Both ends set how many steps a machine runs at once, and the lower limit wins. The machine keeps a limit of its own because the server can't see what else runs on it. See The machine's own limit.

Waiting, and refusals

A step whose machine is offline, full or disabled waits. The board says why, as waiting for gpu-box (full) or waiting for a machine in gpu. The wait holds no slot and doesn't count against the step's time cap. Kraft never runs the step anywhere else to end the wait.

A placement that can never hold is refused instead, with a 422 when you file or override an item and a config_error when the step launches. What a machine refuses lists the causes.

Two ways to connect

A machine connects in one of two ways: it dials in with a token, or the server dials it over ssh. Everything above is the same over either. See Connecting a machine.

When a machine or the server goes away

A step keeps running when the connection drops. The agent's calls to Kraft wait for the connection, and a call already sent fails with a 503 rather than risk acting twice. give_up_after, 2 hours unless you set it or never, is how long either side waits, and only time the server was awake counts. See When the server is gone.

The local worker has no give_up_after, since it sleeps with the server. While only the server is down, nothing enforces a local step's caps; see Restart Kraft.

What a machine can't take

A machine gets a bundle of one repository's branch, so two kinds of item stay on the local worker: an in-place item, which runs in your own checkout, and an item with workspace members, whose members' repos a bundle can't carry. Kraft refuses such an item for a machine, for any, or for a group without the local worker, when you file it. A group that includes the local worker takes it there instead. See What a machine refuses.

A repo with submodules still runs on a machine when the item has no workspace members: What a machine refuses says what stays uninitialised. A repo that uses Git LFS runs only on a machine that has git-lfs: see Git LFS repos on a machine.

Copyright © 2026