This repo provides a simple example of a ReAct-style agent with a tool to save memories, implemented in JavaScript. This is a straightforward way to allow an agent to persist important information for later use. In this implementation, we save all memories scoped to a configurable userId
, enabling the bot to learn and remember a user's preferences across different conversational threads.
This quickstart will get your memory service deployed on LangGraph Cloud. Once created, you can interact with it from any API.
Assuming you have already installed LangGraph Studio, to set up:
.env
file..env
file.The defaults values for model
are shown below:
model: anthropic/claude-3-5-sonnet-20240620
Follow the instructions below to get set up, or pick one of the additional options.
To use Anthropic's chat models:
.env
file:ANTHROPIC_API_KEY=your-api-key
To use OpenAI's chat models:
.env
file:OPENAI_API_KEY=your-api-key
memory_agent
graph and have a conversation with it! Try sending some messages saying your name and other things the bot should remember.Assuming the bot saved some memories, create a new thread using the +
icon. Then chat with the bot again - if you've completed your setup correctly, the bot should now have access to the memories you've saved!
You can review the saved memories by clicking the "memory" button.
This chat bot reads from your memory graph's Store
to easily list extracted memories. If it calls a tool, LangGraph will route to the store_memory
node to save the information to the store.
Memory management can be challenging to get right, especially if you add additional tools for the bot to choose between. To tune the frequency and quality of memories your bot is saving, we recommend starting from an evaluation set, adding to it over time as you find and address common errors in your service.
We have provided a few example evaluation cases in the test file here. As you can see, the metrics themselves don't have to be terribly complicated, especially not at the outset.
content: string, context: string
for each memory, but you could structure them in other ways.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4