Agent API

The container agent is an HTTP server that is also used to keep the docker container alive, normally at the end of a Docker start script. These docs are for developers looking to write their own versions of the agent, or to understand how the stock agent works.

The agent has a few endpoints that are used by Stardust to interact with the container. The agent is expected to be running on port 6080.

General

GET /

This endpoint returns a test page to check if the agent is running.

GET /healthcheck

This endpoint returns an object with the message key if the agent is running. Used to check if the container is running.

Example response
{ "message": "Stardust Container Agent is running" }

GET /password

This endpoint returns the VNC password for the container as a string. Used in /api/session/[id] in Stardust.

await fetch(`http://${containerSession.ip}:6080/password`).then((res) =>
  res.text()
);

GET /screenshot

This endpoint returns a screenshot of the container's desktop as a PNG image.Used in /api/session/[id]/preview in Stardust.

Files

All are used in /api/session/[id]/files in Stardust.

GET /files/list

This endpoint returns a list of files in the container's ~/Downloads directory as an array of strings.

GET /files/download/:name

This endpoint returns the file in the container's ~/Downloads directory with the name :name.

PUT /files/upload/:name

This endpoint uploads a file to the container's ~/Uploads directory with the name :name. The file should be sent as a NodeJS.Buffer in the body of the request.

await fetch(`http://${ip}:6080/files/upload/${fileName}`, {
  method: "PUT",
  body: Buffer.from(buffer),
});

Last updated on

On this page

Edit on GitHub