This is a small API server that turns your local Antigravity launcher into a guarded remote session service.
It exposes:
POST /promptto runagy --printand return a single resultPOST /sessionsto start a sessionGET /sessionsto list sessionsGET /sessions/:idto inspect one sessionPOST /sessions/:id/inputto send text to the running CLIGET /sessions/:id/eventsto stream stdout/stderr/status over Server-Sent EventsPOST /sessions/:id/terminateto stop a session
The server does not expose your whole shell. It only spawns the configured launcher inside a workspace directory that must live under WORKSPACES_DIR.
- Copy
.env.exampleinto your shell environment. - Make sure
API_TOKENis set. - Start the server:
npm startThe server binds to 127.0.0.1 by default. Expose it remotely through Tailscale, Cloudflare Tunnel, or another access layer instead of binding it directly to the public network.
Single prompt:
curl -X POST http://localhost:8787/prompt \
-H "Authorization: Bearer replace-me" \
-H "Content-Type: application/json" \
-d '{"friendId":"alice","workspace":"alice","prompt":"Summarize the files in this workspace."}'Create a session:
curl -X POST http://localhost:8787/sessions \
-H "Authorization: Bearer replace-me" \
-H "Content-Type: application/json" \
-d '{"friendId":"alice","workspace":"alice"}'Stream session output:
curl -N http://localhost:8787/sessions/<session-id>/events \
-H "Authorization: Bearer replace-me"Send input:
curl -X POST http://localhost:8787/sessions/<session-id>/input \
-H "Authorization: Bearer replace-me" \
-H "Content-Type: application/json" \
-d '{"input":"hello from remote"}'Terminate:
curl -X POST http://localhost:8787/sessions/<session-id>/terminate \
-H "Authorization: Bearer replace-me"- By default the server runs the configured
ANTIGRAVITY_BINwith no extra args inside the selected workspace directory. POST /promptis the recommended path for remote code-assist style usage because it does not depend on interactive terminal behavior.- If your local install needs fixed startup arguments, set
ANTIGRAVITY_ARGS. PRINT_TIMEOUT_MScontrols the default timeout forPOST /prompt.USE_PTY=autoenablesnode-ptyon macOS, which is helpful for interactive CLIs such asagy.- If you really need the server to listen on another interface, set
HOST. - Put this behind Tailscale, Cloudflare Access, or another private access layer before exposing it to the internet.
- Use a separate macOS user if other people will drive sessions on your machine.