Concepts

Outline of high-level concepts of MemGPT.

Agents

MemGPT agents are stateful LLM agents which can automatically manage long term memory, load data from external sources, and call custom tools. Unlike in other libraries, MemGPT agents are stateful, so keep track of historical interactions and reserve part of their context to read and write memories which evolve over time.

An agent is defined by the following initial state:

  • Preset: The preset consists of a system prompt and a list of tools that the agent has access to.
  • Human: Text containing information about the human that the agent interacts with.
  • Persona: Text containing information about the agent's persona.

You can create an agent from the CLI, or from the Python Client:

memgpt run --agent <AGENT_NAME> 

You can view available agents with:

memgpt list agents 

Sources

MemGPT sources are external data that is loaded and cached in a vector database. Sources can be attached to an agent for the agent to access, by copying the source data (consisting of text, embeddings, and additional optional metadata) into the agent's archival memory.

You can create a source with:

memgpt load directory --name short_stories --input-dir short_stories/

You can view available sources with:

memgpt list sources

Tools

You can add custom tools to MemGPT by defining and annotating functions in Python. To connect agents to tools, you must define a preset which can be used to create agents.

Preset

A preset defines a system prompt and a list of tools an agent has access to. Agents are initialized with a preset. You can define a preset by creating a YAML file:

system_prompt: "memgpt_chat"
functions:
  - "send_message"
  - "pause_heartbeats"
  - "core_memory_append"
  - "core_memory_replace"
  - "conversation_search"
  - "conversation_search_date"
  - "archival_memory_insert"
  - "archival_memory_search"

You can add a preset with:

memgpt add preset -f example_preset.yaml --name example_preset

You can view available presets with:

memgpt list presets 

Humans & Personas

Humans and personas define the

You can define humans and personas with:

memgpt add [human/persona] -f [FILENAME] --name [NAME]

You can view available humans and personas with:

memgpt list [humans/personas]

You can delete humans and personas with:

memgpt delete [human/persona] --name [NAME]