# Open Terminal

> A self-hosted shell that AI agents reach over a REST API

- Category: Agents & Automation / Code Sandboxes & Isolation
- Language: Python
- Licence: MIT
- Repository: https://github.com/open-webui/open-terminal
- Website: https://openterminal.sh/
- Canonical page: https://ai-tldr.dev/tools/open-terminal/

## In short

Open Terminal is a self-hosted shell that AI agents reach over a REST API. It sits in the Code Sandboxes & Isolation category of the Agents & Automation tools and is open-source, written in Python and licensed MIT. To get started: run it with Docker.

## Overview

Open Terminal is a lightweight, self-hosted terminal that gives AI agents and automation tools a dedicated environment to run commands, manage files, search and execute code — all through a simple REST API. The premise is that assistants are good at writing code but need somewhere to run it, and a remote shell behind an HTTP endpoint is a smaller, more portable answer than a full agent framework.

It runs two ways. Under Docker it is a sandbox: an isolated container that ships a full toolkit — Python, Node.js, git, build tools, data-science libraries, ffmpeg and more — so an agent gets a playground that never touches the host. On bare metal it installs with pip and runs anywhere Python runs, with commands executing directly against your real files, tools and environment; the README flags that as the explicitly unsandboxed choice, appropriate for local development and personal automation.

Four image variants trade size for capability. `latest` (~4 GB) is aimed at agent sandboxes and bundles Node.js, gcc, ffmpeg, LibreOffice, LaTeX and the Docker CLI, supports runtime package installs via `sudo`, and enables multi-user mode; `slim` (~430 MB, Debian) and `alpine` (~230 MB, musl) are hardened and minimal with git, curl and jq; `openshift` targets restricted non-root pod policies. All but the OpenShift image support an iptables egress firewall. Open Terminal comes from the Open WebUI project and is MIT-licensed.

## What it does

- REST API for running commands, managing files, searching and executing code — no SDK required, just HTTP
- Docker mode gives agents an isolated container preloaded with Python, Node.js, git, build tools, data-science libraries and ffmpeg
- Bare-metal mode installs with pip or runs via uvx, executing against your real environment for local automation
- Four image variants — latest, slim, alpine and openshift — spanning ~4 GB down to ~230 MB
- Runtime package installation from environment variables (OPEN_TERMINAL_PACKAGES, _PIP_PACKAGES, _NPM_PACKAGES) with no fork needed
- API-key authentication, an iptables egress firewall, multi-user mode, and optional Docker-socket access so agents can build and run containers

## Getting started

Docker is the recommended path because it sandboxes execution. One command brings the API up on port 8000.

1. Run it with Docker

   This starts the full `latest` image with a persistent volume for the working directory. If you omit the API key, one is generated — read it out of the container logs.

```bash
docker run -d --name open-terminal --restart unless-stopped \
  -p 8000:8000 -v open-terminal:/home/user \
  -e OPEN_TERMINAL_API_KEY=your-secret-key \
  ghcr.io/open-webui/open-terminal
```

2. Or pick a smaller image

   slim and alpine share a feature set and stay minimal (git, curl, jq). openshift targets restricted non-root pod policies.

```bash
docker run -d -p 8000:8000 -e OPEN_TERMINAL_API_KEY=secret ghcr.io/open-webui/open-terminal:slim
docker run -d -p 8000:8000 -e OPEN_TERMINAL_API_KEY=secret ghcr.io/open-webui/open-terminal:alpine
```

3. Or run it on bare metal

   Open Terminal is a standard Python package. Note the README's caution: on bare metal, commands run directly on your machine with your user's permissions.

```bash
# One-liner with uvx (no install needed)
uvx open-terminal run --host 0.0.0.0 --port 8000 --api-key your-secret-key

# Or install globally with pip
pip install open-terminal
open-terminal run --host 0.0.0.0 --port 8000 --api-key your-secret-key
```

4. Add tools without forking

   The latest image installs extra apt, pip and npm packages at container start from environment variables. Packages are reinstalled on every start, so long lists slow startup — build a custom image for heavy customization. slim and alpine do not support these variables.

```bash
docker run -d --name open-terminal -p 8000:8000 \
  -e OPEN_TERMINAL_PACKAGES="cowsay figlet" \
  -e OPEN_TERMINAL_PIP_PACKAGES="httpx polars" \
  -e OPEN_TERMINAL_NPM_PACKAGES="typescript tsx" \
  ghcr.io/open-webui/open-terminal
```

5. Let agents use Docker

   The image includes the Docker CLI, Compose and Buildx. Mount the host socket to let an agent build images and run containers.

```bash
docker run -d --name open-terminal -p 8000:8000 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v open-terminal:/home/user \
  ghcr.io/open-webui/open-terminal
```

## When to use it

- Give a coding agent somewhere safe to actually run the code it writes, isolated from your host machine
- Back an automation pipeline with a long-lived remote shell that any language can drive over HTTP
- Run a minimal alpine or slim container as a command-execution service in CI or at the edge
- Expose your real local environment to a personal assistant when the point is to act on your actual files and tools
