> ## Documentation Index
> Fetch the complete documentation index at: https://scaledfoundations-rebrand.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GRID CLI

This section provides detailed information on how to use the GRID Enterprise Command-Line Interface (CLI). The GRID CLI acts as an orchestration module for the GRID containers and sessions. Run it by typing `grid` at the terminal in the appropriate Python virtual environment.

## Commands Overview

Below is a list of the available commands in the GRID Enterprise CLI. Resource targeting is done using the `@resource_name` syntax, defaulting to `@local` if no resource is specified. In this document, we will assume that the GRID containers are running on the same machine as the CLI, which is the most straightforward setup.

The first step is to log into the GRID platform and initialize the containers. Open your terminal and run the following command:

```bash
grid
```

<Accordion title="Show Expected Output">
  ```text

   .d8888b.  8888888b.  8888888 8888888b.
  d88P  Y88b 888   Y88b   888   888  "Y88b
  888    888 888    888   888   888    888
  888        888   d88P   888   888    888
  888  88888 8888888P"    888   888    888
  888    888 888 T88b     888   888    888
  Y88b  d88P 888  T88b    888   888  .d88P
   "Y8888P88 888   T88b 8888888 8888888P"

  General Robot Intelligence Development Platform - Enterprise version
  Developed by General Robotics, Inc. (c) 2025

  Loading resource configuration from /home/grid/.grid/resource_config.json...
  Started container server on 0.0.0.0:8060
  Samples currently at /home/grid/.grid/samples
  Type 'help' or 'license' for more info.

  GRID #
  ```
</Accordion>

### **login**

Logs into the GRID container registry using the username and password from the resouece configuration.

```bash
login @local
```

<Accordion title="Show Expected Output">
  ```text
  GRID # login
  Logging in to General Robotics - GRID registry...Login successful!
  ```
</Accordion>

### **init**

Spins up the GRID containers on the specified node (defaults to `local` if no node is specified). Upon running this command, GRID will ask you for your choice of simulator. Currently supported options are AirGen and Isaac Sim.

```bash
init @local
```

<Accordion title="Show Expected Output">
  ```text
  GRID # init
  Please choose the simulator you wish to use:
  1: airgen
  2: isaac
  Enter your choice: 1
  Starting GRID containers for airgen on local...
  Spinning up containers with profile airgen...
  WARN[0000] The "OPENAI_API_KEY" variable is not set. Defaulting to a blank string.
  [+] Running 3/3
   ✔ Container grid_sim_airgen  Started1.2s
   ✔ Container grid_core        Started1.5s
   ✔ Container grid_server      Started1.6s
  Checking container statuses...
  grid_core: ✓
  grid_server: ✓
  grid_sim_airgen: ✓
  Containers are active.
  ```
</Accordion>

### **terminate**

Terminates the GRID containers on the specified node.

```bash
GRID # terminate
```

<Accordion title="Show Expected Output">
  ```text
  Stopping containers using docker-compose...
  WARN[0000] The "OPENAI_API_KEY" variable is not set. Defaulting to a blank string.
  [+] Running 3/3
   ✔ Container grid_sim_airgen  Removed12.2s
   ✔ Container grid_server      Removed12.2s
   ✔ Container grid_core        Removed10.2s
  Checking container statuses...
  grid_core: ❌
  grid_server: ❌
  grid_sim_airgen: ❌
  Containers stopped successfully.
  ```
</Accordion>

### **update**

Updates the GRID containers on the specified node. You must be authenticated to the container registry for this to work. If no simulator choice was already provided, this command will ask you for your preferred simulator choice.

```bash
update @local
```

<Accordion title="Show Expected Output">
  ```text
  Checking for container updates...
  Updating containers for profile airgen...
  [+] Pulling 3/3
   ✔ sim-airgen Pulled 0.2s
   ✔ core Pulled       0.2s
   ✔ server Pulled     0.2s
  Updating assets... Done.
  ```
</Accordion>

### **session start** `<session_id> <config_path> @<resource_name>`

Starts a session with the specified session ID and configuration path on the chosen resource (defaults to `@local` if no resource is specified). If no configuration file path is provided, GRID will use a sample configuration. Please ensure that you have initialized the GRID containers (for your preferred simulator) before starting a session.

```bash
session start test
```

<Accordion title="Show Expected Output">
  ```text
  No session configuration was passed. Using a sample configuration from ~/.grid/sample_session_config_airgen.json...
  2025-02-11 23:23:24,410 - INFO - Initializing session
  Downloading assets... 
  Done.
  2025-02-11 23:23:24,531 - INFO - HTTP Request: POST http://127.0.0.1:8000/start_session "HTTP/1.1 200 OK"
  response: Initializing session...
  response: Downloading content..
  response_end: Session has been started successfully
  Session started successfully.
  2025-02-11 23:23:35,328 - INFO - Session started successfully.
  ```
</Accordion>

### **session stop** `<session_id>`

Stops the session with the specified ID.

```bash
session stop test
```

<Accordion title="Show Expected Output">
  ```text
  grid> session stop test_session
  Stopping session test ...
  2025-02-11 23:24:08,690 - INFO - Terminating session
  2025-02-11 23:24:15,031 - INFO - HTTP Request: POST http://127.0.0.1:8000/terminate_session "HTTP/1.1 200 OK"
  Session stopped successfully.
  2025-02-11 23:24:15,031 - INFO - Session stopped successfully.
  ```
</Accordion>

### **session list**

Lists all ongoing sessions.

```bash
session list
```

<Accordion title="Show Expected Output">
  ```text
  2025-02-11 23:24:59,331 - INFO - HTTP Request: GET http://127.0.0.1:8000/is_idle "HTTP/1.1 200 OK"
  +--------------+-----------+----------------------------------+
  | Session ID   | Node IP   | Last Active Time                 |
  +==============+===========+==================================+
  | test         | 127.0.0.1 | 2025-02-11T23:24:32.991267+00:00 |
  +--------------+-----------+----------------------------------+
  ```
</Accordion>

### **open** nb | sim | viz `@<node_name>`

Opens the corresponding entity for the specified session:

* **nb**: Jupyter notebook
* **sim**: Simulation stream
* **viz**: Rerun visualization

```bash
open nb @local
open sim @local
open viz @local
```

<Accordion title="Show Expected Output">
  ```text
  Opening nb from node local in default browser at http://127.0.0.1:8890
  Opening sim from node local in default browser at http://127.0.0.1:3080
  Opening viz from node local in default browser at http://127.0.0.1:9090/?url=ws://127.0.0.1:9877
  ```
</Accordion>

### **help**

Displays a list of all available commands and their functions.

```bash
help
```

<Accordion title="Show Expected Output">
  ```text

  Documented commands (type help <topic>):
  ========================================
  EOF    exit  init     login  open     terminate
  clear  help  license  node   session  update
  ```
</Accordion>
