Request an invite
Docs menu

Collect agent trajectories

Record an AI agent's attempts at one task, each in a throwaway clone, as trajectories for training or evaluation.

Requires OSMates Pro.

Run a task

You need a machine or template set up for the task, such as an Ubuntu desktop. You also need a program that runs your agent, through osmates agent or MCP. Allow that program on the machine, and each clone allows the same.

To run the task on 4 clones of ubuntu:

sh
osmates trajectory run ubuntu --task "Make a folder named done on the desktop" --count 4 -- ./agent.sh

Once a clone is ready, your program starts on your Mac. It finds the clone's name in OSMATES_MACHINE and the task in OSMATES_TASK. The clone is deleted when your program ends, when something fails, or when you press Control-C.

The command exits 0 when every clone gave a trajectory, whether the task passed or not. Each agent has 30 minutes, which --timeout <seconds> changes. Clones run at once as for a test matrix.

Check whether the task passed

Without a check, the task passes when your program exits 0. To judge the result inside the machine, add a script:

sh
osmates trajectory run ubuntu --task "Make a folder named done on the desktop" --count 4 --check check.sh -- ./agent.sh

The script runs in each clone after your program, as the machine's administrator. Exit 0 means the task passed. On Windows, write it for PowerShell.

Trajectory files

The run writes a new folder, trajectories-<date>-<time>, with a folder for each clone. To name another, add --to <folder>.

File What it holds
entry.json The task, whether it passed, and the size and SHA-256 of every file
trajectory.json Each tool call and its result, in the ATIF format other tools read
events.jsonl Every click, key, and text your agent sent, timed on the video
video/ The screen while your agent had the machine
images/ and trees/ The screen and the accessibility tree after each step
agent/ What your program printed

Inputs are in the machine's screen pixels, timed on the video. Trajectories hold what was on the screen and the text your agent typed. OSMates doesn't upload them.

Pack trajectories for training

To copy the passed attempts into dataset:

sh
osmates trajectory export trajectories-2027-01-15-080000 --to dataset --outcome passed

The export checks every file on the way, and adds manifest.json, with each task and outcome, and SHA256SUMS. To check the copy later, run shasum -a 256 -c SHA256SUMS in that folder.

Leave out --outcome to keep failed attempts too. A trajectory whose files changed is left out, and the command exits 1.

Keep one of your own sessions

  1. Choose Machine > Machine Settings, then click Agents.
  2. Set Record Agent Sessions to Trajectory, then let the agent work.
  3. Write the recording as a trajectory, with the task and how it went. Replace <recording> with its identifier from recordings list:
sh
osmates recordings list ubuntu
osmates trajectory capture <recording> --task "Make a folder named done on the desktop" --outcome passed

To set the recording in Terminal, run osmates vm set ubuntu --record trajectory. The command reference lists every option, and the files have JSON schemas.

Report a problem with this page