Self-host Letta on a Cube
Run Letta on a Krova Cube — the open-source stateful agent framework with advanced memory and self-improvement (formerly MemGPT).
Letta is an open-source framework for building stateful AI agents with advanced memory that can learn and self-improve over time. It was originally released as MemGPT by the same team and is now the canonical Letta project (Apache-2.0, about 24,700 stars on GitHub, verified 2026-09-13). A Cube is a good place to run the Letta App Server — you get a long-running control plane for agents that remember across machines, with no per-seat pricing.
The install is one npm command. The part worth reading carefully is Step 5 — the messaging gateway needs a public webhook URL, and a Cube has no public inbound of its own. The path is to point a domain at the Cube and let the Krova edge terminate TLS.
Before you start
Letta ships a Node.js CLI (@letta-ai/letta-code) plus the App Server (letta server), which is what runs the long-lived agents. The App Server talks to a Postgres database and an LLM provider of your choice. The agent layer is small; the heavy resource is the LLM.
- A Cube of 2 vCPU, 4 GB RAM, 40 GB disk — about $0.0140/hour, roughly $0.34/day or $10/month if left running. Comfortable for the App Server plus a small local model.
- If you want to run a capable local model (around 7B parameters), plan on 8 GB RAM and 8 GB of disk for the model weights alone, in addition to the agent. The Cube size for that is 4 vCPU, 16 GB RAM, 100 GB disk.
- An SSH key pair, as with any Cube.
- An API key from an AI provider — or a local Ollama install if you would rather skip the paid API.
Step 1 — Create the Cube
Create a Cube with the Ubuntu 24.04 + Node 22 image. The Letta CLI and App Server run on Node 18+, and starting from the Node image skips the apt-install step. If your Cube image picker does not have a Node image, plain Ubuntu 24.04 works — Letta's installer pulls the right runtime.
Size it at 2 vCPU / 4 GB / 40 GB if you are pointing Letta at a paid AI provider, or 4 vCPU / 16 GB / 100 GB if you want to run a local 7B model through Ollama on the same Cube.
Step 2 — Connect over SSH
ssh ubuntu@<cube-host> -p <port>Step 3 — Install the Letta CLI
The CLI installs globally with npm. It is the same package that launches both the terminal UI (letta) and the App Server (letta server).
sudo npm install -g @letta-ai/letta-codeConfirm the install:
letta --versionStep 4 — Start the App Server
The App Server is the long-lived process. Run it under tmux or screen so it survives your SSH session ending:
letta serverOn first start the server provisions its own SQLite database at ~/.letta/letta.db. For production use, swap that for Postgres — set LETTA_PG_URI in the environment to your database URL and restart the server. The App Server listens on http://0.0.0.0:8283 by default.
Step 5 — Give it a real address
The Letta web UI and the messaging gateway both need a URL that the outside world can reach. A Cube has no public inbound of its own — the path is to point a domain at the Cube and let the Krova edge terminate TLS, the same way the Dokploy guide describes.
- Add a DNS record for your domain pointing at
dns.krova.cloud(the Cube's networking tab has a copy button for it). - On the Cube's Networking tab, choose Add Domain:
- Domain — the hostname, e.g.
letta.example.com. - Port —
8283, the App Server's default port. - This app serves HTTPS itself — leave it unchecked. Letta serves over plain HTTP internally; Krova adds the TLS.
Once the domain reads Active, the Letta UI is at https://letta.example.com with no tunnel and no published port.
Step 6 — Pick the model backend
Letta's App Server is provider-agnostic. Point it at OpenAI, Anthropic, or any compatible API through environment variables on the server process — OPENAI_API_KEY, ANTHROPIC_API_KEY, or a base URL pointing at a local Ollama install on the same Cube:
curl -fsSL https://ollama.com/install.sh | sh
ollama pull llama3.1:8bThen set OPENAI_API_BASE=http://localhost:11434 on theletta server process. Everything from there is local — your agent's memory and the model weights never leave the Cube.
Step 7 — Wire up the messaging gateway
Letta ships channel adapters for Slack, Telegram, Discord and custom webhooks. Each one is configured in the Letta web UI once the App Server is reachable at https://letta.example.com. The official channel-setup docs live at docs.letta.com.
What it costs
The 2 vCPU / 4 GB / 40 GB Cube described here bills at about $0.0140/hour — roughly $0.34/day, or $10/month if left running. Usage is metered by the minute.
On top of that, either an AI provider bill (paid per message) or the local Ollama path. Ollama is free to run; the only cost is the larger Cube to fit the model weights in RAM. Letta Cloud offers paid hosted tiers at letta.com if you ever want to outsource the control plane — the self-hosted build on a Cube is free.
Cleaning up
Deleting the Cube removes the Letta App Server, every agent's memory, and any local model weights along with the disk. If the agent's persistent state matters, snapshot the Cube first — though for long-term memory, LETTA_PG_URI on an external Postgres is the safer path.
Next steps
- Self-host Open Interpreter on a Cube — the code-execution angle.
- Custom domains — required if you want the Letta UI at your own address.
- Cubes — resizing, snapshots, and how billing works when a Cube is stopped.
