“Memory for agents (conceptual video)”의 전체 스크립트입니다. 타임스탬프를 클릭하면 해당 장면부터 영상이 열려요. 다른 영상이 필요하다면 유튜브 스크립트 추출기를 이용하세요.
0:00 today I want to talk about memory memory is one of the most exciting things that we think is happening in the agent world and we're adding a bunch of functionality into L graph to help you build applications that have memory this video will be more of a conceptual overview we won't go over any code rather we're going to talk through a few memory Concepts that we think are critical to understanding memory and understanding how we're thinking and tackling memory here at linkchain one of the main things that we think about memory is that it needs to be really application specific it needs to be specific to what you're trying to do and what things you might want to remember because that's what's going to make your application better so we're not very bullish on the idea of a general memory abstraction or service rather we're
0:46 going to give you low-level components so that you can Implement memory for yourself and we're also going to tell you how we're thinking about it so that hopefully that can help you implement the best memory for your application at a high level we think there are two types of memory one is short-term memory and this primarily relates to conversation memory if you've used Ling graph before then you're probably familiar with the idea of a checkpoint checkpoints maintain memory for a specific thread a thread is equivalent to a conversation and so this is what we call short-term memory and checkpoints are the lingraph implementation for implementing that long-term memory is a New Concept that we've recently started to think about and talk about and we've added a new abstraction called store to help with
1:31 this in Lang graph so in L graph checkpoints keep the memory within a thread store is used to keep memory across threads so it can be updated with information that it's gleaned from multiple different threads and then can pull that in and can use that when processing a new thread let's talk about some short-term memory things first and then we'll dive into more detail on long-term memory one of the common techniques we see for short-term memory is just filtering messages as you have more and more back and force with an AI the message list will grow in length and so being able to filter them is really important there's some basic filtering stuff like just keep the last 10 messages but then there's also Things
2:16 based on token counts and based on the types of messages as well perhaps it's more important to keep the human and AI messages rather than the tools for example if you're not satisfied with just filtering m mesages you can also summarize previous messages and pass in a summary this is typically done by calling an llm and storing that is some attribute on your graph State now let's talk about long-term memory at a high level we see two different ways that people are putting long-term memory into their application one is what we call in the hot path and so this is where the application logic itself updates memory the other is when it happens in the background and so here you have the application running and there's a separate process that in the background
3:02 runs and updates memory and this can happen real time or this can happen 30 minutes later an hour later whatever you decide there's some pros and cons to each of these so in the hot path it's very transparent when you're updating memory you can show this to the user so they know what's going on it's also real time so if they go start a separate conversation right away they have that updated memory the downsides are that because it's in the hot path it can add some latency and it also makes your application logic a little bit more convoluted because now you have to have your core application logic in there as well as the logic for how to update the memory when it happens in the background the pros and cons are flipped so there's no latency that's added because it's happening in the background in a
3:48 separate process you can also cleanly separate the logic for your application versus the logic for updating memory however there are some cons because this has happened in the background you can't easily surface that to the user and separately depending on how you set it up this memory may not be updated when you go to start a new conversation in fact a key part of when you're running memory in the background is figuring out when exactly to trigger that background run and that adds some additional logic that you have to think about for long-term memory it's really important to think about what's the exact shape of the memory that's your storing and there's a few different options that we see people doing one common type of
4:33 memory is instructions these are instructions that can be inserted as part of a system prompt that system prompt then controls how the application performs these instructions are often updated based on user interactions or user feedback so for example if you have a tweet writer application and you go back and forth with the user and they refine their tweet and you see that they're removing emojis you can use an llm to synthesize those interactions and update the part of the system prompt to say don't use emojis a second type of memory that we see people storing is what we call Profile instructions are typically a string but profiles are now a dictionary of key value pairs so for a chatbot that's concerned with being a companion for a user you
5:20 might have things like name age friends that you want to remember about the user the memory process here would extract that information based on user conversations and then update any previous information that had existed to create a new updated profile this profile can then be inserted as part of the system message in future conversations and this can be included when responding to the user A Step Above This profile is a list of these objects this is useful when you want to remember a list of things for example a list of my favorite restaurants and you want to remember the location and the name and the type of all of them there's some extra complexity here the llm now has to prompt to not only add a new item to the list but also update or delete previous
6:07 ones and so there's a bit of prompt engineering you need to do here again we're really excited about memory at linkchain we think it's a key part of building personalized and differentiated applications but we also think that there's no Silver Bullet single answer fits-all solution for memory we think that it has to be custom to your application and so we hope to give you a lot of the tools to help you build application specific memory yourself so I know this just covered the concepts but I'd encourage you to go check out the how-to guides and the tutorials that we have out for building this type of personalized memory thanks for watching and let me know if you have any questions