Skip to main content
Runtime

Executing Code

Execute programs, evaluate values, and manage live processes with Agent OS Exec.

JavaScriptRuntime and PythonRuntime share the same small execution model. Each call starts a fresh guest process while keeping the runtime’s VM state.

  • execute() returns captured output and an exit code.
  • evaluate<T>() additionally returns a JSON-serializable value or guest error.
  • spawn() returns a live process with stdin, signals, and wait().
  • executeFile() runs an existing VM file; Python also has executeModule().

All modes accept cwd, env, argv, stdin, timeoutMs, an AbortSignal, and output callbacks. The underlying lifecycle and signal behavior is the same as AgentOS Processes & Shell.