Letta Code (Research Preview)
Letta Code is a self-improving, stateful coding agent that can learn from experience and improve with use. You can use Letta Code as a general purpose CLI harness to connect any Letta agent (even non-coding agents!) to your local dev environment.
Letta Code is open source and model agnostic - supporting Claude Sonnet/Opus, GPT-5, Gemini 3 Pro, GLM-4.6, and more.
Read more about how to use Letta Code on the official docs page.
Important
Letta Code is a research preview in active development, and may have bugs or unexpected issues. To learn more about the roadmap and chat with the dev team, visit our Discord. Contributions welcome, join the fun.
Get started
Requirements:
- Node.js (version 18+)
- A Letta Developer Platform account (if you haven’t used Letta Code before, follow the instructions on startup to login via OAuth, or manually set
LETTA_API_KEYas an environment variable)
Install the package via npm:
npm install -g @letta-ai/letta-code
Then run letta to start Letta Code in interactive mode (see various command-line options on the docs):
letta
You can also run Letta Code in headless mode, making it easy to integrate into scripts (see the docs for more):
letta -p "Look around this repo and write a README.md documenting it at the root level"
Memory
All agents in Letta are stateful: they maintain context forever and can self-edit their own memory blocks.
If you’re using Letta Code for the first time, you will likely want to run the /init command to initialize the agent’s memory system:
> /init
Over time, the agent will update its memory as it learns. To actively guide your agents memory, you can use the /remember command:
> /remember [optional instructions on what to remember]
Connecting to an existing Letta agent
To connect to an existing agent, use the --agent flag:
letta --agent [existing-agent-id]
Skill learning
Skills are reusable modules that teach your agent new capabilities. They’re automatically discovered from your project’s .skills directory and loaded into the agent’s memory at session start.'
The easiest way to create a skill is using the interactive skill creation mode:
> /skill
Read the docs to learn more about skills and skill learning.
Self-hosting
To use Letta Code with a self-hosted server, set LETTA_BASE_URL to your server IP, e.g. export LETTA_BASE_URL="http://localhost:8283".
See our self-hosting guide for more information.
Installing from source
First, install Bun if you don't have it yet: https://bun.com/docs/installation
Run directly from source (dev workflow)
# install deps
bun install
# run the CLI from TypeScript sources (pick up changes immediately)
bun run dev
bun run dev -- -p "Hello world" # example with args
Build + link the standalone binary
# build bin/letta (includes prompts + schemas)
bun run build
# expose the binary globally (adjust to your preference)
bun link
# now you can run the compiled CLI
letta
Whenever you change source files, rerun bun run build before using the linked letta binary so it picks up your edits.
Made with 💜 in San Francisco