CLI

CLI

lgr deploys agents, talks to them and runs tasks from a terminal. It needs Node.js 22 or later.

Install

The CLI is one file that LagrangeCloud serves for its current release. The lagrange plugin for Codex, Claude Code, Hermes and DeepSeek Harness downloads it for you and picks up each new release by itself. To use it on its own, download it:

curl -fsSLo ~/lgr.mjs https://lgr.tensorblock.co/cli/lgr.mjs
alias lgr="node ~/lgr.mjs"

Download it again to update.

Sign in

lgr login --url https://lgr.tensorblock.co
lgr whoami

This signs in to the production service. To switch an existing staging login to production, run the command above again. For an internal staging or self-hosted deployment, pass its URL explicitly.

lgr login opens a page in the browser with a code to approve, then saves an API key for the project you pick under $XDG_CONFIG_HOME/lgr. In CI, set LGR_API_URL and LGR_API_KEY instead, with a key from Settings → API keys. lgr logout forgets the saved key.

Agents

Command
lgr import [dir]Write lgr.yaml from AGENTS.md or CLAUDE.md, skills and MCP servers. --harness, --model, --mcp a,b to bring servers from your Codex, Claude Code, Hermes or DeepSeek Harness config, --force to rewrite it.
lgr deployCreate the agent in lgr.yaml, or add a version. --file for another file, --preview to add a version callers don't get yet. Refuses a name another folder already deployed; --replace makes this folder that agent's next version. A folder keeps deploying to its agent after the agent is renamed.
lgr release <agent>@vNMake a version live
lgr agentsList current agents; --status active, paused or archived filters lifecycle
lgr agents pause <agent>Pause all new execution and request cancellation of waiting runs; running tasks may finish
lgr agents resume <agent>Resume future execution without catching up missed schedules
lgr agents rename <agent> <new-name>Rename an agent; its ID, endpoint, keys and history stay the same
lgr agents remove <agent>Remove a paused agent after all work and resource bindings are resolved; retain history and reserve the name
lgr agents restore <agent>Restore to paused without restoring revoked credentials, disabled schedules or compute
lgr chat <agent>[@vN]Talk to an agent through its endpoint, as callers do
lgr keys <agent>List caller keys; create NAME or revoke ID
lgr pause <agent> / lgr resume <agent>Stop and resume new calls through the endpoint
lgr improvements [id]List improvement candidates, or show one
lgr promote <id>Promote a candidate; --traffic 0.1 for a canary
lgr reject <id>Reject a candidate (--reason)
lgr rollback <id>Make the version a promoted candidate replaced live again

Global pause leaves instance and fleet uptime billing independent. It keeps each trigger's enabled setting, but blocks execution until resumed; disabled triggers stay disabled. The older top-level lgr pause and lgr resume commands still control only the public endpoint. Neither form stops compute resources.

Runs

Command
lgr run <task>Run a task and stream its progress
lgr runsRecent runs (--status, --agent, --instance, --limit)
lgr logs <run>A run's events; --follow to stream
lgr cancel <run>Cancel a queued or running run
lgr approve <run> <approval>Approve a pending tool call; --deny to reject it
lgr rate <run> good|bad [note]Say whether a run did its job, and why not; quality fixes learn from it
lgr compare <task> --harness a,bRun the same task on several harnesses side by side

Options for lgr run:

Option
--agent NAME[@vN]Run an agent, or one of its versions
--harness ID, --model NAME, --instructions TEXTRun without an agent, or override the agent's
--repo URL --ref REFCheck out a repository into the workspace first
--attach PATHUpload a file for the agent, which finds it in uploads/ in its working directory. Repeat for more files (up to 10, 50 MB each)
--profile NAME [--continue] [--no-persist]Run on a profile
--instance NAME [--continue], --fleet NAMERun on an instance or fleet
--continue-from RUNFollow up on an earlier run (see below)
--approval askPause before tool calls that change things, until you approve them
--callback URLPOST the result to URL when the run finishes
--max-minutes N, --max-cost USD, --max-turns NLimits for this run
--detachPrint the run ID and exit
--jsonMachine-readable output (any command)

Following up on a run

Any run in a sandbox can be followed up: the follow-up starts from that run's sandbox (workspace, installed tools and harness state) and continues its conversation. It runs the agent's live version, so settings changed since then apply; if the harness changed, the new harness starts a fresh conversation and is given the earlier turns as context.

lgr run --agent reviewer "Review the open PRs on acme/app"
lgr run --continue-from run_8f2c41d07a1e "Now leave comments on the two riskiest ones"

In the console, a finished run's page has a Follow up box, and a follow-up shows the earlier runs of its conversation. The API takes continue_from on POST /v1/runs; a run's follow_up_until says how long it can be followed up. Sandboxes are kept for 7 days. Runs on a profile or instance continue with --continue instead, and workflows (agents with steps) can't be followed up.

Compute and triggers

Command
lgr instances [launch|show|stop|start|snapshot|terminate] [name]Long-lived instances (--size, --profile, --agent)
lgr instances agent <name> <agent|none>Serve an agent on an instance
lgr fleets [create|show|scale|delete] [name]Groups of instances (--desired, --size, --agent)
lgr send <instance> <message>Message an instance's agent and stream the reply (--fleet NAME, --new)
lgr profiles [create|show|rollback] [name]Saved environments (--setup, --env KEY=VALUE, --version)
lgr triggers [create|show|enable|disable|callback|fire|delete] [name]Schedules and webhooks (--agent, --instance or --fleet; --schedule "CRON" or --webhook; --message)
lgr callbacks [secret|rotate|retry <id>]Callback deliveries and their signing secret

Secrets

lgr secrets                                   # names and when they were set
lgr secrets set LINEAR_TOKEN CRM_TOKEN --from-env
echo -n "$VALUE" | lgr secrets set STRIPE_KEY
lgr secrets set STRIPE_KEY --value "$VALUE"
lgr secrets delete STRIPE_KEY

--from-env reads each value from the environment, a .env.local or .env file in the current folder, or your Codex config, without printing it.

lgr help lists every command and option.