Enhance your agents with persistent memories.
key
and instructions
. The key
uniquely identifies the memory module so it can be accessed later. The instructions
explain what kind of information should be stored, and how it should be used.
pip install chromadb
to install the dependency for the default Chroma provider. To change the default, see the default provider guide.key
, so you can provide different instructions to different agents for the same module. For example, you might have one agent that you encourage to record information to a memory module, and another that you encourage to read memories from the same module.key
is crucial for accessing the correct set of memories. It must be provided exactly the same way each time to access an existing memory. Keys should be descriptive and unique for each distinct memory set you want to maintain.
instructions
field is important because it tells the agent when and how to access or add to the memory. Unlike the key
, instructions can be different for the same memory key across different Memory objects. This allows for flexibility in how agents interact with the same set of memories.
Good instructions should explain:
provider
is the underlying storage mechanism for the memory. It is responsible for storing and retrieving the memory objects.
pip install chromadb
to install its dependencies, after which you can start using memories with no additional configuration.Provider | Required dependencies |
---|---|
Chroma | chromadb |
pip install chromadb
to use the Chroma provider.
provider
parameter that will instantiate a provider with default settings. The following strings are recognized:
Provider | Provider string | Description |
---|---|---|
Chroma | chroma-ephemeral | An ephemeral (in-memory) database. |
Chroma | chroma-db | Uses a persistent, local-file-based database, with a default path of ~/.controlflow/memory/chroma . |
Chroma | chroma-cloud | Uses the Chroma Cloud service. The CONTROLFLOW_CHROMA_CLOUD_API_KEY , CONTROLFLOW_CHROMA_CLOUD_TENANT , and CONTROLFLOW_CHROMA_CLOUD_DATABASE settings are required. |
chromadb
is installed, the following code will create a memory module that uses an ephemeral Chroma database:
client
parameter that allows you to customize how the Chroma client connects, as well as a collection_name
parameter to specify the name of the collection to use.