The relay command line
relay is a small command line over Relay’s API. It is for the moments when clicking is the wrong tool: a Snakemake rule that should upload its outputs, a cron job that runs a pipeline every night, a CI step that checks whether a job finished.
Every relay command runs one of the same tools an AI agent would, so it carries the same permissions and limits as the token it uses.
Install and log in
Section titled “Install and log in”Install
Terminal window npm install -g @relay-science/mcpThe package also provides the MCP server;
relayis the second command it installs.Create a token
Settings → Account → API access → New token. Give it only the scopes the machine needs.
Log in
Terminal window relay login --url https://relaysci.comPaste the token when asked.
relaychecks it against the server before saving it to~/.relay/credentials.json, readable only by you.
On a server or in CI, skip login and set RELAY_API_TOKEN and RELAY_API_URL in the environment instead. They take precedence over the saved file.
Commands
Section titled “Commands”relay whoami # who the token acts as, and its scopesrelay workspaces # your workspaces
relay upload ./plate.ome.tiff # into the root of Relay Driverelay upload ./plate.ome.tiff --folder plates/2026-09relay upload ./big.zarr.zip --team <team-id>
relay run pipeline <pipeline-id> --input <asset-ref>relay run notebook <notebook-id> # every cell, top to bottom
relay jobs --status processing # pending, processing, completed, failed, cancelledrelay jobs get <job-id>relay jobs watch <job-id> # returns when the job finishes
relay runs --open # Ray runs, in the app and in Slackrelay runs show <run-id> # prompt, transcript, costrelay runs stop <run-id>
relay tools # everything `call` acceptsrelay call search_assets --args '{"query":"nuclei"}'Add --json to any command for the machine-readable result, which is the same structured answer the MCP tool returns:
relay jobs watch "$JOB" --json | jq -r .statusrelay upload results.csv --json | jq -r .file.idExit codes: 0 on success, 1 when the command ran and failed, 2 for a usage mistake, which is reported before anything is sent.
Examples
Section titled “Examples”Run a pipeline every night on the day’s plate and file the result. The token lives in the crontab’s environment, never in the command.
# /etc/cron.d/nightly-plate — RELAY_API_TOKEN and RELAY_API_URL set above this line0 2 * * * lab relay upload /data/today/plate.ome.tiff --folder plates --json \ | jq -r .file.id \ | xargs -I{} relay run pipeline <pipeline-id> --input {}Upload a rule’s output as soon as it exists.
rule upload_counts: input: "results/{sample}.counts.csv" output: touch("results/{sample}.uploaded") shell: "relay upload {input} --folder counts/{wildcards.sample}"Fail the build if a job failed.
status=$(relay jobs watch "$JOB_ID" --json | jq -r .status)[ "$status" = "completed" ] || { echo "job $JOB_ID ended $status"; exit 1; }