Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

25.3 KB
Raw Blame
{
  "swagger": "2.0",
  "info": {
    "description": "BoxLite Runner API",
    "title": "BoxLite Runner API",
    "contact": {},
    "version": "v0.0.0-dev"
  },
  "paths": {
    "/": {
      "get": {
        "description": "Health check",
        "produces": ["application/json"],
        "summary": "Health check",
        "operationId": "HealthCheck",
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/boxes": {
      "post": {
        "description": "Create a box",
        "produces": ["application/json"],
        "tags": ["box"],
        "summary": "Create a box",
        "operationId": "Create",
        "parameters": [
          {
            "description": "Create box",
            "name": "box",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/CreateBoxDTO"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "schema": {
              "$ref": "#/definitions/StartBoxResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "404": {
            "description": "Not Found",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "409": {
            "description": "Conflict",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/boxes/{boxId}": {
      "get": {
        "description": "Get box info",
        "produces": ["application/json"],
        "tags": ["box"],
        "summary": "Get box info",
        "operationId": "Info",
        "parameters": [
          {
            "type": "string",
            "description": "Box ID",
            "name": "boxId",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Box info",
            "schema": {
              "$ref": "#/definitions/BoxInfoResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "404": {
            "description": "Not Found",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "409": {
            "description": "Conflict",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/boxes/{boxId}/destroy": {
      "post": {
        "description": "Destroy box",
        "produces": ["application/json"],
        "tags": ["box"],
        "summary": "Destroy box",
        "operationId": "Destroy",
        "parameters": [
          {
            "type": "string",
            "description": "Box ID",
            "name": "boxId",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Box destroyed",
            "schema": {
              "type": "string"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "404": {
            "description": "Not Found",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "409": {
            "description": "Conflict",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/boxes/{boxId}/is-recoverable": {
      "post": {
        "description": "Check if the box's error reason indicates a recoverable error",
        "consumes": ["application/json"],
        "produces": ["application/json"],
        "tags": ["box"],
        "summary": "Check if box error is recoverable",
        "operationId": "IsRecoverable",
        "parameters": [
          {
            "type": "string",
            "description": "Box ID",
            "name": "boxId",
            "in": "path",
            "required": true
          },
          {
            "description": "Error reason to check",
            "name": "request",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/IsRecoverableDTO"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/IsRecoverableResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/boxes/{boxId}/network-settings": {
      "post": {
        "description": "Update box network settings",
        "produces": ["application/json"],
        "tags": ["box"],
        "summary": "Update box network settings",
        "operationId": "UpdateNetworkSettings",
        "parameters": [
          {
            "type": "string",
            "description": "Box ID",
            "name": "boxId",
            "in": "path",
            "required": true
          },
          {
            "description": "Update network settings",
            "name": "box",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UpdateNetworkSettingsDTO"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Network settings updated",
            "schema": {
              "type": "string"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "404": {
            "description": "Not Found",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "409": {
            "description": "Conflict",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/boxes/{boxId}/recover": {
      "post": {
        "description": "Recover box from error state using specified recovery type",
        "consumes": ["application/json"],
        "produces": ["application/json"],
        "tags": ["box"],
        "summary": "Recover box from error state",
        "operationId": "Recover",
        "parameters": [
          {
            "type": "string",
            "description": "Box ID",
            "name": "boxId",
            "in": "path",
            "required": true
          },
          {
            "description": "Recovery parameters",
            "name": "recovery",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/RecoverBoxDTO"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Box recovered",
            "schema": {
              "type": "string"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "404": {
            "description": "Not Found",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "409": {
            "description": "Conflict",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/boxes/{boxId}/start": {
      "post": {
        "description": "Start box",
        "produces": ["application/json"],
        "tags": ["box"],
        "summary": "Start box",
        "operationId": "Start",
        "parameters": [
          {
            "type": "string",
            "description": "Box ID",
            "name": "boxId",
            "in": "path",
            "required": true
          },
          {
            "description": "Metadata",
            "name": "metadata",
            "in": "body",
            "schema": {
              "type": "object"
            }
          },
          {
            "type": "string",
            "description": "Auth token",
            "name": "token",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Box started",
            "schema": {
              "$ref": "#/definitions/StartBoxResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "404": {
            "description": "Not Found",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "409": {
            "description": "Conflict",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/boxes/{boxId}/stop": {
      "post": {
        "description": "Stop box",
        "produces": ["application/json"],
        "tags": ["box"],
        "summary": "Stop box",
        "operationId": "Stop",
        "parameters": [
          {
            "type": "string",
            "description": "Box ID",
            "name": "boxId",
            "in": "path",
            "required": true
          },
          {
            "description": "Stop box",
            "name": "box",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/StopBoxDTO"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Box stopped",
            "schema": {
              "type": "string"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "404": {
            "description": "Not Found",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "409": {
            "description": "Conflict",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "$ref": "#/definitions/ErrorResponse"
            }
          }
        }
      }
    },
    "/info": {
      "get": {
        "description": "Runner info with system metrics",
        "produces": ["application/json"],
        "summary": "Runner info",
        "operationId": "RunnerInfo",
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/RunnerInfoResponseDTO"
            }
          }
        }
      }
    },
    "/v1/boxes/{boxId}/executions/{execId}/attach": {
      "get": {
        "tags": ["boxlite"],
        "summary": "Attach to an execution via WebSocket",
        "parameters": [
          {
            "type": "string",
            "description": "Box ID",
            "name": "boxId",
            "in": "path",
            "required": true
          },
          {
            "type": "string",
            "description": "Execution ID",
            "name": "execId",
            "in": "path",
            "required": true
          }
        ],
        "responses": {
          "101": {
            "description": "Switching Protocols"
          },
          "404": {
            "description": "execution not found",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "409": {
            "description": "already attached",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "definitions": {
    "BoxInfoResponse": {
      "type": "object",
      "properties": {
        "daemonVersion": {
          "type": "string"
        },
        "exitCode": {
          "description": "ExitCode is how the box's main command ended, present once the runtime\nrecorded it: its own code when it exited, or 128 + n when a signal ended\nit. Stopping a box signals that command, so a stop is recorded here too.\nAbsence, not 0, is what says \"not recorded\": 0 is the exit code of every\ncommand that succeeded, so a reader has to tell a missing field from a\nzero one.",
          "type": "integer"
        },
        "state": {
          "$ref": "#/definitions/enums.BoxState"
        }
      }
    },
    "CreateBoxDTO": {
      "type": "object",
      "required": ["id", "image", "osUser", "outboundEnabled"],
      "properties": {
        "authToken": {
          "type": "string"
        },
        "cmd": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "cpuQuota": {
          "description": "CPU allocation in cores (0.125–16), in increments of 0.001; omitted means 1.",
          "type": "number",
          "maximum": 16,
          "minimum": 0.125
        },
        "entrypoint": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "env": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "fromVolumeId": {
          "type": "string"
        },
        "gpuQuota": {
          "type": "integer",
          "minimum": 0
        },
        "id": {
          "type": "string"
        },
        "image": {
          "type": "string"
        },
        "memoryQuota": {
          "type": "number",
          "minimum": 0.125
        },
        "metadata": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "nestedVirtualization": {
          "description": "Requires explicit authorization on the Runner process; omitted means off.",
          "type": "boolean"
        },
        "organizationId": {
          "description": "Nullable for backward compatibility",
          "type": "string"
        },
        "osUser": {
          "type": "string"
        },
        "otelEndpoint": {
          "type": "string"
        },
        "outboundAllowNet": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "outboundEnabled": {
          "description": "Outbound network policy. outboundEnabled is required: a request without\nit is rejected rather than started with a guessed policy.",
          "type": "boolean"
        },
        "privileged": {
          "type": "boolean"
        },
        "regionId": {
          "type": "string"
        },
        "registry": {
          "$ref": "#/definitions/RegistryDTO"
        },
        "runAsUser": {
          "type": "string"
        },
        "secrets": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/dto.SecretDTO"
          }
        },
        "skipStart": {
          "type": "boolean"
        },
        "storageQuota": {
          "type": "integer",
          "minimum": 1
        },
        "volumes": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/dto.VolumeDTO"
          }
        },
        "workingDir": {
          "type": "string"
        }
      }
    },
    "ErrorResponse": {
      "description": "Error response",
      "type": "object",
      "required": ["message", "path", "statusCode", "timestamp"],
      "properties": {
        "code": {
          "type": "string",
          "example": "BAD_REQUEST"
        },
        "message": {
          "type": "string",
          "example": "Bad request"
        },
        "method": {
          "type": "string",
          "example": "GET"
        },
        "path": {
          "type": "string",
          "example": "/api/resource"
        },
        "statusCode": {
          "type": "integer",
          "example": 400
        },
        "timestamp": {
          "type": "string",
          "example": "2023-01-01T12:00:00Z"
        }
      }
    },
    "IsRecoverableDTO": {
      "type": "object",
      "required": ["errorReason"],
      "properties": {
        "errorReason": {
          "type": "string"
        }
      }
    },
    "IsRecoverableResponse": {
      "type": "object",
      "properties": {
        "recoverable": {
          "type": "boolean"
        }
      }
    },
    "RecoverBoxDTO": {
      "type": "object",
      "required": ["errorReason", "osUser", "outboundEnabled"],
      "properties": {
        "cpuQuota": {
          "description": "CPU allocation in cores (0.125–16), in increments of 0.001; omitted means 1.",
          "type": "number",
          "maximum": 16,
          "minimum": 0.125
        },
        "env": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "errorReason": {
          "type": "string"
        },
        "fromVolumeId": {
          "type": "string"
        },
        "gpuQuota": {
          "type": "integer",
          "minimum": 0
        },
        "memoryQuota": {
          "type": "number",
          "minimum": 0.125
        },
        "osUser": {
          "type": "string"
        },
        "outboundAllowNet": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "outboundEnabled": {
          "description": "Outbound network policy. outboundEnabled is required: a request without\nit is rejected rather than started with a guessed policy.",
          "type": "boolean"
        },
        "privileged": {
          "type": "boolean"
        },
        "secrets": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/dto.SecretDTO"
          }
        },
        "storageQuota": {
          "type": "integer",
          "minimum": 1
        },
        "volumes": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/dto.VolumeDTO"
          }
        }
      }
    },
    "RegistryDTO": {
      "type": "object",
      "required": ["url"],
      "properties": {
        "password": {
          "type": "string"
        },
        "project": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "username": {
          "type": "string"
        }
      }
    },
    "RunnerInfoResponseDTO": {
      "type": "object",
      "properties": {
        "appVersion": {
          "type": "string"
        },
        "metrics": {
          "$ref": "#/definitions/RunnerMetrics"
        },
        "nestedVirtualizationEnabled": {
          "type": "boolean"
        },
        "serviceHealth": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/RunnerServiceInfo"
          }
        },
        "supportsPrivileged": {
          "type": "boolean"
        }
      }
    },
    "RunnerMetrics": {
      "type": "object",
      "properties": {
        "currentAllocatedCpu": {
          "type": "number"
        },
        "currentAllocatedDiskGiB": {
          "type": "number"
        },
        "currentAllocatedMemoryGiB": {
          "type": "number"
        },
        "currentCpuLoadAverage": {
          "type": "number"
        },
        "currentCpuUsagePercentage": {
          "type": "number"
        },
        "currentDiskUsagePercentage": {
          "type": "number"
        },
        "currentMemoryUsagePercentage": {
          "type": "number"
        },
        "currentStartedBoxes": {
          "type": "integer"
        }
      }
    },
    "RunnerServiceInfo": {
      "type": "object",
      "required": ["healthy", "serviceName"],
      "properties": {
        "errorReason": {
          "type": "string"
        },
        "healthy": {
          "type": "boolean"
        },
        "serviceName": {
          "type": "string"
        }
      }
    },
    "StartBoxResponse": {
      "type": "object",
      "properties": {
        "daemonVersion": {
          "type": "string"
        }
      }
    },
    "StopBoxDTO": {
      "type": "object",
      "properties": {
        "force": {
          "type": "boolean"
        }
      }
    },
    "UpdateNetworkSettingsDTO": {
      "type": "object",
      "properties": {
        "networkLimitEgress": {
          "type": "boolean"
        },
        "outboundAllowNet": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "outboundEnabled": {
          "type": "boolean"
        }
      }
    },
    "dto.FilestoreRef": {
      "type": "object",
      "required": ["instance", "server", "export"],
      "properties": {
        "instance": {
          "type": "string"
        },
        "server": {
          "description": "NFS server address resolved by the API",
          "type": "string"
        },
        "export": {
          "description": "NFS export path on the server",
          "type": "string"
        }
      }
    },
    "dto.SecretDTO": {
      "type": "object",
      "required": ["headers", "name", "value"],
      "properties": {
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "hosts": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "name": {
          "type": "string"
        },
        "placeholder": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "dto.VolumeDTO": {
      "type": "object",
      "properties": {
        "filestore": {
          "$ref": "#/definitions/dto.FilestoreRef"
        },
        "mountPath": {
          "type": "string"
        },
        "subpath": {
          "type": "string"
        },
        "volumeId": {
          "type": "string"
        }
      }
    },
    "enums.BoxState": {
      "type": "string",
      "enum": [
        "creating",
        "restoring",
        "destroyed",
        "destroying",
        "started",
        "stopped",
        "starting",
        "stopping",
        "resizing",
        "error",
        "unknown"
      ],
      "x-enum-varnames": [
        "BoxStateCreating",
        "BoxStateRestoring",
        "BoxStateDestroyed",
        "BoxStateDestroying",
        "BoxStateStarted",
        "BoxStateStopped",
        "BoxStateStarting",
        "BoxStateStopping",
        "BoxStateResizing",
        "BoxStateError",
        "BoxStateUnknown"
      ]
    }
  },
  "securityDefinitions": {
    "Bearer": {
      "description": "Type \"Bearer\" followed by a space and an API token.",
      "type": "apiKey",
      "name": "Authorization",
      "in": "header"
    }
  },
  "security": [
    {
      "Bearer": []
    }
  ]
}