### Installing from Source Guide
Source: https://docs.letta.com/guides/server/remote
Guide on how to install the application from source code. This covers the steps required for building and deploying from source.
```JSON
{\"slug\": \"guides/server/source\", \"depth\": 0, \"title\": \"Installing from Source\", \"hidden\": \"$undefined\", \"authed\": \"$undefined\", \"shallow\": \"$undefined\"}
```
--------------------------------
### Install letta-evals using uv
Source: https://docs.letta.com/guides/evals/getting-started/index
Installs the letta-evals Python package using uv. This is an alternative to pip for faster package installation.
```bash
uv pip install letta-evals
```
--------------------------------
### Install Letta SDK
Source: https://docs.letta.com/quickstart
Installs the Letta client library for Python and Node.js using package managers.
```sh
pip install letta-client
```
```sh
npm install @letta-ai/letta-client
```
--------------------------------
### Installing from Source Guide
Source: https://docs.letta.com/models/openai
This section provides a comprehensive guide on installing the LLM application directly from its source code. It covers prerequisites, build steps, and deployment.
```Markdown
guides/server/source
```
--------------------------------
### Install and Run Chroma (Python & Bash)
Source: https://www.trychroma.com/
This snippet shows how to install the ChromaDB client using pip and then run the Chroma server. It's a quick way to get started with Chroma locally.
```Python
pip install chromadb
```
```Bash
chroma run
```
--------------------------------
### Run Python Setup Script
Source: https://docs.letta.com/tutorials/rag-simple/index
This command executes a Python setup script. The specific script `setup.py` is not provided in the text, but it's indicated as a way to run the setup process. Ensure Python and any necessary dependencies are installed.
```bash
python setup.py
```
--------------------------------
### Install Letta SDK
Source: https://docs.letta.com/quickstart
Installs the Letta SDK for Python using pip and for Node.js using npm. These commands are essential for interacting with the Letta API from your development environment.
```sh
pip install letta-client
```
```sh
npm install @letta-ai/letta-client
```
--------------------------------
### Install Letta SDK for Python
Source: https://docs.letta.com/quickstart
Installs the Letta client library for Python using pip. This is a prerequisite for interacting with Letta services via the Python SDK.
```python
pip install letta-client
```
--------------------------------
### Install Letta Code SDK using npm
Source: https://docs.letta.com/letta-code-sdk/quickstart/index
Installs the Letta Code SDK package using npm. This is the first step to using the SDK in your Node.js project.
```bash
npm install @letta-ai/letta-code-sdk
```
--------------------------------
### List Steps
Source: https://docs.letta.com/quickstart
Retrieve a list of all available steps. This is a GET request.
```HTTP
GET /api-ref
```
--------------------------------
### Install letta-evals using pip
Source: https://docs.letta.com/guides/evals/getting-started/index
Installs the letta-evals Python package using pip. This is a prerequisite for running Letta agent evaluations.
```bash
pip install letta-evals
```
--------------------------------
### Database Configuration Guide
Source: https://docs.letta.com/guides/server/remote
Guide for configuring the database for self-hosting. This covers essential database setup steps for the application.
```JSON
{\"slug\": \"guides/selfhosting/postgres\", \"depth\": 0, \"title\": \"Database Configuration\", \"hidden\": \"$undefined\", \"authed\": \"$undefined\", \"shallow\": \"$undefined\"}
```
--------------------------------
### List Projects (GET)
Source: https://docs.letta.com/quickstart
Fetches a list of all available projects. This is a cloud-only operation.
```HTTP
GET /api-reference/projects/list
```
--------------------------------
### List Providers
Source: https://docs.letta.com/install
Retrieves a list of available providers. This is a GET request.
```HTTP
GET /api-reference/providers/list
```
--------------------------------
### List Jobs
Source: https://docs.letta.com/install
Retrieves a list of all jobs. This is a GET request.
```HTTP
GET /api-reference/jobs/list
```
--------------------------------
### React Component for ADE Setup Guide Link
Source: https://docs.letta.com/quickstart
This snippet renders a link to the ADE setup guide. It uses React's JSX syntax and includes an arrow icon for navigation.
```jsx
n.p,{\n children: (0,e.jsx)(n.a,{\n href: \"/guides/ade/setup\",\n children: \"Read our ADE setup guide \\\u2192\"\n })\n })
```
--------------------------------
### Install Letta Desktop
Source: https://docs.letta.com/install
This section details the process of installing Letta Desktop on various operating systems. It serves as a primary guide for users to get the application running on their machine.
```mdx
import { MDXContent } from "mdx/components";
{/* Content related to installation */}
```
--------------------------------
### Project Directory Setup (Bash)
Source: https://docs.letta.com/tutorials/integrations/supabase/index
Creates the necessary directories for the server and client components of the application. This structure helps organize the backend logic and frontend user interface separately.
```bash
mkdir letta-supabase-app
cd letta-supabase-app
mkdir -p server/{config,routes,services}
mkdir -p client/{components,services}
```
--------------------------------
### Install Chroma
Source: https://www.trychroma.com/
Get started with Chroma by installing it using pip. This command is the first step to integrating Chroma into your workflow for prototyping, iterating, and deploying applications.
```python
pip install chromadb
```
--------------------------------
### TypeScript SDK Example
Source: https://docs.letta.com/llms-full.txt
A basic example script demonstrating the usage of the Letta TypeScript SDK. This snippet is intended to help developers get started with integrating Letta's capabilities into their TypeScript projects.
```TypeScript
import { Letta } from "@lettaai/letta";
async function main() {
const letta = new Letta({
apiKey: "YOUR_API_KEY",
});
const agent = letta.agent({
name: "My Agent",
// ... other agent configurations
});
const response = await agent.chat("Hello, Letta!");
console.log(response);
}
main();
```
--------------------------------
### Setup ngrok for Self-hosted Letta
Source: https://docs.letta.com/llms-full.txt
These shell commands guide the setup of ngrok to expose a locally hosted Letta server. It includes adding an auth token and starting the ngrok HTTP tunnel to a specified local address.
```sh
ngrok config add-authtoken
ngrok http http://localhost:8283
```
--------------------------------
### Interact with Letta Code Agent
Source: https://docs.letta.com/letta-code/quickstart/index
Demonstrates various commands and prompts to interact with the Letta Code agent, named 'Memo' by default. These examples show how to initialize the agent, query its knowledge, create user profiles, ask for project suggestions, customize its personality, and update its memory.
```bash
> /init
```
```bash
> What do you know about me so far?
```
```bash
> Create a user profile on my by looking at my downloads folder
```
```bash
> What active projects am I working on? Which one do you think you could help with?
```
```bash
> Re-tool your memory to be just like the AI from the movie Her, operate as my AI OS companion
```
```bash
> /remember that I always use bun in my node projects, never npm
```
```bash
> /agents
```
--------------------------------
### List Identities (GET)
Source: https://docs.letta.com/install
Retrieves a list of all identities. This endpoint uses the GET method.
```HTTP
GET /api/v1/identities
```
--------------------------------
### List Steps API
Source: https://docs.letta.com/install
Retrieves a list of all available steps. This endpoint is used to fetch a collection of step resources.
```HTTP
GET /api-reference/steps/list
```
--------------------------------
### Retrieve Identity (GET)
Source: https://docs.letta.com/install
Fetches a specific identity by its identifier. This endpoint uses the GET method.
```HTTP
GET /api/v1/identities/{identity_id}
```
--------------------------------
### Count Identities (GET)
Source: https://docs.letta.com/install
Returns the total count of identities. This endpoint uses the GET method.
```HTTP
GET /api/v1/identities/count
```
--------------------------------
### Get Folders Metadata
Source: https://docs.letta.com/install
Fetches metadata for all folders. This GET endpoint is part of the folders API.
```HTTP
GET /api-reference/folders/get-folders-metadata
```
--------------------------------
### Python SDK Setup for Letta
Source: https://docs.letta.com/prompts
Demonstrates how to initialize the Letta Python SDK for both Letta Cloud and self-hosted instances. It also shows the initial step of creating an agent with memory blocks.
```Python
from letta_client import Letta
# Letta Cloud
client = Letta(token="LETTA_API_KEY")
# Self-hosted
client = Letta(base_url="http://localhost:8283")
# Create agent with memory blocks
agent = client.agents.create(
memory_blocks=[
{
"label": "human",
"value": "The user's name is Sarah. She likes coding and AI."
},
{
```
--------------------------------
### Create Tool
Source: https://docs.letta.com/install
Adds a new tool to the system. This operation uses the POST method.
```http
POST /api-reference/tools/create
```
--------------------------------
### Clone and Install Project Dependencies
Source: https://docs.letta.com/tutorials/discord-bot/index
This snippet clones the example Discord bot repository and installs its Node.js dependencies using npm. It requires Git and Node.js with npm to be installed.
```bash
git clone https://github.com/letta-ai/letta-discord-bot-example.git
cd letta-discord-bot-example
npm install
```
--------------------------------
### Create Provider
Source: https://docs.letta.com/install
Creates a new provider. This is a POST request.
```HTTP
POST /api-reference/providers/create
```
--------------------------------
### Get Agents For Folder
Source: https://docs.letta.com/install
Retrieves agents associated with a specific folder. This GET endpoint is part of the folders API.
```HTTP
GET /api-reference/folders/get-agents-for-folder
```
--------------------------------
### Chroma Quick Start (Python & JavaScript)
Source: https://www.trychroma.com/
This snippet provides links to the quick start guides for Chroma, available in both Python and JavaScript. It's the primary entry point for new users to begin using Chroma.
```text
Quick start (Python & JavaScript)
```
--------------------------------
### Get Template Snapshot API (Cloud-only)
Source: https://docs.letta.com/quickstart
Retrieves a snapshot of a template using a GET request. This is a Cloud-only operation.
```HTTP
GET /api-reference/templates/gettemplatesnapshot
```
--------------------------------
### Get Folder Id By Name
Source: https://docs.letta.com/install
Retrieves the ID of a folder using its name. This GET endpoint is part of the folders API.
```HTTP
GET /api-reference/folders/retrieve-by-name
```
--------------------------------
### Initialize Letta and ChromaDB Clients (Python)
Source: https://docs.letta.com/tutorials/rag-simple/index
Initializes the Letta client using an API key from environment variables and the ChromaDB client with tenant, database, and API key also from environment variables. These clients are essential for interacting with the respective services.
```python
import os
import chromadb
from letta_client import Letta
letta_client = Letta(api_key=os.getenv("LETTA_API_KEY"))
chroma_client = chromadb.CloudClient(
tenant=os.getenv("CHROMA_TENANT"),
database=os.getenv("CHROMA_DATABASE"),
api_key=os.getenv("CHROMA_API_KEY")
)
```
--------------------------------
### Run TypeScript Setup Script
Source: https://docs.letta.com/tutorials/rag-simple/index
This command executes the TypeScript setup script using `npx tsx`. Ensure you have Node.js and tsx installed. This script is responsible for setting up the vector database and ingesting data.
```bash
npx tsx setup.ts
```
--------------------------------
### Install and Use Letta Python SDK
Source: https://docs.letta.com/llms-full.txt
Installs the Letta Python client and provides examples for connecting to a local server or Letta Cloud. It highlights the deprecation of legacy clients and recommends using the new 'letta-client'.
```bash
pip install letta-client
```
```python
from letta_client import Letta
# connect to a local server
client = Letta(base_url="http://localhost:8283")
# connect to Letta Cloud
client = Letta(
token="LETTA_API_KEY",
project="default-project",
)
```
--------------------------------
### Example init event output in bidirectional mode
Source: https://docs.letta.com/letta-code/headless/index
An example of the system initialization event emitted by 'letta' when starting in bidirectional mode. This event contains session and agent metadata.
```json
{"type": "system", "subtype": "init", "agent_id": "agent-xxx", "conversation_id": "conversation-xxx", "session_id": "agent-xxx", "model": "...", "tools": [...]}
```
--------------------------------
### System Prompts
Source: https://docs.letta.com/letta-code-sdk/quickstart/index
Configure system prompts at agent creation or session time using custom strings or predefined presets.
```APIDOC
## System Prompts
### Description
System prompts can be configured at agent creation time, or updated later when creating/resuming a session. Updates to `model` or `systemPrompt` via `createSession` / `resumeSession` persist and update the agent in Letta Code.
### Method
N/A (Configuration for `createAgent`, `createSession`, or `resumeSession`)
### Parameters
#### `createAgent` Options
- **systemPrompt** (string | object) - Optional - Custom system prompt string or a preset object.
- If string: A custom prompt.
- If object: `{ type: "preset", preset: string, append?: string }`
- **type** (string) - Must be "preset".
- **preset** (string) - The name of the preset (e.g., "letta-claude").
- **append** (string) - Optional text to append to the preset prompt.
#### `createSession` / `resumeSession` Options
- **systemPrompt** (string) - Optional - A preset name (e.g., "letta-claude"). Custom strings and append are not supported at session time.
### Request Example
```typescript
// At agent creation (custom string)
const agentId = await createAgent({
systemPrompt: "You are a Python expert. Always use type hints.",
});
// At agent creation (preset with append)
const agentId2 = await createAgent({
systemPrompt: {
type: "preset",
preset: "letta-claude",
append: "Always respond in Spanish.",
},
});
// At session time (preset only)
await using session = resumeSession(agentId, {
systemPrompt: "letta-claude",
});
```
### Available Presets
- `letta-claude` / `default` - Full coding assistant with memory
- `letta-codex` - Optimized for OpenAI Codex models
- `letta-gemini` - Optimized for Google Gemini models
- `claude`, `codex`, `gemini` - Minimal prompts without Letta features
```
--------------------------------
### Get Template Snapshot API (Cloud-only)
Source: https://docs.letta.com/install
Retrieves a snapshot of a template. This endpoint is part of the templates subpackage and uses the GET method. It is specific to cloud environments.
```HTTP
GET /api-reference/templates/gettemplatesnapshot
```
--------------------------------
### Install and Initialize Letta Client (Node.js)
Source: https://docs.letta.com/guides/docker
Installs the Letta client using npm and initializes it with a base URL and API key. This client is used to interact with the Letta AI service from a Node.js environment.
```javascript
// install letta-client with `npm install @letta-ai/letta-client`
import Letta from "@letta-ai/letta-client";
// create the client with the token set to your password
const client = new Letta({
baseURL: "http://localhost:8283",
apiKey: "yourpassword",
});
```
--------------------------------
### List Projects using Letta Client
Source: https://raw.githubusercontent.com/letta-ai/letta-python/refs/heads/main/reference
Lists all available projects using the Letta client. Requires project and token for initialization.
```python
from letta_client import Letta
client = Letta(
project="YOUR_PROJECT",
token="YOUR_TOKEN",
)
client.projects.list()
```
--------------------------------
### Install Letta from Source
Source: https://docs.letta.com/llms-full.txt
Installs the 'letta' package from source using uv. This involves navigating to the 'letta' directory and running the 'uv sync --all-extras' command.
```sh
cd letta
uv sync --all-extras
```
--------------------------------
### Launch Letta Code and Authenticate
Source: https://docs.letta.com/letta-code/quickstart/index
Launches the Letta Code application and initiates the authentication process. The first time it's run, it prompts the user to log in via a browser. Subsequent runs may not require re-authentication. The `/logout` command can be used to clear credentials.
```bash
letta
# You'll see a message saying "Let's get you authenticated"
# Hit "enter" to open a browser window
```