Instances and fleets

Instances and fleets

By default every run gets a fresh sandbox that is removed afterwards. When an agent should stay online, keep what it installed, or hold one long conversation, run it on an instance instead.

Instances

An instance is a long-lived machine. It keeps its disk, the tools installed in $HOME and the harness conversation between runs, and can be stopped, started, snapshotted and terminated. It is billed by uptime, whether or not it is running anything.

lgr instances launch desk --agent oncall --size lgr.medium
lgr send desk "Check the error rate on the checkout service"
lgr send desk "Now roll back the last deploy if it is above 5%"   # same conversation
lgr send desk --new "Start over: what changed today?"

An instance launched with --agent serves that agent: each message is a run of the agent's live version on the instance, and the conversation carries on across messages unless the message asks for a new one. Pin a version with --agent oncall@v3, or change the agent later with lgr instances agent desk support-bot (none detaches it). The instance prepares the agent once per version instead of on every run.

Command
lgr instancesList instances with their state, uptime and cost
lgr instances stop deskStop it; the disk and conversation are kept. Refused while runs are active.
lgr instances start deskStart it again
lgr instances snapshot desk --profile goldenSave its disk as a profile version
lgr instances terminate deskTerminate it and delete its disk

Instances are also under Settings → Compute in the console, where you can send them messages.

Sizes

SizevCPUMemoryPrice
lgr.small12 GiB$0.05 per hour
lgr.medium24 GiB$0.10 per hour
lgr.large48 GiB$0.20 per hour
lgr.xlarge816 GiB$0.40 per hour

lgr.medium is the default. Runs on an instance aren't charged sandbox time on top of its uptime; model tokens on platform models are charged as usual.

Fleets

A fleet is a group of identical instances. Messages go to the least busy running member, and each message starts a new conversation by default.

lgr fleets create desk-pool --desired 3 --agent support-bot --size lgr.small
lgr send --fleet desk-pool "Where is order 1057?"
lgr fleets scale desk-pool --desired 5
lgr fleets delete desk-pool

Scaling down removes idle members, newest first. Fleets don't scale on their own yet, and a member that fails isn't replaced automatically.

Profiles

A profile is a saved environment for on-demand runs: workspace, tools installed in $HOME, harness state and environment variables. A run on a profile restores it first and saves a new version afterwards, so setup only happens once.

lgr profiles create dev --setup "npm i -g pnpm" --env NODE_ENV=development
lgr run --profile dev "Set up the repo and run the tests" --repo github.com/acme/app
lgr run --profile dev --continue "Now fix the failing test"
lgr profiles rollback dev --version 3

--continue resumes the harness conversation stored on the profile, and --no-persist runs on it without saving a new version. An instance can be launched from a profile with --profile.

Triggers

Schedules and webhooks can message an instance or fleet instead of starting a fresh run: create them with --instance NAME or --fleet NAME.