Skip to main content
Code Execution

Dev Servers

Run a long-lived guest server and request it through AgentOS.

This example starts a Node.js HTTP server with runtime.spawn(), waits for its readiness output, and calls it through runtime.vm.httpRequest(). The guest listener stays inside the VM; no host port is exposed.

The returned process handle controls lifecycle through kill() and wait(). Keep the runtime alive while its server is needed, then stop the process and dispose the runtime.

Run it

pnpm --dir examples/exec-js-dev-servers start

Source

View source on GitHub