Skip to main content
Operating System

Processes & Shell

Execute commands, spawn long-running processes, and open interactive shells in agentOS VMs.

  • One-shot execution with exec for simple commands
  • Long-running processes with spawn, stdout/stderr streaming, and stdin writing
  • Process lifecycle management with stop, kill, wait, and inspect
  • Interactive shells with PTY support for terminal I/O
  • Process tree visibility across all VM runtimes

One-shot execution

Use exec to run a command and wait for completion. Returns stdout, stderr, and exit code.

Spawn a long-running process

Use spawn for processes that run in the background. Output is streamed via processOutput and processExit events.

Write to stdin

Send input to a running process.

Process lifecycle

System-wide process visibility

View all processes across all VM runtimes, not just those started via spawn.

Interactive shells

Open an interactive shell with PTY support. Shell data is streamed via shellData events.

Recommendations

  • Use exec for short commands where you need the full output. Use spawn for long-running processes where you want streaming output.
  • Subscribe to processOutput and processExit before calling spawn to avoid missing events.
  • Active processes prevent the actor from sleeping. Stop or kill them when they are no longer needed.
  • Active shells also prevent sleep. Close shells when the user disconnects.
  • Use allProcesses and processTree for debugging. They show everything running in the VM, including agent processes.