I thought it would be funny to set up an account with an agent as the shell. There are lots of tools for having llms to help on the command line, but none that I could find are recklessly yolo, and they assume you still want to use the terminal; I really wanted the agent to use the terminal for me and just report the results back.
So I set up a PTY-backed virtual terminal using avt in my process, set up an agent with only one tool, and wrapped that in a REPL. The given tool takes two inputs: a string of bytes (with some escape sequences available) to send to bash, and a float: seconds to wait. The tool sends the bytes, waits, and then returns the contents of the virtual terminal. The agent only ever sees the terminal screen, thus having to use the computer just like the rest of us.
This is fun because the agent isn’t just executing processes, it’s driving the whole terminal. It can wait for long running programs, it can do bash job management. It can play NetHack!
Clearly the models are trained to execute commands that will terminate; they required some encouragement to edit files with vim etc. But it was able to install and play nethack without any trouble.
Here's the start of a session with the agent, showing the prompt and its first tool calls.
Play some nethack to show off what you can do. Go for a fast and funny death. After a few turns, suspend the game to quickly do some "work" you forgot about until then (idk, edit a file with vim), then resume playing the game for a little bit.
Tool call 1
{
"str": "nethack\n",
"float": 0.5
}
~/gibberish[0]$ nethack
bash: nethack: command not found
~/gibberish[127]$ â–®
Cursor info: row=2, col=18, char=" "
Tool call 2
{
"str": "sudo apt-get update && sudo apt-get install -y nethack-console\n",
"float": 0.5
}
~/gibberish[0]$ nethack
bash: nethack: command not found
~/gibberish[127]$ sudo apt-get update && sudo apt-get install -y nethack-console
Get:1 https://pkgs.tailscale.com/stable/raspbian bookworm InRelease
Hit:2 http://archive.raspberrypi.com/debian bookworm InRelease
0% [Connecting to raspbian.raspberrypi.com (2a00:1098:0:80:1000:75:0:3)]â–®
Cursor info: row=5, col=72, char=" "
At this point it sent a couple tool calls with no keystrokes just to wait a few seconds at a time for the install to complete.
Tool call 5
{
"str": "nethack\n",
"float": 0.7
}
NetHack, Copyright 1985-2020
By Stichting Mathematisch Centrum and M. Stephenson.
Version 3.6.6 Unix, revised Aug 14 14:04:40 2022.
See license for details.
Shall I pick character's race, role, gender and alignment for you? [ynaq] â–®
Cursor info: row=7, col=74, char=" "