Skip to content
Bodylet AIBodylet AI
All pages

What agents can do

Once an agent is connected (see Connecting agents), you talk to it as usual. It uses the Bodylet tools when the work needs one of your machines. Each section below gives an example of what to ask, what happens, and the same thing with the bodylet command.

An agent can only do what both its token and the machine's local policy allow. See Permissions and safety.

Run commands#

What happens. The agent finds build-box in your fleet and starts the command there. The command runs under the account that installed Bodylet on that machine, in its default shell (sh on Linux and macOS, PowerShell on most Windows machines). A command that takes long becomes a job: the agent follows it, reads its output as it comes, and can cancel it. You see every job on the Jobs page of the dashboard.

It needs: the Terminal capability on the agent's token, and terminal.exec allowed on the machine.

With the command line:

Terminal
bodylet exec build-box --shell sh -- 'make test'
bodylet exec office-pc --shell powershell -- 'Get-ChildItem C:\Users'
bodylet exec build-box --shell sh --detach -- './long-task.sh'   # returns at once
bodylet jobs                          # recent jobs
bodylet logs <job-id> --follow        # read a job's output
bodylet cancel <job-id>

exec prints the output as it arrives and exits with the command's exit code. Ctrl-C asks whether to cancel the job, leave it running, or keep following it.

Read, write and copy files#

What happens. The agent lists the folders the machine opens to agents, finds the file and copies it. Small text files are read and written directly. Whole files up to 1 GiB are copied with their SHA-256 checksum checked at both ends. A copy that is cut goes on where it stopped.

What happens. The agent copies the folder straight from one machine to the other, up to 8 GiB, without passing through your computer.

It needs: Read files (and Write files to write) on the token, and folders that the owner opened on the machine. Agents reach nothing outside them, and never the files of Bodylet itself.

Terminal
bodylet files ls office-pc            # the folders opened to agents
bodylet files get office-pc /home/ana/Shared/report.pdf ./report.pdf
bodylet files put office-pc ./notes.txt /home/ana/Shared/notes.txt
bodylet files transfer build-box:/home/ana/out office-pc:/home/ana/Shared/out

See Moving files.

Web apps and ports#

What happens. The agent starts the server on the machine, checks that it answers, and gives you a private address. It opens in your browser when you are signed in to your Bodylet account. Nobody else can load it, and neither can the agent.

What happens. The agent opens a forward: port 5432 of the machine becomes reachable on 127.0.0.1 of the agent's computer, for any program there. Nothing is public.

For a program that must call a web service of a machine (a script, a webhook you configure), an exposure gives it an https:// address and a secret, shown once.

It needs: the port opened by the machine's owner (to previews, or to forwards), and Open previews or Forward ports on the token. Only ports from 1024 to 65535.

Terminal
bodylet preview open build-box --port 5173
bodylet forward build-box:5432 --local 15432
bodylet expose build-box --port 8080 --token

See Web apps and ports, which says when to use each one.

Install what the work needs#

What happens. The agent asks Bodylet for a machine with CMake. Bodylet checks the machines, and when CMake is missing it shows a plan: which package it would install, and whether the install runs as root. By default the plan waits for your approval on the Approvals page. Then it runs, and Bodylet checks again.

It needs: Check applications, and Install applications to install, on the token; and the owner's permission on the machine.

Terminal
bodylet requirements check build.yaml
bodylet requirements apply <session-id>

See Applications and requirements.

Work on several machines#

What happens. The agent opens a work session: it asks Bodylet for one machine per role ("build" on Linux, "test" on Windows), and Bodylet picks them and holds them for this work. The agent tells you which machines it got, runs each step on them, and closes the session at the end. A session also ends by itself after its time is up (one hour unless the agent asks for more, 24 hours at most), or after 30 minutes with nothing running. The Sessions page shows open sessions, with an End button.

A session is coordination between agents, not isolation: you and your programs on the machine are never held back.

What happens. The agent runs the same command on all three machines at once, as one group, and waits for all of them. If one machine cannot take the command, nothing starts anywhere.

With the command line:

Terminal
bodylet exec --machines build-a,build-b,build-c --shell sh -- 'git pull && make'
bodylet session open --role build:os=linux,cpus=8 --role test:os=windows
bodylet exec --session <session-id> --roles build,test --shell default -- 'make test'
bodylet session close <session-id>

Let Bodylet choose the machine#

What happens. The agent asks Bodylet for a machine by what the work needs: system, processor architecture, number of cores, memory, free disk, GPUs and their memory, capabilities. Bodylet picks the least busy machine that fits and the agent tells you which one and why. If nothing fits, it says which requirement no machine meets, and it does not quietly lower the bar. What Bodylet does not know about a machine does not count as a match: a GPU of unknown memory never meets a memory requirement.

With the command line:

Terminal
bodylet exec --os linux --shell sh -- 'nproc'
bodylet session open --role bench:os=linux,cpus=8,memory=16GiB

See and drive a desktop#

The runtime can let an agent look at the desktop of a machine (its windows, their buttons and fields, a screenshot) and act on it: click, type, press keys, scroll, start an application you listed. It works on Windows and on Linux with an Xorg session, not on macOS. Typed text and screenshots are never written in any log.

On your own machine, the owner turns it on in three steps:

Terminal
bodylet-runtime desktop driver install   # download and check the driver
bodylet policy allow desktop.observe     # see the screen, read windows
bodylet policy allow desktop.control     # use the pointer and keyboard

It needs: See the desktop on the agent's token to look, and Use the desktop as well to act. Tick both when you approve the agent or create its token.

Watch it live. The Screen shows the desktop in your browser while the agent works. Take over makes the agent stop and wait while you use the mouse and keyboard; Hand back lets it go on. On the machine, bodylet-runtime desktop takeover, handback and stop do the same.

Create machines on demand#

A host is a machine of your fleet that creates fresh Linux or Windows machines for a piece of work, and destroys them after. See Machines on demand.

What to expect from a good agent#

Ask your agent to work this way.

  • Say which machine it chose and why.
  • Wait for a long job instead of starting it a second time.
  • Check the real result (the file exists, the service answers) rather than trust an exit code.
  • Stop and tell you when the owner of a machine refused something, and never look for a way around it.
  • Never run a policy command on a machine: what a machine allows is the owner's decision.