Letta Python Client
raw JSON → 1.10.3 verified Fri May 01 auth: no python
The official Python library for the Letta API, providing a typed interface to agents, conversations, messages, tools, and more. Current version 1.10.3, requires Python >=3.9, actively maintained with frequent releases (multiple per month).
pip install letta-client Common errors
error ModuleNotFoundError: No module named 'letta' ↓
cause Typo in package name: installed `letta-client` but imported as `letta`.
fix
Install with
pip install letta-client then import with from letta import Letta. error ImportError: cannot import name 'Letta' from 'letta' ↓
cause Outdated version or incorrect import path. The SDK was previously structured differently.
fix
Upgrade to latest:
pip install --upgrade letta-client and use from letta import Letta. error letta.APIConnectionError: Connection error ↓
cause Missing or invalid API key. The client cannot reach the Letta API.
fix
Set the
LETTA_API_KEY environment variable or pass api_key to the Letta constructor. Warnings
breaking The client constructor changed from positional to keyword-only arguments in v1.x. Use `Letta(api_key=...)` instead of `Letta('...')`. ↓
fix Use keyword arguments: `Letta(api_key='...')`. For environment variable, omit api_key entirely.
gotcha Methods that accept `model` or `model_id` may be case-sensitive. Use exact model identifiers from the Letta dashboard. ↓
fix Always use the exact model string as returned by `client.models.list()`.
gotcha Streaming responses require `stream=True` parameter in message creation endpoints. Without it, the response is non-streaming and may hang if large. ↓
fix Add `stream=True` to create calls: `client.messages.create(..., stream=True)`.
Imports
- Letta wrong
import lettacorrectfrom letta import Letta
Quickstart
import os
from letta import Letta
client = Letta(api_key=os.environ.get('LETTA_API_KEY', ''))
agents = client.agents.list()
print(agents)