Thank you for investing time in contributing to our project! Here's a guide to get you started.
First things first, let's get you a personal copy of Letta to play with. Think of it as your very own playground. 🎪
- Head over to the Letta repository on GitHub.
- In the upper-right corner, hit the 'Fork' button.
Now, let's bring your new playground to your local machine.
git clone https://github.com/your-username/letta.gitThis project requires PostgreSQL to be installed and running on your system. Assuming you have a running PostgreSQL instance, first you need to create the user, database and ensure the pgvector extension is ready. Here are sample steps for a case where user and database name is letta and assumes no password is set:
Open your terminal (or Command Prompt on Windows) and run:
# On Mac/Linux:
sudo -u postgres psql
# On Windows:
psql -U postgres
Once inside the PostgreSQL prompt (you will see postgres=#), run the following SQL block:
-- 1. Create a dedicated role with login and superuser permissions
CREATE ROLE letta WITH LOGIN SUPERUSER PASSWORD 'letta';
-- 2. Create the database and assign 'letta' as the owner
CREATE DATABASE letta OWNER letta;
-- 3. Switch connection to the new 'letta' database
\c letta
-- 4. Enable the pgvector extension for vector embeddings
CREATE EXTENSION IF NOT EXISTS vector;
Setup the environment variable to tell letta code to contact PostgreSQL database:
```shell
export LETTA_PG_URI="postgresql://${POSTGRES_USER:-letta}:${POSTGRES_PASSWORD:-letta}@localhost:5432/${POSTGRES_DB:-letta}"First, install uv using the official instructions here.
Once uv is installed, navigate to the letta directory and install the Letta project with uv:
cd letta
eval $(uv env activate)
uv sync --all-extrasAfter this you need to prep the database with initial content. You can use alembic upgrade to populate the initial
contents from template test data.
```shell
uv run alembic upgrade head
Now when you want to use letta, you can use uv run to run any letta command:
uv run letta serverWe recommend installing pre-commit to ensure proper formatting during development:
uv run pre-commit install
uv run pre-commit run --all-files
If you don't install pre-commit, you will need to run uv run black . before submitting a PR.
Time to put on your creative hat and make some magic happen. First, let's create a new branch for your awesome changes. 🧙♂️
git checkout -b feature/your-featureNow, the world is your oyster! Go ahead and craft your fabulous changes. 🎨
If you are running Letta for the first time, your database will be automatically be setup. If you are updating Letta, you may need to run migrations. To run migrations, use the following command:
uv run alembic upgrade headIf you have made changes to the database models, you will need to create a new migration. To create a new migration, use the following command:
uv run alembic revision --autogenerate -m "Your migration message here"Visit the Alembic documentation for more information on creating and running migrations.
Before we hit the 'Wow, I'm Done' button, let's make sure everything works as expected. Run tests and make sure the existing ones don't throw a fit. And if needed, create new tests. 🕵️
Running tests:
uv run pytest -s tests
Running tests if you installed via pip:
pytest -s tests
If you added a major feature change, please add new tests in the tests/ directory.
If you need to add a new dependency to Letta, please add the package via uv add <PACKAGE_NAME>. This will update the pyproject.toml and uv.lock files. If the dependency does not need to be installed by all users, make sure to mark the dependency as optional in the pyproject.toml file and if needed, create a new extra under [project.optional-dependencies].
Please ensure your code is formatted correctly by running:
uv run black . -l 140
You're almost there! It's time to share your brilliance with the world. 🌍
- Visit Letta.
- Click "New Pull Request" button.
- Choose the base branch (
main) and the compare branch (your feature branch). - Whip up a catchy title and describe your changes in the description. 🪄
The maintainers will take a look and might suggest some cool upgrades or ask for more details. Once they give the thumbs up, your creation becomes part of Letta!
Please be sure to follow the project's Code of Conduct.
Need help or just want to say hi? We're here for you. Reach out through filing an issue on this GitHub repository or message us on our Discord server.
Thanks for making Letta even more fantastic!
If you prefer to keep your resources isolated by developing purely in containers, you can start Letta in development with:
docker compose -f compose.yaml -f development.compose.yml upThis will volume mount your local codebase and reload the server on file changes.