Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

docs: clarify that ClickHouse is optional for telemetry (#5572)

Cameron Pfiffer3e0aae08dbda
diff --git a/fern/pages/deployment/telemetry.mdx b/fern/pages/deployment/telemetry.mdx
new file mode 100644
index 000000000..7001f3d0f
--- /dev/null
+++ b/fern/pages/deployment/telemetry.mdx
@@ -0,0 +1,54 @@
+---
+title: Collecting Traces & Telemetry
+slug: guides/server/otel
+---
+
+<Note>
+**ClickHouse is optional** and only required for telemetry/observability features. Letta works perfectly fine without it using just PostgreSQL. You only need ClickHouse if you want to collect traces, view LLM provider requests, or analyze system performance metrics.
+</Note>
+
+Letta uses [ClickHouse](https://clickhouse.com/) to store telemetry. ClickHouse is a database optimized for storing logs and traces. Traces can be used to view raw requests to LLM providers and also understand your agent's system performance metrics.
+
+## Configuring ClickHouse
+You will need to have a ClickHouse DB (either running locally or with [ClickHouse Cloud](https://console.clickhouse.cloud/)) to connect to Letta.
+
+You can configure ClickHouse by passing the required enviornment variables:
+```sh
+docker run \
+ -v ~/.letta/.persist/pgdata:/var/lib/postgresql/data \
+ -p 8283:8283 \
+ ...
+ -e CLICKHOUSE_ENDPOINT=${CLICKHOUSE_ENDPOINT} \
+ -e CLICKHOUSE_DATABASE=${CLICKHOUSE_DATABASE} \
+ -e CLICKHOUSE_USERNAME=${CLICKHOUSE_USERNAME} \
+ -e CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD} \
+ -e LETTA_OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 \
+ letta/letta:latest
+```
+
+### Finding your credentials in ClickHouse Cloud
+You can find these variable inside of ClickHouse Cloud by selecting the "Connection" button in the dashboard.
+
+<img src="/images/clickhouse_config.png" />
+
+## Connecting to Grafana
+We recommend connecting ClickHouse to Grafana to query and view traces. Grafana can be run [locally](https://grafana.com/oss/grafana/), or via [Grafana Cloud](https://grafana.com/grafana/).
+
+
+# Other Integrations
+
+Letta also supports other exporters when running in a containerized environment. To request support for another exporter, please open an issue on [GitHub](https://github.com/letta-ai/letta/issues/new/choose).
+
+## Configuring Signoz
+
+You can configure Signoz by passing the required enviornment variables:
+```sh
+docker run \
+ -v ~/.letta/.persist/pgdata:/var/lib/postgresql/data \
+ -p 8283:8283 \
+ ...
+ -e SIGNOZ_ENDPOINT=${SIGNOZ_ENDPOINT} \
+ -e SIGNOZ_INGESTION_KEY=${SIGNOZ_INGESTION_KEY} \
+ -e LETTA_OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 \
+ letta/letta:latest
+```
diff --git a/fern/pages/selfhosting/overview.mdx b/fern/pages/selfhosting/overview.mdx
new file mode 100644
index 000000000..edf460f17
--- /dev/null
+++ b/fern/pages/selfhosting/overview.mdx
@@ -0,0 +1,155 @@
+---
+title: Self-hosting Letta
+subtitle: Learn how to run your own Letta server
+slug: guides/selfhosting
+---
+
+<Note>
+The recommended way to use Letta locally is with Docker.
+To install Docker, see [Docker's installation guide](https://docs.docker.com/get-docker/).
+For issues with installing Docker, see [Docker's troubleshooting guide](https://docs.docker.com/desktop/troubleshoot-and-support/troubleshoot/).
+You can also install Letta using `pip`.
+</Note>
+
+## Running the Letta Server
+You can run a Letta server with Docker (recommended) or pip.
+<AccordionGroup>
+ <Accordion icon="docker" title="Running with Docker (recommended)" defaultOpen="true">
+ To run the server with Docker, run the command:
+```sh
+# replace `~/.letta/.persist/pgdata` with wherever you want to store your agent data
+docker run \
+ -v ~/.letta/.persist/pgdata:/var/lib/postgresql/data \
+ -p 8283:8283 \
+ -e OPENAI_API_KEY="your_openai_api_key" \
+ letta/letta:latest
+```
+This will run the Letta server with the OpenAI provider enabled, and store all data in the folder `~/.letta/.persist/pgdata`.
+
+If you have many different LLM API keys, you can also set up a `.env` file instead and pass that to `docker run`:
+```sh
+# using a .env file instead of passing environment variables
+docker run \
+ -v ~/.letta/.persist/pgdata:/var/lib/postgresql/data \
+ -p 8283:8283 \
+ --env-file .env \
+ letta/letta:latest
+```
+
+ </Accordion>
+ <Accordion icon="file-code" title="Running with pip">
+ You can install the Letta server via `pip` under the `letta` package:
+ ```sh
+ pip install -U letta
+ ```
+
+ To run the server once installed, simply run the `letta server` command:
+ To add LLM API providers, make sure that the environment variables are present in your environment.
+ ```sh
+ export OPENAI_API_KEY=...
+ letta server
+ ```
+
+ Note that the `letta` package only installs the server - if you would like to use the Python SDK (to create and interact with agents on the server in your Python code), then you will also need to install `letta-client` package (see the [quickstart](/quickstart) for an example).
+ </Accordion>
+</AccordionGroup>
+
+Once the Letta server is running, you can access it via port `8283` (e.g. sending REST API requests to `http://localhost:8283/v1`). You can also connect your server to the [Letta ADE](/guides/ade) to access and manage your agents in a web interface.
+
+## Enabling model providers
+The Letta server can be connected to various LLM API backends ([OpenAI](https://docs.letta.com/models/openai), [Anthropic](https://docs.letta.com/models/anthropic), [vLLM](https://docs.letta.com/models/vllm), [Ollama](https://docs.letta.com/models/ollama), etc.). To enable access to these LLM API providers, set the appropriate environment variables when you use `docker run`:
+```sh
+# replace `~/.letta/.persist/pgdata` with wherever you want to store your agent data
+docker run \
+ -v ~/.letta/.persist/pgdata:/var/lib/postgresql/data \
+ -p 8283:8283 \
+ -e OPENAI_API_KEY="your_openai_api_key" \
+ -e ANTHROPIC_API_KEY="your_anthropic_api_key" \
+ -e OLLAMA_BASE_URL="http://host.docker.internal:11434" \
+ letta/letta:latest
+```
+
+<Note>
+**Linux users:** Use `--network host` and `localhost` instead of `host.docker.internal`:
+```sh
+docker run \
+ -v ~/.letta/.persist/pgdata:/var/lib/postgresql/data \
+ --network host \
+ -e OPENAI_API_KEY="your_openai_api_key" \
+ -e ANTHROPIC_API_KEY="your_anthropic_api_key" \
+ -e OLLAMA_BASE_URL="http://localhost:11434" \
+ letta/letta:latest
+```
+</Note>
+
+The example above will make all compatible models running on OpenAI, Anthropic, and Ollama available to your Letta server.
+
+
+## Optional: Telemetry with ClickHouse
+
+Letta supports optional telemetry using ClickHouse. Telemetry provides observability features like traces, LLM request logging, and performance metrics. See the [telemetry guide](/guides/server/otel) for setup instructions.
+
+
+## Password protection
+
+<Warning>
+When running a self-hosted Letta server in a production environment (i.e. with untrusted users), make sure to enable both password protection (to prevent unauthorized access to your server over the network) and tool sandboxing (to prevent malicious tools from executing in a privledged environment).
+</Warning>
+
+To password protect your server, include `SECURE=true` and `LETTA_SERVER_PASSWORD=yourpassword` in your `docker run` command:
+```sh
+# If LETTA_SERVER_PASSWORD isn't set, the server will autogenerate a password
+docker run \
+ -v ~/.letta/.persist/pgdata:/var/lib/postgresql/data \
+ -p 8283:8283 \
+ --env-file .env \
+ -e SECURE=true \
+ -e LETTA_SERVER_PASSWORD=yourpassword \
+ letta/letta:latest
+```
+
+With password protection enabled, you will have to provide your password in the bearer token header in your API requests:
+<CodeGroup>
+```typescript TypeScript maxLines=50
+// install letta-client with `npm install @letta-ai/letta-client`
+import { LettaClient } from '@letta-ai/letta-client'
+
+// create the client with the token set to your password
+const client = new LettaClient({
+ baseUrl: "http://localhost:8283",
+ token: "yourpassword"
+});
+```
+```python title="python" maxLines=50
+# install letta_client with `pip install letta-client`
+from letta_client import Letta
+
+# create the client with the token set to your password
+client = Letta(
+ base_url="http://localhost:8283",
+ token="yourpassword"
+)
+```
+```curl curl
+curl --request POST \
+ --url http://localhost:8283/v1/agents/$AGENT_ID/messages \
+ --header 'Content-Type: application/json' \
+ --header 'Authorization: Bearer yourpassword' \
+ --data '{
+ "messages": [
+ {
+ "role": "user",
+ "text": "hows it going????"
+ }
+ ]
+}'
+```
+</CodeGroup>
+
+
+## Tool sandboxing
+
+To enable tool sandboxing, set the `E2B_API_KEY` and `E2B_SANDBOX_TEMPLATE_ID` environment variables (via [E2B](https://e2b.dev/)) when you use `docker run`.
+When sandboxing is enabled, all custom tools (created by users from source code) will be executed in a sandboxed environment.
+
+This does not include MCP tools, which are executed outside of the Letta server (on the MCP server itself), or built-in tools (like `send_message`), whose code cannot be modified after server startup.