Deploy Letta

Letta App Server: stateful AI agents with long-term memory and a token API

Deploy Letta

Just deployed

/root/.letta

Deploy and Host Letta on Railway

Letta (formerly MemGPT) builds stateful AI agents that keep long-term memory and improve with use. This template runs the Letta App Server from Letta Code, the current open-source Letta harness. Your agents, their memory and their conversations stay on your own Railway volume, and your apps reach them over an authenticated API.

About Hosting Letta

Hosting Letta means running one always-on App Server, keeping its state on persistent storage and protecting it, because agents can run shell commands and edit files on the server. This template runs the official letta/letta image, pinned to 0.34.51 by digest, with the local backend, so no Letta Cloud account or database is needed. A volume at /root/.letta keeps agents, memory, provider settings and the agents' workspace across redeploys. Every API and WebSocket request needs the generated LETTA_APP_SERVER_TOKEN. Add at least one model provider key (OpenAI, Anthropic, Gemini or OpenRouter) before you chat with an agent. Railway serves it over HTTPS and checks /readyz.

Common Use Cases

  • Give your own app or backend persistent agents through the Letta Agent SDK's remote backend
  • Use Letta agents as "models" from OpenAI-compatible clients such as Open WebUI, LibreChat or the OpenAI SDKs
  • Run an always-on personal or team assistant whose memory lives on infrastructure you control

Dependencies for Letta Hosting

  • A Railway volume for agent state at /root/.letta (included)
  • An API key for at least one model provider (OpenAI, Anthropic, Google Gemini or OpenRouter)

Deployment Dependencies

Implementation Details

After the deploy, copy LETTA_APP_SERVER_TOKEN from the service's Variables tab and use your Railway domain.

Connect with the Letta Agent SDK (npm install @letta-ai/letta-agent-sdk):

import { LettaAgentClient } from "@letta-ai/letta-agent-sdk";

const client = new LettaAgentClient({
  backend: "remote",
  url: "https://YOUR-APP.up.railway.app",
  authToken: process.env.LETTA_APP_SERVER_TOKEN,
});

Or use the OpenAI-compatible API. Each Letta agent is listed as a model:

curl https://YOUR-APP.up.railway.app/v1/models \
  -H "Authorization: Bearer $LETTA_APP_SERVER_TOKEN"

Requests without the token get 401. Set a provider key (OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY or OPENROUTER_API_KEY) and redeploy; the start command registers it with Letta on every boot. You can create agents before adding a key, but they can't answer until a provider is connected. The App Server has shell and file access inside its container, so keep the token in your backend and never ship it to a browser. Agents created here are self-hosted: they don't appear in chat.letta.com, and Letta doesn't back them up, so back up the volume if you need to.

This template replaces the retired Python Letta server (V1 API with Postgres). Its data can't be loaded into the App Server.

Why Deploy Letta on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Letta on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
117
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

bento
1