Runs API
Run any command from your worktree on a fresh BareCI machine, and stream its output.
Each tool below is an MCP tool on https://api.bareci.com/mcp and, unless it is marked local, a route of the https://api.bareci.com/v1 JSON API. The bareci CLI calls the same routes.
| Tool | What it does |
|---|---|
run_create |
Run a command on a fresh BareCI machine from the repository’s image, with your worktree as the source (uncommitted changes included). |
run_get |
A run’s status, exit code, machine and timings (queue, download, command, upload). |
run_logs |
A run’s output after a sequence number, long-polling up to wait seconds for more. |
run_cancel |
Stop a run: the machine stops the command and is terminated. |
run_artifacts |
Files a run brought back (collect and junit). |
run_create
Start a run. Run a command on a fresh BareCI machine from the repository’s image, with your worktree as the source (uncommitted changes included). Answers with an upload URL: PUT the worktree there (tar.gz of git ls-files -co --exclude-standard, or a git bundle), then read the output with run_logs. bareci run -- <command> does all of it from a shell.
- HTTP:
POST /v1/runs - Scope:
run - Changes state
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
repo |
string | yes | Repository as owner/name, e.g. acme/web |
command |
string or string[] | yes | argv, or one string run with bash -lc |
label |
string | no | Pool label, bareci-4 by default |
branch |
string | no | Branch the worktree is on |
env |
object | no | Plain environment values (no secrets) |
timeoutSeconds |
integer | no | 10 to 21600; 1800 by default (min 10, max 21600) |
collect |
string[] | no | Files or directories to bring back, relative to the worktree |
junit |
string[] | no | JUnit XML files to bring back as test results |
format |
tar.gz, git-bundle |
no | Source format |
shard |
object | no | Sets BARECI_SHARD_INDEX and BARECI_SHARD_TOTAL |
preview |
object | no | Keep the machine after a passing run and serve the app as a preview |
Answer
| Field | Type | Required | Description |
|---|---|---|---|
run |
object | no | The run: id, status, repo, … |
upload |
object | no | {method, url, headers, maxBytes, expiresAt} |
Every answer also carries next: the next action, usually a tool and its arguments.
Example
{ "method": "tools/call", "params": { "name": "run_create", "arguments": { "repo": "acme/web", "command": "<command>" } }}Next: PUT the worktree to upload.url, then run_logs until done.
run_get
Run status. A run’s status, exit code, machine and timings (queue, download, command, upload).
- HTTP:
GET /v1/runs/{run} - Scope:
read - Reads only
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
run |
string | yes | Run id, run_<24 hex> |
Answer
| Field | Type | Required | Description |
|---|---|---|---|
run |
object | no | status, exitCode, timings, … |
Every answer also carries next: the next action, usually a tool and its arguments.
Example
{ "method": "tools/call", "params": { "name": "run_get", "arguments": { "run": "<run>" } }}Next: run_logs while running; run_artifacts when it ended.
run_logs
Run output. A run’s output after a sequence number, long-polling up to wait seconds for more. Call again with after set to the seq in next until done is true.
- HTTP:
GET /v1/runs/{run}/logs - Scope:
read - Reads only
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
run |
string | yes | Run id, run_<24 hex> |
after |
integer | no | The last seq you read; 0 at first (min 0) |
wait |
integer | no | Seconds to wait for new output, at most 25 (min 0, max 25) |
Answer
| Field | Type | Required | Description |
|---|---|---|---|
chunks |
any[] | no | [{seq, at, stream, data}] |
done |
boolean | no | True when the run ended and every chunk was read |
status |
string | no | Run status |
exitCode |
integer or null | no | The command’s exit code once done |
Every answer also carries next: the next action, usually a tool and its arguments.
Example
{ "method": "tools/call", "params": { "name": "run_logs", "arguments": { "run": "<run>" } }}Next: run_logs again with after = the last seq, until done.
run_cancel
Cancel a run. Stop a run: the machine stops the command and is terminated.
- HTTP:
POST /v1/runs/{run}/cancel - Scope:
run - Ends or removes something
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
run |
string | yes | Run id, run_<24 hex> |
Answer
| Field | Type | Required | Description |
|---|---|---|---|
run |
object | no | The run |
Every answer also carries next: the next action, usually a tool and its arguments.
Example
{ "method": "tools/call", "params": { "name": "run_cancel", "arguments": { "run": "<run>" } }}Next: run_get to confirm.
run_artifacts
Run artifacts. Files a run brought back (collect and junit). Download one with GET /v1/runs/{run}/artifacts/{path} and the same token; they are kept 7 days.
- HTTP:
GET /v1/runs/{run}/artifacts - Scope:
read - Reads only
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
run |
string | yes | Run id, run_<24 hex> |
Answer
| Field | Type | Required | Description |
|---|---|---|---|
artifacts |
any[] | no | [{path, kind: file or junit, bytes, at}] |
Every answer also carries next: the next action, usually a tool and its arguments.
Example
{ "method": "tools/call", "params": { "name": "run_artifacts", "arguments": { "run": "<run>" } }}Next: download what you need over HTTP.