Set up a default persistent memory provider for your agents
New in version 0.10ControlFlow’s memory feature allows agents to store and retrieve information across multiple workflows. Memory modules are backed by a vector database, configured using a MemoryProvider.Setting up a default provider simplifies the process of creating memory objects throughout your application. Once configured, you can create memory objects without specifying a provider each time.
While ControlFlow does not include any vector database dependencies by default, the default provider is set to "chroma-db". This means that if you install the chromadb package, your memory modules will work without any additional configuration.
To use a provider, you must first install its dependencies. Please refer to the Memory doc to see all supported providers and their required dependencies.For example, to use the default Chroma provider, you need to install chromadb:
There are two ways to set up a default provider: using a string setting for common defaults, or instantiating a custom provider. Here, we’ll use a persistent Chroma database as our example.
For simple provider setups, you can modify ControlFlow’s default settings using a string value. The default value is "chroma-db", which will create a persistent Chroma database. To change it:
For more advanced setups, instantiate a provider with custom settings and assign it to the ControlFlow default. Note this must be done at runtime.
Copy
Ask AI
import controlflow as cffrom controlflow.memory.providers.chroma import ChromaMemoryimport chromadb# Set the default providercf.defaults.memory_provider = ChromaMemory( client=chromadb.PersistentClient(path="/custom/path"),)