Skip to main content

arkor build and arkor start

arkor build and arkor start are the headless equivalent of Studio’s Run training button. Use them when you want to run a trainer without booting the UI: in CI, on a server, or from another script. Studio’s Run training internally spawns arkor start (without an entry argument), so the runtime path is the same in both flows.

arkor build

Bundles src/arkor/index.ts into .arkor/build/index.mjs using esbuild.

Synopsis

Argument

Output

.arkor/build/index.mjs (outDir defaults to .arkor/build). The output is a single ESM file targeting Node 22.22, with packages: "external" so bare specifiers (arkor, anything from node_modules) stay external and the artifact resolves the runtime SDK from your installed node_modules. Only relative imports are bundled inline. If the entry does not exist, arkor build throws with a hint to either create src/arkor/index.ts or pass an explicit entry.

arkor start

Runs .arkor/build/index.mjs. The runner imports the bundle, finds the registered trainer (preferring export const arkor, then export const trainer, then the default export), and calls trainer.start() followed by trainer.wait().

Synopsis

Argument

The auto-build-on-missing behavior exists so Studio’s “Run training” does not have to chain two spawns. From a script you usually want to call arkor build and arkor start explicitly so a build failure surfaces before you commit to running.

Behavior

The “reuse the artifact” path is what lets Studio surface trainer edits via its /api/manifest rebuild rather than the train endpoint. For a CLI-only workflow, run arkor build whenever you change src/arkor/.

Errors

arkor build: arkor start: runTrainer (programmatic):

Examples

Build then start, two steps:
One step, force a rebuild from a different entry:
Rebuild stale artifact between trainer edits:

See also