Skip to content

Commit 402ba2b

Browse files
committed
refac
1 parent 48edd2d commit 402ba2b

4 files changed

Lines changed: 63 additions & 43 deletions

File tree

docs/features/open-terminal/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
2121

2222
Open WebUI gives you the agent front door: models, chats, knowledge, prompts, users, permissions, builtin tools, MCP connections, automations, and shared workflows. Open Terminal adds the missing computer substrate: a working environment with a filesystem, shell, package manager, running processes, document and data handling, generated artifacts, and live previews.
2323

24-
This is the difference between a chatbot with tools and an agentic AI workspace. The model can plan, create files, run code, inspect output, install dependencies, start servers, render previews, recover from errors, and continue until there is an artifact you can use: a script, report, patch, chart, website, migration, or organized folder.
24+
That means the agent can do real work. Not just answer questions about a task, and not just emit code you run somewhere else. It can plan, create files, run code, inspect output, install dependencies, start servers, render previews, recover from errors, and continue until there is an artifact you can use: a script, report, patch, chart, website, migration, or organized folder.
2525

2626
Despite the name, Open Terminal is not just a terminal panel. It is the computer-like workspace the agent acts inside. Run it in Docker for isolation, or bare metal when the agent should work directly on the host.
2727

@@ -43,7 +43,7 @@ Open Terminal is the computer substrate an **AI agent** drives from chat. If you
4343
| Feedback loop | Tool calls and chat state | Observe the workspace, change it, run it, inspect the result, fix, retry, verify |
4444
| Boundary | Open WebUI permissions and configuration | Docker sandbox or direct host access |
4545

46-
Open WebUI is the control plane. Open Terminal is the agent's computer substrate for work that needs an operating system, not just a prompt.
46+
Open WebUI is the control plane. Open Terminal is the agent's computer substrate for real work that needs an operating system, not just a prompt.
4747

4848
---
4949

@@ -65,7 +65,7 @@ Different teams describe this stack with different language. Open Terminal fits
6565
| **Orchestration** | The loop of choosing tools, sequencing steps, handling failures, and verifying results |
6666
| **Sandbox** | The isolation boundary around the agent's filesystem, processes, and network access |
6767

68-
The practical point is simple: models got good enough to use tools, but agents need a computer-shaped place to do work. Open Terminal gives Open WebUI that place.
68+
The practical point is simple: models got good enough to use tools, but agents need a computer-shaped place to do real work. Open Terminal gives Open WebUI that place.
6969

7070
---
7171

docs/features/open-terminal/terminals/index.mdx

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import Kubernetes from './tab-deployment/Kubernetes.md';
1111

1212
# Terminals (Orchestrator)
1313

14-
**Terminals** is an enterprise orchestration layer for [Open Terminal](/features/open-terminal) that provisions a fully isolated terminal container for every user. Instead of sharing a single container, each person gets their own, complete with separate files, processes, resource limits, and network isolation.
14+
**Terminals** is the enterprise orchestration layer for [Open Terminal](/features/open-terminal). It provisions a dedicated computer substrate for every Open WebUI user: separate files, processes, package environment, resource limits, network boundary, and optional persistent storage.
15+
16+
Open Terminal gives one chat an agent workspace where AI can do real work. Terminals turns that into managed fleet infrastructure, so every user or policy can get the right workspace without sharing state or hand-wiring containers.
1517

1618
:::tip Quick navigation
1719
- **Need to operate per-user terminal environments?**[Orchestration](/features/open-terminal/terminals/orchestration)
@@ -22,9 +24,9 @@ flowchart LR
2224
OW["Open WebUI"]
2325
OR["Orchestrator"]
2426
OW -->|X-User-Id| OR
25-
OR --> TA["Open Terminal<br/>User A"]
26-
OR --> TB["Open Terminal<br/>User B"]
27-
OR --> TC["Open Terminal<br/>User C"]
27+
OR --> TA["Agent workspace<br/>User A"]
28+
OR --> TB["Agent workspace<br/>User B"]
29+
OR --> TC["Agent workspace<br/>User C"]
2830
2931
style OW fill:#4a90d9,color:#fff
3032
style OR fill:#e67e22,color:#fff
@@ -35,17 +37,31 @@ flowchart LR
3537

3638
---
3739

38-
## How it works
40+
## How It Works
41+
42+
The orchestrator sits between Open WebUI and the per-user Open Terminal workspaces:
43+
44+
1. A user activates Open Terminal in Open WebUI.
45+
2. Open WebUI proxies the request to the **orchestrator**, which manages workspace lifecycle.
46+
3. The orchestrator resolves the selected policy: image, resources, storage, env vars, security context, and idle timeout.
47+
4. The orchestrator provisions or reuses a personal Open Terminal workspace for that user and policy.
48+
5. All traffic is proxied through the orchestrator. The user never connects to the workspace directly.
49+
6. Idle workspaces are cleaned up after a configurable timeout. Files can persist across sessions when storage is enabled.
50+
51+
The orchestrator exposes the same OpenAPI-based tool interface as Open Terminal, so the AI can work with files, run code, execute commands, start servers, and inspect results, all scoped to the requesting user's workspace.
3952

40-
The orchestrator sits between Open WebUI and the Open Terminal instances:
53+
## Why It Matters
4154

42-
1. A user activates a terminal in Open WebUI.
43-
2. Open WebUI proxies the request to the **orchestrator**, a service that manages the lifecycle of terminal containers.
44-
3. The orchestrator provisions a personal Open Terminal container for that user (or reconnects to an existing one).
45-
4. All traffic is proxied through the orchestrator. The user never connects to their container directly.
46-
5. Idle containers are automatically cleaned up after a configurable timeout. Data optionally persists across sessions.
55+
Terminals is what makes agent computer substrates operable for teams. It lets admins give agents enough environment to do real work while still controlling the boundary:
4756

48-
The orchestrator also exposes the same OpenAPI-based tool interface as Open Terminal, so the AI can execute commands, read files, and run code, all scoped to the requesting user's container.
57+
| Need | What Terminals provides |
58+
| :--- | :--- |
59+
| Isolation | One workspace per user and policy, with separate files and processes |
60+
| Governance | Policy-controlled images, env vars, resource limits, storage, and security context |
61+
| Repeatability | Custom images and startup packages so users get the right tools every time |
62+
| Lifecycle | Reuse, idle cleanup, refresh, and scheduled resets |
63+
| Scale | Docker for a single host, Kubernetes/operator mode for larger deployments |
64+
| Supportability | Admin UI, logs, status, policy APIs, and predictable routing |
4965

5066
:::info Admin UI (new in 0.0.4)
5167
The orchestrator serves a built-in minimal admin UI at `/` for viewing terminal status, active sessions, and policies. It is on by default and toggled with `TERMINALS_ENABLE_UI`; set it to `false` for API-only deployments.
@@ -88,7 +104,7 @@ When deployed via Docker Compose or Helm, the shared API key is configured autom
88104

89105
### Terminal won't start
90106

91-
1. **Check orchestrator logs.** The orchestrator logs the full provisioning flow, including image pull and container creation. Look for errors related to image availability or resource limits.
107+
1. **Check orchestrator logs.** The orchestrator logs the full provisioning flow, including image pull and workspace creation. Look for errors related to image availability, policy configuration, or resource limits.
92108
2. **Verify the API key.** Ensure `TERMINALS_API_KEY` matches between Open WebUI and the orchestrator. A mismatch causes silent auth failures.
93109
3. **Check image pull access.** If using a private container registry, make sure the orchestrator (Docker) or cluster (Kubernetes) has pull credentials configured.
94110

@@ -98,9 +114,9 @@ When deployed via Docker Compose or Helm, the shared API key is configured autom
98114
- If using **API key mode**, confirm the key is set identically on both sides. Check for extra whitespace or newlines.
99115
- Check the orchestrator logs for `401` or `403` responses.
100116

101-
### Container is reaped too quickly
117+
### Workspace is reaped too quickly
102118

103-
Increase `TERMINALS_IDLE_TIMEOUT_MINUTES` (or `idle_timeout_minutes` in a policy). The default is `0` (disabled), but if set too low, containers may be cleaned up while users are still working. A value of `30` is typical.
119+
Increase `TERMINALS_IDLE_TIMEOUT_MINUTES` (or `idle_timeout_minutes` in a policy). The default is `0` (disabled), but if set too low, workspaces may be cleaned up while users are still working. A value of `30` is typical.
104120

105121
### Connection refused
106122

docs/features/open-terminal/terminals/orchestration/index.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ title: "Orchestration"
55

66
# Orchestration
77

8-
The Terminals orchestrator gives each Open WebUI user a dedicated Open Terminal container. Open WebUI stores the connection, the orchestrator resolves policy, and Open Terminal runs inside the per-user container.
8+
The Terminals orchestrator gives each Open WebUI user a dedicated agent workspace backed by Open Terminal. Open WebUI stores the connection, the orchestrator resolves policy, and Open Terminal runs inside the per-user computer substrate where the agent can do real work.
9+
10+
Use this when Open Terminal needs to become managed team infrastructure: different users, groups, or workflows need different images, tools, limits, storage behavior, reset schedules, and security boundaries.
911

1012
```mermaid
1113
flowchart LR
1214
A["Open WebUI"] --> B["Terminals orchestrator"]
13-
B --> C["User A Open Terminal container"]
14-
B --> D["User B Open Terminal container"]
15-
B --> E["User C Open Terminal container"]
15+
B --> C["User A agent workspace"]
16+
B --> D["User B agent workspace"]
17+
B --> E["User C agent workspace"]
1618
```
1719

18-
When a user opens a terminal, Open WebUI routes through `/p/{policy_id}/...`. The orchestrator provisions or reuses that user's container for the selected policy.
20+
When a user opens Open Terminal, Open WebUI routes through `/p/{policy_id}/...`. The orchestrator provisions or reuses that user's workspace for the selected policy.
1921

2022
## Read This Section
2123

@@ -33,15 +35,15 @@ When a user opens a terminal, Open WebUI routes through `/p/{policy_id}/...`. Th
3335

3436
| Layer | Responsibility |
3537
| :--- | :--- |
36-
| Open WebUI | Stores the orchestrator connection, selects the policy, and presents the terminal and file browser UI |
37-
| Terminals orchestrator | Authenticates requests, resolves policies, provisions containers, forwards env vars, applies idle timeout, and handles refresh/lifecycle work |
38-
| Policy | Defines image, env, resources, storage, and idle timeout |
39-
| Policy lifecycle | Defines maintenance behavior over time, such as scheduled resets of persisted terminal files |
40-
| Open Terminal container | Executes commands, serves files, exposes OpenAPI tools, and reports file-browser root metadata |
38+
| Open WebUI | Stores the orchestrator connection, selects the policy, and presents chat, terminal, file browser, and preview UI |
39+
| Terminals orchestrator | Authenticates requests, resolves policies, provisions workspaces, forwards env vars, applies idle timeout, and handles refresh/lifecycle work |
40+
| Policy | Defines the workspace image, env, resources, storage, security context, and idle timeout |
41+
| Policy lifecycle | Defines maintenance behavior over time, such as scheduled resets of persisted workspace files |
42+
| Open Terminal workspace | Executes commands, serves files, exposes OpenAPI tools, runs code and servers, and reports file-browser root metadata |
4143

4244
## Orchestrator Environment Variables
4345

44-
These configure the orchestrator service itself, prefixed with `TERMINALS_` (or set in a `.env` file). They are distinct from the per-container `OPEN_TERMINAL_*` policy variables covered in [Environment Variables](/features/open-terminal/terminals/orchestration/environment-variables), which are forwarded into each user's container.
46+
These configure the orchestrator service itself, prefixed with `TERMINALS_` (or set in a `.env` file). They are distinct from the per-workspace `OPEN_TERMINAL_*` policy variables covered in [Environment Variables](/features/open-terminal/terminals/orchestration/environment-variables), which are forwarded into each user's Open Terminal workspace.
4547

4648
| Variable | Default | Description |
4749
| :--- | :--- | :--- |
@@ -53,17 +55,17 @@ These configure the orchestrator service itself, prefixed with `TERMINALS_` (or
5355
| `TERMINALS_ENABLE_UI` | `true` | Serve the built-in minimal admin UI at `/`. Set `false` for API-only deployments |
5456
| `TERMINALS_LOG_LEVEL` | `INFO` | Minimum log level: `DEBUG`, `INFO`, `WARNING`, `ERROR`, or `CRITICAL` |
5557
| `TERMINALS_DATABASE_URL` | `sqlite+aiosqlite:///<data>/terminals.db` | SQLAlchemy database URL. SQLite is the default; PostgreSQL is optional |
56-
| `TERMINALS_IMAGE` | `ghcr.io/open-webui/open-terminal:latest` | Default container image when a policy sets none |
57-
| `TERMINALS_NETWORK` | *(unset)* | Docker network for terminal containers. When set, containers are reached by name instead of published ports |
58+
| `TERMINALS_IMAGE` | `ghcr.io/open-webui/open-terminal:latest` | Default workspace image when a policy sets none |
59+
| `TERMINALS_NETWORK` | *(unset)* | Docker network for Open Terminal workspaces. When set, containers are reached by name instead of published ports |
5860
| `TERMINALS_DOCKER_HOST` | `127.0.0.1` | Address used to reach published container ports (Docker backend) |
59-
| `TERMINALS_DATA_DIR` | `<data>/terminals` | Host directory holding per-user persisted files (Docker backend) |
61+
| `TERMINALS_DATA_DIR` | `<data>/terminals` | Host directory holding per-user persisted workspace files (Docker backend) |
6062
| `TERMINALS_IDLE_TIMEOUT_MINUTES` | `0` | Tear down terminals after N minutes of inactivity (`0` = disabled) |
61-
| `TERMINALS_MAX_CPU` | *(unset)* | Hard cap on CPU per container that policies cannot exceed |
62-
| `TERMINALS_MAX_MEMORY` | *(unset)* | Hard cap on memory per container that policies cannot exceed |
63-
| `TERMINALS_MAX_STORAGE` | *(unset)* | Hard cap on storage per container that policies cannot exceed |
63+
| `TERMINALS_MAX_CPU` | *(unset)* | Hard cap on CPU per workspace that policies cannot exceed |
64+
| `TERMINALS_MAX_MEMORY` | *(unset)* | Hard cap on memory per workspace that policies cannot exceed |
65+
| `TERMINALS_MAX_STORAGE` | *(unset)* | Hard cap on storage per workspace that policies cannot exceed |
6466
| `TERMINALS_ALLOWED_IMAGES` | *(unset)* | Comma-separated list of allowed image patterns (globs). Empty allows any image |
6567
| `TERMINALS_KUBERNETES_NAMESPACE` | `terminals` | Namespace for terminal pods (Kubernetes backends) |
66-
| `TERMINALS_KUBERNETES_IMAGE` | `ghcr.io/open-webui/open-terminal:latest` | Default image for terminal pods (Kubernetes backends) |
68+
| `TERMINALS_KUBERNETES_IMAGE` | `ghcr.io/open-webui/open-terminal:latest` | Default image for Open Terminal pods (Kubernetes backends) |
6769
| `TERMINALS_KUBERNETES_STORAGE_CLASS` | *(unset)* | StorageClass for PVCs. Empty uses the cluster default |
6870
| `TERMINALS_KUBERNETES_STORAGE_SIZE` | `1Gi` | Default PVC size when a policy sets none |
6971
| `TERMINALS_KUBERNETES_STORAGE_MODE` | `per-user` | Storage mode: `per-user`, `shared`, or `shared-rwo` |
@@ -72,14 +74,14 @@ These configure the orchestrator service itself, prefixed with `TERMINALS_` (or
7274
| `TERMINALS_KUBERNETES_LABELS` | *(unset)* | Extra labels applied to created resources as `k=v,k2=v2` |
7375
| `TERMINALS_KUBERNETES_RESTRICTED` | `false` | Enable restricted Kubernetes/OpenShift pod defaults globally |
7476
| `TERMINALS_KUBERNETES_POD_SECURITY_CONTEXT` | `{}` | JSON pod security context merged into terminal pods |
75-
| `TERMINALS_KUBERNETES_CONTAINER_SECURITY_CONTEXT` | `{}` | JSON container security context merged into terminal containers |
77+
| `TERMINALS_KUBERNETES_CONTAINER_SECURITY_CONTEXT` | `{}` | JSON container security context merged into Open Terminal containers |
7678
| `TERMINALS_KUBERNETES_CRD_GROUP` | `openwebui.com` | CRD group watched by the operator backend |
7779
| `TERMINALS_KUBERNETES_CRD_VERSION` | `v1alpha1` | CRD version watched by the operator backend |
7880

7981
Any value omitted here falls back to the default shown. See [`config.py`](https://github.com/open-webui/terminals/blob/main/terminals/config.py) for the authoritative list.
8082

8183
## Important Behavior
8284

83-
Policy changes apply to newly provisioned terminals. Existing running terminals keep their current image and environment until they are stopped, refreshed, or cleaned up by idle timeout.
85+
Policy changes apply to newly provisioned workspaces. Existing running workspaces keep their current image and environment until they are stopped, refreshed, or cleaned up by idle timeout.
8486

8587
The visual file-browser boundary is for usability. Open Terminal reports a root path that clients can render as `Home` and use to hide parent folders, but it is not a security boundary.

docs/features/open-terminal/terminals/orchestration/policies.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,29 @@ title: "Policies"
55

66
# Policies
77

8-
A policy describes what a user's Open Terminal container should look like. It controls the image, resources, storage, environment variables, and idle timeout.
8+
A policy describes what a user's Open Terminal workspace should look like. It controls the image, tools, resources, storage, environment variables, security context, and idle timeout.
9+
10+
Think of policies as agent workspace profiles. A data team might get Python, notebooks, and larger storage. A training lab might get a locked-down image and scheduled resets. A software team might get Git, build tools, language runtimes, and persistent files.
911

1012
In Open WebUI, go to **Settings** -> **Admin** -> **Tools** -> **Integrations** -> Open Terminal**, add an orchestrator connection, verify it, then edit the policy fields.
1113

1214
## Policy Fields
1315

1416
| Policy field | Example | What it controls |
1517
| :--- | :--- | :--- |
16-
| `image` | `ghcr.io/acme/open-terminal:python` | Open Terminal image used for new containers |
18+
| `image` | `ghcr.io/acme/open-terminal:python` | Open Terminal image used for new workspaces |
1719
| `cpu_limit` | `2` or `500m` | CPU limit passed to Docker/Kubernetes |
1820
| `memory_limit` | `4Gi` | Memory limit passed to Docker/Kubernetes |
1921
| `storage` | `10Gi` | Persistent file storage on Kubernetes; Docker stores files under the orchestrator data dir. On Docker the cap is best-effort: it limits only the writable layer via `StorageOpt` and needs a quota-capable driver (overlay2 on XFS with `pquota`), and `/home/user` is bind-mounted and not quota-limited. Use a Kubernetes backend for hard storage caps |
2022
| `storage_mode` | `per-user` | Kubernetes storage mode: `per-user`, `shared`, or `shared-rwo` |
21-
| `env` | `OPENAI_API_KEY=sk-...` | Raw environment variables injected into the user container |
22-
| `idle_timeout_minutes` | `30` | Idle time before the terminal is stopped and removed |
23+
| `env` | `OPENAI_API_KEY=sk-...` | Raw environment variables injected into the user workspace |
24+
| `idle_timeout_minutes` | `30` | Idle time before the workspace is stopped and removed |
2325
| `restricted` | `true` | Run under a restricted security context (Kubernetes/OpenShift backends) |
2426
| `pod_security_context` | `{"fsGroup": 1000}` | Kubernetes pod `securityContext` overrides (Kubernetes/OpenShift backends) |
2527
| `container_security_context` | `{"runAsNonRoot": true}` | Kubernetes container `securityContext` overrides (Kubernetes/OpenShift backends) |
2628

2729
All fields are optional. If a field is omitted, the orchestrator uses its global default, such as `TERMINALS_IMAGE` or `TERMINALS_KUBERNETES_STORAGE_MODE`.
2830

29-
Policy changes apply when a terminal is newly provisioned. Existing running terminals keep their current image and environment until they are stopped, refreshed, or cleaned up by idle timeout. Open WebUI is an admin client for this policy state; Terminals remains the source of truth for both policy and lifecycle configuration.
31+
Policy changes apply when a workspace is newly provisioned. Existing running workspaces keep their current image and environment until they are stopped, refreshed, or cleaned up by idle timeout. Open WebUI is an admin client for this policy state; Terminals remains the source of truth for both policy and lifecycle configuration.
3032

3133
Scheduled resets are configured through policy lifecycle, not policy fields. This keeps provisioning settings separate from ongoing maintenance.

0 commit comments

Comments
 (0)