Drive a REPL
Open Python in a named terminal, then read the screen until the >>> prompt is visible. Opening starts the program right away.
{ "name": "terminal_open", "arguments": { "name": "console-repl", "shell": "bash", "command": "python3" } }Send one expression and wait for the next prompt:
{
"name": "terminal_send",
"arguments": { "session": "TERMINAL_ID", "text": "print(21 * 2)", "enter": true,
"await": { "until": "pattern", "pattern": ">>>\\s*$" } }
}The send result's success confirms delivery of the input. Verify that 42 and the next prompt appeared; if the prompt is still missing when the wait ends, read the screen before sending more. Finish with exit(), then close the terminal.
Screen, incremental and history reads
- Screen shows the current view; use it to judge the current prompt or application.
- Incremental returns finalized lines since a cursor shared by every reader of that terminal, so another reader can advance it and an unfinished prompt can be absent.
- Scrollback returns retained earlier lines, within the configured history window.
Supervise a background process
Submit the process with background: true and keep both returned identifiers:
{
"name": "terminal_run",
"arguments": { "command": "python3 -u -c \"import time; print('background-started'); time.sleep(30); print('background-finished')\"",
"shell": "bash", "background": true }
}A background submission returns promptly. Read the screen for the start marker, and use terminal_stats for a process-tree sample. Output watches sample and batch output.
Before counting the run as successful, list the terminal with historyLimit: 1 and require state: "completed" with exitCode: 0. Stop the watch with off: true and close the terminal when you are done.
Hand a terminal to a person
Browser access is interactive control of the same terminal your client operates: the person can read output, type commands and resize the screen. Share only a terminal you are authorized to expose, and agree who is in control.
The service owner must have enabled the bridge and provided a reachable, protected route. Expose one terminal you own:
{ "name": "terminal_open", "arguments": { "session": "TERMINAL_ID", "web": true } }Treat the returned attachUrl as a credential and send it only through an agreed private channel. Use the protected route for confidential input. Repeating web: true rotates the token and web: false removes it; both apply to later admissions. An open browser connection stays open until that person closes it.
What you getInteractive programs and long-running processes your agent can drive and check, and a terminal you can share with a person once the browser bridge is enabled.