Agent tools

terminal

terminal({ action: "list" | "output" | "kill", id?, since? })

The terminals a run started or the user opened. Reading them is free; killing one is a command — the category depends on the action.

read, or exec on killsurvives the answernever on a phone
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

actionstringrequired

list · output · kill.

idstring

The terminal, e.g. t_3. Needed by output and kill.

sinceinteger

output: read from this position. 0 gives everything kept.

Two categories in one tool

ActionCategoryAsked
listreadnever
outputreadnever
killexecin every mode but full

Reading what a server is printing should not need a prompt; stopping it should. The category is computed from the arguments.

The working loop

terminal({ action: "list" })                       // is it already running?
bash({ command: "npm run dev", background: true, port: 5173 })
terminal({ action: "output", id: "t_3" })          // what did it print since last time?
terminal({ action: "kill", id: "t_3" })            // stop it and everything it started
# The calls the model makes, in order:
#   terminal {"action": "list"}                                  is it already running?
#   terminal {"action": "create", "command": "npm run dev"}      start it
#   terminal {"action": "output", "id": "t_3"}                   what did it print since last time?
#   terminal {"action": "kill", "id": "t_3"}                     stop it and everything it started
List before starting

The agent is told to check for a server that may already be running rather than starting a second one on the same port — which fails in a way that looks like the code is broken.

They live in your process

A terminal survives an answer, not a restart of whatever holds the package. Worth saying in any interface that lists them.

Where there are none

Never on a phone. On a cloud workspace only when the application supplies terminals. On a computer, from the machine itself.