Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add agent memories #326

Merged
merged 10 commits into from
Sep 23, 2024
Merged

Add agent memories #326

merged 10 commits into from
Sep 23, 2024

Conversation

jlowin
Copy link
Member

@jlowin jlowin commented Sep 23, 2024

After configuring a memory provider (e.g. Chroma), you can create persistent memories. Memory modules can be created and assigned to agents or tasks:

Example

(Assumes you run pip install chromadb)

In one terminal:

import controlflow as cf

# Create a Memory module
weather_memory = cf.Memory(
    key="weather",
    instructions="Store and retrieve information about the weather."
)

# Use the memory to record the observation
cf.run("It is 70 degrees today.", memories=[weather_memory])

In another terminal:

import controlflow as cf

# Create a memory with the same key as the previous one
weather_memory = cf.Memory(
    key="weather",
    instructions="Store and retrieve information about the weather."
)

# Use the memory to answer the question
cf.run("What is the weather today?", memories=[weather_memory])

Memories are designed to be portable and partitioned -- so you can create and reuse a memory module for every user ID, every topic, every agent, etc. and supply them whenever and whenever you need access.

@jlowin jlowin added the feature New feature that doesn't exist today label Sep 23, 2024
@github-actions github-actions bot added documentation Improvements or additions to documentation tests Adds or improves unit tests labels Sep 23, 2024
@jlowin jlowin merged commit 25c6498 into main Sep 23, 2024
5 checks passed
@jlowin jlowin deleted the memories branch September 23, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature New feature that doesn't exist today tests Adds or improves unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant