The Letta API

The Letta platform provides multiple ways to interact with your stateful agents. Whether through the ADE’s visual interface or programmatically via our APIs, you’re always connecting to the same agents running in your Letta server.

APIs and SDKs

We provide a comprehensive REST API and native SDKs in Python and TypeScript. All three interfaces - the ADE, REST API, and SDKs - use the same underlying API to interact with your agents, making it seamless to develop visually in the ADE and then integrate those agents into your applications.

Python SDK

The legacy Letta Python LocalClient/RestClient SDK is available under pip install letta (which also contains the server). This client is deprecated and will be replaced in a future release with the new letta-client. Please migrate any Python code using the old RESTClient or LocalClient to use letta-client to avoid breaking changes in the future.

The Letta Python SDK can be downloaded with:

$pip install letta-client

Once installed, you can instantiate the client in your Python code with:

1from letta import Letta
2
3# connect to a local server
4client = Letta(base_url="http://localhost:8283")
5
6# connect to Letta Cloud
7client = Letta(token="LETTA_API_KEY")

TypeScript SDK

The Letta TypeScript (Node) SDK can be downloaded with:

$npm install @letta-ai/letta-client

Once installed, you can instantiate the client in your TypeScript code with:

1import { LettaClient } from '@letta-ai/letta-client'
2
3const client = new LettaClient({
4 token: "LETTA_API_KEY",
5});