How to Install MemGPT: The Future of Language Models with Built-in Memory Management

How to Install MemGPT


In this article, we walk you through how to install MemGPT and how to use it.

With the rapidly evolving world of artificial intelligence, MemGPT emerges as a beacon of innovation. With its unique architecture, this groundbreaking language model promises to redefine the boundaries of what language models can achieve.

Drawing parallels with computer operating systems, MemGPT introduces a revolutionary approach to memory management, allowing for unbounded contexts and more intuitive interactions.

Understanding MemGPT

What is MemGPT?

MemGPT, or Memory GPT, is not just another language model. It’s a revolutionary design combines a fixed-context language processing core with a tiered memory system. This architecture allows it to manage and recall vast amounts of information, akin to how computer operating systems manage primary (RAM) and secondary (disk) memory.

MemGPT have published the research paper explaining how it works if would be interested in reading in more detail.

How does MemGPT work?

How does MemGPT workflow diagram

MemGPT operates in a unique cycle. It can choose when to act and request specific operations, like an operating system deciding when to access RAM or disk storage. These function calls enable MemGPT to save or retrieve data, chaining them together for sequences of actions.

Virtual Context in MemGPT

MemGPT introduces the concept of a virtual context, which includes:

  • Main Context (Analogous to RAM): This is further divided into system instructions, conversational context, and a “working context” that serves as a scratchpad for the agent.
  • External Context (Analogous to Disk Storage): Comprising of recall storage (storing the entire history of events) and archival storage (a general read/write store).

Real-World Applications

  • Self-Editing Memory Chatbots
  • MemGPT-powered chatbots can evolve based on user interactions, updating their knowledge autonomously.
  • Chat with Your Data
  • MemGPT can seamlessly integrate with other applications, pulling relevant data for contextually apt responses.

How to Install MemGPT

Before we get into how to install MemGPT, we need to install and configure requirements to make the process of installing MemGPT go smoothly.

Install Dependencies

Ensure Git, Python, Anaconda, and Visual Studio Code are installed.

Download and Install Git Bash: Visit the Git for Windows website and download GitBash. You’ll see a download button on the homepage. Download and run the installer.

GitBash Download

Download and Install Python: Visit the Python download page and download and run the installer. If you already have Python installed, select upgrade.

Python Download page

Download Anaconda, which is used to avoid any Python and module versioning issues. Visit the Anaconda download page and click download. This will allow you to select which version of Python is used for each project.

Anaconda Download Page

Next, open Visual Studio Code and click the little button in the top right that says “toggle panel”. This will open up your terminal within Visual Studio Code. If you don’t have Visual Studio Code, download it free from

Enable terminal visual studio code

Click on the dropdown menu next to the “PowerShell” label in the terminal and select “Git Bash” from the list to switch the console to Git Bash.

Select Git Bash in Visual Studio for MemGPT

3. Clone and Setup

Navigate to the MemGPT GitHub repository, click the green “Code” button, and copy the URL.

MemGPT GitHub repository download

Now, in the Visual Studio terminal type git clone with the copied URL:

git clone

Once complete you should see the following

git clone

Create a New Conda Environment

1. Create a new Conda environment. You can do this by running the following command in your terminal, it will ask you to proceed type “y” and press enter:

conda create -n MemGPT python=3.10.9

2. Activate the Conda environment using the command:

conda activate MemGPT

3. Navigate to the MemGPT Folder using the command:

cd MemGPT

Install All the Requirements using the command:

pip install -r requirements.txt

MemGPT pip install -r requirements.txt

Set Up OpenAI API Key:

Export your OpenAI API key using the command:

export OPENAI_API_KEY=[Your OpenAI API Key]


Document Retrieval (Chat with Your Docs)

In this example, SEC filings were used to train the data but you can use this on any data you like as long as it is in your folder location.

  • Use the command: python3 -d archival_storage_files compute_embeddings=[location of your document].
  • You can use a wildcard (*.txt) to grab all text documents in a folder; see the screenshot below.
  • The system will provide a compute charge indicating the cost to compute embeddings for the documents.
  • Confirm to proceed.
python3 -d archival_storage_files compute_embeddings=[location of your document]

Ask Questions Based on Archival Memory

  • For example: “Based on your archival memory, how much revenue did Lyft and Uber make last year?”
  • MemGPT will search its archival memory and provide the relevant information.
MemGPT example 1
MemGPT example 2

Word Count Query:

  • For example: “Based on your archival memory, how often did the word ‘driver’ appear in the Lyft SEC filings?”
  • MemGPT will search and provide the count.

This could be expensive using GPT-4 so be careful with your API usage.

Deep Memory Retrieval

MemGPT introduces a benchmark called “deep memory retrieval” to evaluate its performance. This benchmark tests the model’s ability to delve into its memory and retrieve relevant information, showcasing its practical applications.

Limitations of MemGPT

While MemGPT presents a promising future, it’s essential to note its current limitations. The implementation heavily relies on OpenAI’s GPT-4. Other models, like GPT-3.5, have shown inconsistencies, especially in generating correct function calls. GPT-4 API requests can become expensive but have been coming down in price recently.

The creators of MemGPT have also stated that they are working to incorporate open-source models like LLama 2 and many more.

MemGPT Demo

One of my favourite AI Youtubers Matthew Berman has a comprehensive video on How to install MemGPT and use it with examples. I highly recommend that you check out his video on it.


MemGPT stands out as a game-changer in the AI landscape. Its innovative approach to memory management, combined with its capabilities, makes it a formidable tool. MemGPT sets the stage for more intuitive and data-driven interactions as AI evolves.

MemGPT has a very active discord community I recommend checking it out to keep up to date with the latest developments in MemGPT.

More Open-Source AI Tools

Here is a list of open-source AI tools we have reviewed on Lachie’s Lifestyle:

DragGAN – DragGAN is an advanced and innovative photo editing tool the Max Planck Institute developed that utilizes artificial intelligence to transform and modify images.

Aider AI – This terminal-based chat tool enables you to create and modify code utilizing OpenAI’s GPT models. GPT can assist you in initiating a new project or altering code in your current git repository.

MusicGen – MusicGen is an AI music generation tool developed by Meta, capable of creating high-quality music samples from simple text prompts and offering the feature to upload audio clips for additional guidance.

SuperAGI – My personal favorite is a multipurpose AI autonomous agent similar to AutoGPT but an extremely enhanced version with a GUI.

AutoGPT – One of the first AI autonomous agents to utilize OpenAI ChatGPT API models.

Leave a Reply

Up ↑