ESC
↑↓ 选择↵ 打开esc 关闭⌘K 唤起
← 返回速读报告 回声编辑部 · NO.22 · 全文

Agents that remember

频道: Claude
视频: https://www.youtube.com/watch?v=geUv4CjPpxI
原文语言: en
统计: 共 78 轮


[0:19]

Hello everyone. Thank you all for joining us today. Um, my name is Kevin. Uh, I'm an engineer here at Anthropic. And today we'll be learning about how to build agents that remember. Um so uh today we're going to talk a little bit about the base case with agents today uh which is that they are isolated and this kind of limits their usefulness in a lot of real world workflows. Uh we'll look

大家好,感谢各位今天来参加。我叫 Kevin,是 Anthropic 的一名工程师。今天我们要聊的是怎么构建有记忆的 agent。我们先从今天 agent 的基本情况说起——它们是相互隔离的,这在很多真实工作流里其实限制了它们的实用性。我们会看看


[0:43]

at how we can actually solve this problem uh with our new agent memory stores feature that we've launched. Uh this will give agents access to a live memory store that they can read and write to over multiple sessions. And then we'll look at how we can improve these memory stores over time uh using a new feature that we call dreaming. Uh and then finally we'll get to see how

怎么用我们新发布的 agent memory store 功能来解决这个问题。它会让 agent 拥有一个实时的 memory store,可以在多个会话之间读写。然后我们会看看怎么用一个叫 dreaming 的新功能,让这些 memory store 随时间不断变好。最后我们再看看


[1:03]

all of this ties together with both our CLI and also our awesome console interface. Um so in the previous uh workshops I think we've learned a little bit about how cloud manage agents has these concepts called an agent environment and a session. Uh in this workshop we're going to add two additional concepts here. The first one here is a memory store. Uh so a memory store is a

这一切是怎么和我们的 CLI 以及超棒的控制台界面串联起来的。在之前的几场 workshop 里,我想大家已经了解了一点 Claude managed agents 里 agent environment 和 session 这两个概念。在这场 workshop 里,我们要再加两个概念。第一个就是 memory store。memory store 是一个


[1:28]

persistent file system-l like store that gives uh that attaches as a resource to sessions that you create and it gives agents access to uh it gives agents the ability to read and write information across sessions.

持久化的、类似文件系统的存储,它作为一种资源附加到你创建的 session 上,让 agent 能够跨会话读写信息。


[1:42]

A dream uh is what is a asynchronous job that runs in the background. uh it looks over an input memory store and a bunch of your previous sessions that are represented as transcripts and then we run a harness over them to distill new information that maybe the original agents missed. We do things like factchecking. Uh we also organize and consolidate and duplicate information so

dream 则是一个在后台运行的异步任务。它会查看一个输入的 memory store,以及你之前那一堆以文字记录形式呈现的会话,然后我们在这些内容上跑一套 harness,把原本 agent 可能漏掉的新信息提炼出来。我们会做一些事情,比如事实核查,还会对信息做整理、合并、去重,这样


[2:06]

that your memory stores don't grow unbounded over time. So uh also in case anyone in this room has not already uh downloaded the workshop repository you'll need for this uh here is the URL. I'll give a few seconds for folks to just grab that.

你的 memory store 就不会随着时间无限制地膨胀。另外,如果在座有人还没下载这次 workshop 需要用的代码仓库,这就是地址。我给大家几秒钟时间抓一下。


[2:24]

Okay. Um so let's kind of like talk a little bit about the problem today. So when you when you create agents on cloud manage agents today and sessions um most of the time you're creating one session at a time and these are isolated right?

好。那我们先来聊聊今天要解决的问题。当你今天在 Claude managed agents 上创建 agent 和 session 时,大多数情况下你一次只创建一个 session,而这些 session 都是相互隔离的,对吧?


[2:36]

the agent doesn't remember information from the past and it doesn't transfer information to future sessions. Um so I want to kind of like take us through this this base case today. Uh so if I switch over to my computer um I'm in our workshop repository here.

agent 不会记住过去的信息,也不会把信息传递给未来的会话。我想带大家走一遍今天这个基本情况。我切到我的电脑上,现在我在我们的 workshop 仓库里。


[2:52]

Uh hopefully everyone can see this uh in the back but I've just run the bootstrap script that we've uh included in the repository. Uh and what this has done is basically created uh some seed information for us. We have an agent uh we have an environment and we have a few like previous sessions that talk about things like the keynotes uh from day one as well as you know uh a previous

希望后排的各位也能看清。我刚刚跑了仓库里附带的 bootstrap 脚本。它做的事情基本上就是给我们创建了一些种子信息。我们有一个 agent,有一个 environment,还有几个之前的会话,内容涉及比如第一天的 keynote,以及一个之前的


[3:13]

workshop. And so uh what I'm going to do from here is actually go ahead and start walking through this guide with you guys. Feel free to follow along your computers. I'll be using the CLI and then also showing kind of the console interface uh for each of these steps. So first we're going to create a session that basically tells it some some new information. Uh so I'm going to copy

workshop。接下来我要做的,就是带着大家一起走一遍这个指南。欢迎你们在自己的电脑上跟着做。我会用 CLI,同时也展示一下控制台界面里每一步是怎么样的。首先我们要创建一个 session,给它一些新信息。我先复制


[3:36]

this command here. And as you can see we are creating a session with the agents that we've created before uh with the environment ID. Uh and we've given a title here of just like write test with no memory.

这条命令。可以看到,我们用之前创建好的 agent、带上 environment ID 来创建一个 session。我们给它起了个标题,就叫 "write test with no memory"(无记忆写测试)。


[3:51]

Great. Uh so now that we created the session uh I'm going to quickly switch over to my console here. Um and you'll see that just move this over. You'll see that the session shows up in console. Uh it doesn't it has a status of idle. Nothing running yet. Uh so then we're going to switch back and then I'm going to send this session some new information. Uh so once I copy this

好。session 创建好了,我快速切到控制台这边。把这个挪过来。你会看到这个 session 出现在控制台里,状态是 idle(空闲),还没有任何东西在跑。然后我们切回去,我要给这个 session 发一些新信息。我复制这段


[4:18]

and what I'm doing here is sending a first user message here with information about the CMA talk yesterday. uh naming a few keywords like multi- aent orchestration multi- aent orchestration outcomes in memory and I've also just given it this URL you know example that I took notes and uploaded them here.

我在这里做的是发出第一条用户消息,内容是关于昨天那场 CMA 演讲的信息。提到了几个关键词,比如 multi-agent orchestration(多 agent 编排)、记忆里的 multi-agent orchestration 成果,我还给了它一个 URL,比如说我做了笔记并上传到了这里。


[4:38]

So, if I switch back over to my console, uh, we should see this event pop up. And what we sort of expect the the agent or the model will do here is it'll just respond and say like, great, thanks for the information. Not sure what else you want me to do here. Uh, so we'll give it a sec and maybe folks to catch up.

如果我切回控制台,应该能看到这个事件冒出来。我们大概预期 agent 或者说模型会做的,就是它会回复说"好的,谢谢你提供的信息,不太确定你还想让我做什么"。我们给它一点时间,大家也趁机跟上进度。


[5:01]

See, we get a little refresh. Ah, sorry. Yeah. So, it looks like the model responded here. Just collapse this. Yeah, it's basically saying, okay, great. Thanks for telling me this information. Uh, so then if we go, >> sorry, >> uh, this is using, I believe, sonnet, the agent that was created at the beginning.

看,刷新了一下。啊,抱歉。是的,看起来模型在这里回复了。把这个折叠起来。对,它基本上就是说"好的,谢谢你告诉我这些信息"。那接下来如果我们——抱歉——这个用的我记得是 Sonnet,就是一开始创建的那个 agent。


[5:22]

Yeah. Um, cool. So, if I go back here, uh, to my workshop here, we're going to create basically a second section that's kind of the retest. So, I'll go through these steps a little bit faster. Uh, and then again I'll send it a message here. That's this time I'm going to ask it for information about the stuff that I just told it.

对。好,那我回到这边我的 workshop,我们要创建第二个部分,算是一个"重新测试"。这几步我会走得快一点。然后我再给它发一条消息,这次我要向它询问我刚才告诉它的那些内容。


[5:48]

And if I go back to our console here and check out the other session that should have been created, we would expect the agent to basically um say something like, "Yeah, I don't really have access to this information.

如果我回到控制台,看一下那个应该已经被创建出来的另一个 session,我们预期 agent 基本上会说类似"嗯,我其实没有访问这些信息的权限"这样的话。


[6:01]

I can help you in these various ways." Great. So that's effectively the base case today. Uh so if I go back to the slides real quick, this is a quick recap of what we did. We told it something, asked another session about it later. No information is transferred between the sessions.

"我可以从这几个方面帮你。"好。这基本上就是今天的基本情况了。我快速回到幻灯片,这是我们刚才所做事情的一个简要回顾:我们告诉了它一些东西,过会儿在另一个 session 里问它这件事,结果两个 session 之间没有任何信息传递。


[6:19]

So how do we solve this problem? Right? Um just like in humans, uh we've introduced the sort of concept of memory. And again, a memory store here in the cloud manage agents platform is a file system like store. uh under the hood you can or you can create as many memory stores as you like here. So you don't have to necessarily restrict a memory store to one organization. You

那我们怎么解决这个问题呢?对吧?就像人类一样,我们引入了 memory 这个概念。再强调一次,这里的 memory store 在 Claude managed agents 平台里是一个类似文件系统的存储。在底层,你想创建多少个 memory store 都可以。所以你不一定非要把一个 memory store 限制在一个组织上。你


[6:40]

could create it per user, per workspace, etc. It's up to you to kind of define what the boundaries of the memory store are. Uh and then under the hood, this memory store gets attached as a file system to the the session container and the model has tools to read and write to it. Uh the actual interesting thing here is that we've actually you mounted it as a file system because it's such a

可以按用户创建,按 workspace 创建,等等。memory store 的边界怎么定,完全由你决定。在底层,这个 memory store 会作为文件系统挂载到 session 的容器上,模型有相应的 tool 来读写它。这里真正有意思的一点是,我们之所以把它挂载成文件系统,是因为这对模型来说是一个非常


[6:59]

powerful interface for the model. uh you can use things like bash to like uh like explore the file system. It can use GP to kind of search for keywords. It can also read files and do a bunch of like really powerful things um that make it much more useful for the agent.

强大的接口。你可以用 bash 之类的工具去探索这个文件系统,可以用 grep 来搜索关键词,还可以读取文件、做一大堆非常强大的事情,这些都让它对 agent 而言更加实用。


[7:17]

Um so I'll switch back to my computer here and we'll walk through kind of how to create a memory store. Um so first things first is actually creating it. So I'm going to copy this uh command here. Feel free again to follow along on your computers. Um, and the kind of parameters that you need here are mainly just like a name. Uh, so I'm calling mine CWC memory. You can

那我切回我的电脑,我们来走一遍怎么创建一个 memory store。第一件事就是把它创建出来。我复制这条命令。还是欢迎大家在自己电脑上跟着做。这里你需要的参数主要就是一个名字。我把我的叫做 CWC memory。你可以


[7:40]

give it a quick description. Uh, and then I'll show you also in console later that there are two additional parameters that you can set here. But let me just follow through with a simple example. Uh, once I create this memory store, you can actually see it in console under manage agents memory stores.

给它加一段简短的描述。然后我等会儿也会在控制台里给你们看,这里其实还有另外两个可以设置的参数。不过我先用一个简单的例子走一遍。一旦我创建好这个 memory store,你就能在控制台的 managed agents 下的 memory stores 里看到它。


[7:58]

and you'll see that it's active. Uh you can actually click into it and view uh essentially a file system viewer of what's currently in it. Of course, there's nothing in it right now. Additionally, uh we offer functionality uh we offer the ability for you to like add manually add memories. So you can create like a file under a specific path, add some content, etc.

你会看到它处于 active(激活)状态。你可以点进去,看到一个文件系统查看器,展示里面当前有什么。当然现在里面什么都没有。另外,我们还提供了手动添加记忆的功能。所以你可以在某个指定路径下创建一个文件,加上一些内容,等等。


[8:20]

If I go back just a brief second and talk about uh creating a new memory store, there's actually two sort of additional parameters that you can uh set on the memory store uh when we actually mount it. So if I go back to the repository here, um the next step once you create a memory store is to actually use it with your sessions. So I'm going to again copy a few of these

我回过头来简单讲一下创建新 memory store 这件事,其实在我们真正挂载这个 memory store 的时候,有另外两个参数可以设置。我回到这边的仓库,创建好 memory store 之后的下一步,就是在你的 session 里实际用上它。我再复制几条这些


[8:45]

commands. So the first one here is basically just giving us the shape that we need to pass the sessions API request. I'll paste it in our terminal here so we can see it better. Um so again the memory store here you just pass in a memory store ID. Uh and you can also give it a prompt around uh that will steer the agent to read and write specific information. So you might

命令。第一条基本上就是给出我们向 sessions API 请求里需要传入的结构。我把它粘到终端里,这样我们能看得更清楚。再说一次,memory store 这里你只要传入一个 memory store ID。你还可以给它一段 prompt,用来引导 agent 去读写特定的信息。所以你可能会


[9:07]

want it to focus on maybe like a specific um link or a specific like area of focus on. Let's say you're making making like a investment agent, right? And you wanted to focus on specific things to remember future. Uh so you can do that with a prompt parameter.

希望它聚焦在某个特定的链接上,或者某个特定的关注领域上。比如说你在做一个投资 agent,对吧?你想让它聚焦在某些特定的、需要为将来记住的东西上。那你就可以用这个 prompt 参数来实现。


[9:22]

Additionally, there is an access field uh that defaults to read or write. Um you can change that to read only which will make it so that the session and the agent will only be able to read from that memory store. It cannot update it.

另外还有一个 access 字段,它默认是读写(read or write)。你可以把它改成只读(read only),这样这个 session 和 agent 就只能从那个 memory store 读取,不能更新它。


[9:36]

So once I run this um you'll see I have created a new session in console. Uh, and this time it'll have a memory store attached. And then if I send an event here, this time we'll just basically repeat the test that we did just before. So let me grab this again. Same text as before. We're telling it new information. Uh, and hopefully we'll be able to observe a

所以一旦我运行这个,你会看到我在控制台里创建了一个新的 session。这次它会附带一个 memory store。然后如果我在这里发一个事件,这次我们基本上就重复一下刚才做过的那个测试。我再把这段抓过来。和之前一样的文本,我们告诉它一些新信息。希望这次我们能观察到


[10:07]

different behavior this time. Yeah. So clicking into uh if you click into the session details, you'll see the the information that I just gave it. And now the model is like first looking at memory to see okay, was there anything that like I need to remember for this conversation.

一个不一样的行为。对。点进去——如果你点进 session 的详情里,你会看到我刚才给它的那些信息。而现在模型会先去看 memory,看看"好,这次对话里有没有什么是我需要记住的"。


[10:28]

Uh and now it's going to actually like of course there's nothing in our memory store. So now what it's going to do is actually save the content that I told it to that memory store directly. and it saved it under this like sessions.mmd file and it's great telling me that uh what it did.

现在它要——当然了,我们的 memory store 里现在是空的。所以接下来它要做的,就是把我刚才告诉它的内容直接存进那个 memory store。它把内容存到了这个 sessions.mmd 文件里,而且很贴心地告诉我它做了什么。


[10:48]

Um, so then if I go back and do that same test that we did before, this time I'll just copy both. Sorry, again where this time we're going to create a new session with the same memory store that we were just using.

那么如果我回头再做一遍我们之前做过的那个测试,这次我把两段都复制过来。不好意思,重来一下——这次我们要用刚才一直在用的那个 memory store 来新建一个 session。


[11:09]

Uh, and we will send it an event here asking it what are the things that it found or it learned from the CMA talk. Once again, going back to our console UI, we can see the recall test running. And as we would expect, the model is now first looking at its memory store to see if there's any information. And again, it's now using GP to find uh any sort of keywords here. It's looking for CMA. And

然后我们会给它发一个事件,问它从 CMA 那场演讲里找到了什么、学到了什么。再次回到我们的控制台 UI,可以看到召回测试正在跑。和我们预期的一样,模型现在会先去看它的 memory store 里有没有相关信息。它现在用 grep 来查找关键词,它在找 CMA。


[11:40]

great, it found like a lot of information that we just told it from the from a previous session. And now it's able to answer my question, right? And this is like of course a very simple example, but this illustrates kind of the power of of memory. And this is like something that was kind of difficult to do before, right?

很好,它找到了一大堆我们在上一个 session 里刚告诉它的信息。现在它就能回答我的问题了,对吧?当然这是个非常简单的例子,但它很好地展示了 memory 的威力。而这在以前其实是挺难做到的,对吧?


[12:01]

I'll give quick pause in case anyone's struggling. Um, okay, great. So what what else kind of can can you do with a memory store here? Well, we actually offer uh additional sort of endpoints that allow you to manually inspect the store itself. Uh so I'll use the CLI here, but for instance, you can list all of the memory files that are in the memory store.

我稍微停一下,以防有人没跟上。好,很好。那么用这个 memory store 你还能做些什么呢?其实我们还提供了一些额外的接口,让你可以手动检查 store 本身。我这里用一下 CLI,比如说,你可以列出 memory store 里所有的 memory 文件。


[12:25]

We can like do that. Um there's also each uh memory a memory stores memory files in a memory store are also versioned. Uh so anytime you make a change to a file, etc., there's a new version that's created and we offer a set of endpoints for that.

我们可以这样做。另外,memory store 里的每个 memory 文件都是有版本管理的。所以每次你对一个文件做改动等等,都会生成一个新版本,我们为此也提供了一套接口。


[12:43]

And then I can also kind of take you through the memory store UI. So each memory store you create again is here. And if we go back to our like kind of file system viewer, you can actually see the files that it created. Uh there will be like a directory structure here.

接着我还可以带大家看看 memory store 的 UI。你创建的每个 memory store 都在这里。如果我们回到那个文件系统查看器,就能实际看到它创建的那些文件。这里会有一个目录结构。


[13:02]

If Claude is creating kind of subdirectories to organize memory files, you can actually edit these memory files directly if you wanted to. So for instance, if Claude wrote something u that was incorrect or maybe you just wanted to add more information, you can do that. And again, as we saw before, you can add additional memories to a memory store.

如果 Claude 创建了一些子目录来组织 memory 文件,你其实可以直接编辑这些 memory 文件。比如说,要是 Claude 写错了什么,或者你只是想补充更多信息,你都可以这么做。而且和我们刚才看到的一样,你可以往 memory store 里添加更多的 memory。


[13:26]

Uh okay, so I'm going to go back to the slides real quick. And as we just talked about, uh this is how you create a memory store and then mount it on a session that you want to use it on. Again, it's up to you to kind of decide which of your sessions will use memory, which ones will not.

好,我先快速切回幻灯片。正如我们刚才讲的,这就是创建一个 memory store、然后把它挂载到你想用它的 session 上的流程。再说一遍,具体哪些 session 用 memory、哪些不用,完全由你来决定。


[13:47]

Uh, we also saw how you can like list memories and see what's currently in a memory store. And let's move on to talk a little bit about dreaming. Now, um, so when you have agents that are reading and writing to this memory store over time, uh, we've noticed that often times it can start just kind of dumping information to that memory store. So it'll start writing maybe every every task you ask

我们也看到了怎么列出 memory、看看 memory store 里现在有些什么。接下来我们稍微聊聊 dreaming。当你的 agent 长期对这个 memory store 进行读写时,我们发现它常常会开始往 memory store 里一股脑地堆信息。所以每次你让它做任务,它可能都会记录一些信息,


[14:10]

it to do maybe records information right and over time your memory store is going to grow right and there's no real process uh before that would allow you to sort of organize that memory maybe check to see if anything was stale and and consolidate any duplicates right and so this is where dreaming comes in uh dreaming is a is a batch process that runs again asynchronously you launch it

随着时间推移,你的 memory store 就会越来越大。而之前并没有一个真正的流程,能帮你去整理这些 memory、检查有没有过时的内容、合并重复的部分。这就是 dreaming 派上用场的地方。dreaming 是一个批处理流程,同样是异步运行的,你来启动它。


[14:32]

uh using uh our API or through console and it'll run a a new dreaming harness that we built that is a multi- aent setup. It will look over each of the input sessions that you've given it. So you specify like an input memory store that you want it to dream over along with like a group of transcripts that you think might help or enrich that memory store. It'll look through each

你通过我们的 API 或者控制台来启动,它会跑一个我们构建的全新 dreaming 框架,这是一个 multi-agent 的架构。它会遍历你给它的每一个输入 session。所以你要指定一个想让它去 dream 的输入 memory store,再配上一组你觉得可能有助于丰富这个 memory store 的 transcript。它会逐个去看,


[14:53]

one, do again factchecking, enriching with additional details, maybe dates, specific identifiers. Uh and then it will also organize those memory files and see if there's any duplicates, anything that can help uh fix so that when you and it'll produce an output memory store such that in the future when you attach that output to additional sessions, it will hopefully

对每一个做事实核查,用更多细节去丰富,比如日期、具体的标识符。然后它还会整理这些 memory 文件,看看有没有重复、有没有什么可以修正的地方。最终它会产出一个输出 memory store,这样将来你把这个输出挂到别的 session 上时,理想情况下


[15:14]

increase efficiency uh efficiency of like information retrieval. It also hopefully increase the intelligence of the agent. So let's take a look at how this works. Again, switch back to my computer and we'll walk through it together.

能提升信息检索的效率,也但愿能提升 agent 的智能水平。那我们来看看它具体是怎么工作的。还是切回我的电脑,我们一起走一遍。


[15:36]

Uh so what you to to get get started with dreaming basically you'll need to actually create the dream job and I'll go through a little bit of the parameters here. So the model uh here that we're choosing is cloud opus 47.

要开始用 dreaming,基本上你得先创建一个 dream 任务,我来稍微讲一下这里的参数。我们这里选的 model 是 Claude Opus 4.7。


[15:49]

You can choose between opus 47 or sonnet 46 depending on kind of the level of quality you want as well as maybe like token costs. Uh it takes in two inputs. So you'll need the memory store that you want it to dream over as well as a list of session ids. Uh so this is up to you to decide. You can you know maybe dream over daily and dream over maybe like 10 sessions at a time or 20, right? It

你可以在 Opus 4.7 和 Sonnet 4.6 之间选,取决于你想要的质量水平,还有 token 成本之类的考量。它接受两个输入。你需要提供想让它 dream 的那个 memory store,以及一组 session id。这由你来决定。你可以,比如说每天 dream 一次,每次 dream 个 10 个 session,或者 20 个,对吧?


[16:11]

could go you know all the way up to like a 100. We're also looking to scale it further uh beyond that. Uh optionally you can also provide the dream job some additional instructions that you might add. So we provide it with a default prompt that does a bunch of things. If you wanted dreaming to for instance specifically fix a few things like maybe you're working in a domain that requires

它可以一直跑到差不多 100 个。我们也在想办法把它进一步扩展到更大规模。可选地,你还可以给 dream 任务提供一些额外的指令。我们给它配了一个默认的 prompt,会做一堆事情。比如你想让 dreaming 专门修正某几样东西——也许你所在的领域需要


[16:30]

like very specific details right you might ask a dream job to really focus on hey make sure you back fill these details so I remember for the future right you can also get it to you can also steer it to maybe like organize files a bit more like I want this specific structure in my memory store please do that uh so let's actually go and run this command here great we'll get we'll get back a dream

非常具体的细节,对吧——你就可以让 dream 任务重点关注:嘿,务必把这些细节补全,这样我以后还能记得。你也可以引导它,比如把文件整理得更有条理一点,像是「我想要 memory store 里有这种特定的结构,请帮我这么做」。那我们实际去运行一下这条命令。很好,我们会拿到一个 dream


[16:52]

ID and then once Again, I'll go back to our console here. And so dreams are under again manage agents dreams. And once I create the dream job, it'll start p it'll start with pending, but it'll start running pretty shortly after. And you can actually see the status of the job both in console and through the API. I'll show both. But in console here, you'll see the input

ID,然后我再次回到我们的控制台这里。dream 任务在 manage agents 下面的 dreams 里。我一创建好 dream 任务,它一开始会是 pending 状态,但很快就会开始运行。你可以在控制台和通过 API 两边都看到任务的状态,我两个都演示一下。在控制台这里,你会看到输入的


[17:13]

memory store as well as a token count. And generally like uh dream job can take you know depending on the size or the number of transcripts that you give it. It could take anywhere from you know a couple minutes to hours at a time. Uh and that's really the benefit of doing it asynchronously right like this is not something that you want to do live while your agents are working. And we'll just

memory store,以及一个 token 计数。一般来说,一个 dream 任务要花多久,取决于你给它的 transcript 的大小或数量。它可能从几分钟到几个小时不等。这其实就是异步执行的好处所在,对吧——这不是那种你想在 agent 工作的时候实时去做的事。我们就


[17:33]

give it a a minute here to to run. As you can see as it's running as agents or as the harness itself is running we're updating the token count for you so you can track its progress over time. The other really cool thing here is that uh dreaming is actually built directly on top of cloud manage agents primitives.

给它一分钟时间让它跑一跑。如你所见,在它运行的过程中——也就是 agent 或者框架本身运行的时候——我们会帮你实时更新 token 计数,这样你就能随时跟踪它的进度。这里另一个很酷的点是,dreaming 其实是直接构建在 Claude managed agents 的原语之上的。


[17:48]

Uh so you can actually see that we are creating a session for the dream job itself and you can actually click into it see exactly what the dream is doing. Uh this offers a really nice amount of like observability and so you can like diagnose issues potentially. Um and so you can see the prompt that we give it.

所以你能实际看到,我们为 dream 任务本身创建了一个 session,你还可以点进去,看看这个 dream 到底在干什么。这提供了相当不错的可观测性,你甚至有可能借此诊断问题。你也能看到我们给它的那个 prompt。


[18:04]

Uh there's a lot of details here that I'll kind of that you can explore on your own time, but the under the hood, the the dreaming harness itself is launching sub agents to look over all of the transits that you've given it. And each sub agent essentially has a system prompt that tells it what to do. Look over and the orchestrator is responsible for just like making sure all the agents

这里有很多细节,我就大概带过,你可以自己抽空去研究。但在底层,dreaming 框架本身会启动一些 sub agent 去查看你给它的所有 transcript。每个 sub agent 基本上都有一个 system prompt,告诉它该做什么、该看什么,而 orchestrator 负责确保所有 agent


[18:26]

are running and kicking them off as they go. Uh so we'll give it another minute for to let this run. Uh, another thing to call out here is that while uh we don't actually touch the input memory store at all that you create. So this is a non-destructive process. What we actually do is we will clone your input memory store uh into what's called an output memory store.

都在运行,并在它们推进时把它们一个个启动起来。那我们再给它一分钟,让它跑完。这里还有一点要说明:我们其实完全不会去碰你创建的那个输入 memory store。所以这是一个非破坏性的过程。我们实际做的是,把你的输入 memory store 克隆一份,变成一个所谓的输出 memory store。


[19:10]

And the dream job will be writing basically to a new memory store such that any edits that are made are non-destructive. And then we'll see down the line how you can utilize this output memory store in your future sessions.

dream 任务基本上是往一个新的 memory store 里写,这样所做的任何修改都是非破坏性的。然后我们后面会看到,你要怎么在将来的 session 里利用这个输出 memory store。


[19:24]

Generally this takes about a minute or so depending on uh how fast the job runs. Uh, one other thing is that you'll see that I'm sort of checking on the job periodically uh as it's running in console. Uh, when you do this programmatically, we offer an API that allows you to just essentially query uh for the dream job and it'll have a status uh so you can pull for the

一般这大概要花一分钟左右,具体看任务跑得有多快。还有一点,你会看到我在它运行期间,时不时地在控制台上查看任务状态。当你用编程方式来做这件事时,我们提供了一个 API,基本上你只要去查询这个 dream 任务,它就会带有一个状态,这样你就能轮询这个


[19:59]

status. Great. So, looks like it just completed. Um and the cool thing here is that in console we actually show you a diff of what it did. Uh so you can see dreaming here it created an index file. Uh this index file has sort of these slugs that reference the various like memory files that uh a future agent might need. And the main goal of this is really just that future agents uh it's a

状态。很好,看起来它刚刚完成了。这里很酷的一点是,在控制台里我们其实会给你展示它做了什么的 diff。你可以看到 dreaming 在这里创建了一个索引文件。这个索引文件里有这些 slug,指向各种 memory 文件,将来某个 agent 可能会需要它们。这么做的主要目的,其实就是为了让未来的 agent——


[20:24]

lot more efficient to kind of look at an index file and quickly grock like what it needs to go look for instead of maybe doing a a wider GP. Additionally, it's actually adding like additional information that was not present in the in the first couple sessions that I created. So, it's creating this event logistics file. It gives the whole schedule of code with

去看一个索引文件、快速搞清楚自己要找什么,要比去做一次范围更大的 grep 高效得多。另外,它还在添加一些在我最初创建的那几个 session 里并不存在的额外信息。所以它创建了这个 event logistics(活动安排)文件,给出了 Code with


[20:41]

claude. Um, a bunch of names as well. Uh, and again schedule for day two. Uh, and you also see that it actually kind of reformatted the memory file that I created in a previous session. So this time it is adding again a slug, a description of the event, some additional metadata and again adding more details. Um and generally we find that like uh more information actually

Claude 的完整日程。还有一堆人名。同样还有第二天的日程。你还会看到,它其实还把我在之前 session 里创建的那个 memory 文件重新格式化了一下。所以这次它加上了一个 slug、一段活动描述、一些额外的元数据,并再次补充了更多细节。一般来说我们发现,信息更多其实


[21:06]

really does help future sessions. And if you think about intuitively um while an agent's working on a task currently, it's kind of hard to predict down the line what it might need, right? That's just generally a harder prediction problem. So it's actually good to kind of write additional details down that a future agent might remember. And Dreaming can always like go back and

确实能帮到未来的 session。直觉上想一想:当一个 agent 正在处理某个任务时,要预测它将来可能需要什么,其实是挺难的,对吧?这本身就是个更难的预测问题。所以把一些额外的细节写下来、让未来的 agent 能记住,其实是件好事。而 dreaming 随时都可以回头去


[21:23]

like remove stuff that is no longer needed. Uh and if I go to the output memory store here, I'll just click on it. Um again, you can see all the files that I created. It's another good way to sort of see what's going uh what dreaming did. Uh and if you wanted like a human in the loop kind of review process, this is kind of where uh this is super helpful. uh human can kind of go in and

比如把不再需要的东西删掉。如果我到这里的输出 memory store,点开它,你又能看到我创建的所有文件。这也是一个很好的方式,可以看清楚 dreaming 到底干了些什么。如果你想要那种 human in the loop 的审核流程,这个地方就特别有用。人可以进来看一看


[21:47]

see if the dreaming harness made any mistakes. Okay, great. Um just going to switch back to the slides real quick because I want to show a diagram. Um yeah, so again under the hood, this is sort of what how dreaming works, right?

看看 dreaming harness 有没有犯什么错。好,很好。我先快速切回幻灯片,因为我想给大家看一张图。对,所以从底层来看,dreaming 大致就是这样工作的,对吧?


[22:07]

This is a multi- aent harness. uh we have an orchestrator that is mainly responsible for spinning up sub aents and again we spawn one sub aent per input session that you give it. Um and kind of the the reasons behind this are we actually kind of want dreaming to be exhaustive by design. Uh if you give it 100 trans like claude is looking over all the information to make sure it's

这是一个多 agent 的 harness。我们有一个 orchestrator,它主要负责启动各个子 agent,而且我们会为你给它的每一个输入 session 各生成一个子 agent。这么做背后的原因是,我们其实希望 dreaming 在设计上就是穷尽式的。如果你给它 100 段记录,Claude 会把所有信息都过一遍,确保它


[22:29]

not missing anything, right? Um great. So now me let me switch back to my computer again. Uh and this time I'm going to actually like walk through how we might use this in a future session. So uh once the dream uh is done, you can actually go and grab the output memory store using this. So again, we're we're just retrieving the dream resource uh with the dream ID that we created and

没有遗漏任何东西,对吧?好,很好。那现在让我再切回我的电脑。这一次我要实际演示一下,我们将来在某个 session 里可能会怎么用它。所以,一旦 dream 完成了,你就可以用这个去把输出的 memory store 取出来。我们这里就是用之前创建的 dream ID 把 dream 这个资源取回来,


[22:54]

then uh querying or just grabbing the the JSON memory store ID. Great. So this is the memory store and again you can look through what memories it created. Uh and now we'll do this sort of test again that we did before with the two sessions. So I will create a new session here and you'll notice that this is now using the output memory store from dreaming.

然后查询、或者说直接拿到那个 JSON memory store ID。很好。这就是 memory store,你又可以翻一翻它创建了哪些 memory。现在我们再做一遍之前用两个 session 做过的那个测试。所以我会在这里新建一个 session,你会注意到,它现在用的是 dreaming 产出的那个输出 memory store。


[23:30]

Once again we'll send it an event here. We're just asking it what sessions I attended, what resources do I have links for, and what follow-ups I flag. Once again, going back to the console, it's really a great way to, you know, visualize what's going on here.

我们再给它发一个 event。我们就是问它:我参加了哪些 session、我有哪些资源的链接、以及我标记了哪些需要跟进的事项。再一次,回到 console,这真的是一个很棒的方式,能让你直观看到这里到底发生了什么。


[24:00]

And you'll see that this time when it's reading from memory, you'll see all the stuff that Dreaming did, right? So, the index, the event logistics, and it's now reading kind of it's starting to read the index first.

你会看到这一次它从 memory 里读取的时候,能看到 Dreaming 做的所有东西,对吧?所以有索引、有 event 的后勤安排,而它现在是先开始读索引。


[24:17]

Okay, great. Now it knows I'm going to go straight to the sessions file. It's being a little exhaustive here. Just checking for, you know, event logistics. Okay, great. Let's see what it came up with. So, as you can see, I I'd have to go back and show you the the previous session, but this time I think there's a lot actually a lot more information here. So, it gave me a recap of all the

好,很好。现在它知道了,我直接去 sessions 文件这边。它在这里有点穷尽式地查,只是核对一下 event 的后勤安排。好,很好。我们看看它给出了什么结果。如你所见,我得回头给你看一下之前那个 session 才好对比,不过这一次我觉得这里的信息其实多了不少。它给了我一个回顾,把所有


[24:53]

sessions I I attended. Uh, it's giving me timestamps now about like all the sessions that were that were planned for day two as well as like the resource links, right? I think this kind of showcases again like how dreaming can really enrich information that is transferred between sessions.

我参加过的 session 都列了出来。它现在还给我加上了时间戳,告诉我第二天安排了哪些 session,以及对应的资源链接,对吧?我觉得这又一次很好地展示了 dreaming 是怎么真正丰富那些在 session 之间传递的信息的。


[25:11]

And then optionally um at the end you know if you're really happy with the output memory store here you can go ahead and actually retire the old memory store. Um so this won't affect like your previous sessions. It just means that you no long it will it will keep you the number of memory stores in your organization down to a reasonable level.

然后是可选的一步,在最后,如果你对这里的输出 memory store 真的很满意,你可以去把旧的 memory store 退役掉。这不会影响你之前的那些 session,只是能把你组织里 memory store 的数量控制在一个合理的水平。


[25:31]

Um great. So I'm going to kind of switch back to the slides here and talk a little bit how you can kind of view sessions, memory stores, and dreaming as three composable layers here, right? If you think of a session as a as an isolated instance of an agent running, uh it's one usually typically one conversation thread, typically ephemeral, right? A memory store

好,很好。那我切回幻灯片,稍微讲讲你可以怎么把 session、memory store 和 dreaming 看成三个可组合的层次,对吧?如果你把一个 session 看成是一个 agent 运行的独立实例,它通常就是一个对话线程,一般来说是临时性的,对吧?而 memory store


[25:56]

augments that. So now you can connect information between your sessions across multiple sessions, right? And then finally with dreaming uh you're now organizing, enriching and improving your memory stores over time so that as you scale up the number of sessions you have and as you scale up the information that it's being processed through those sessions, your memory stays at a

则是对它的增强。这样一来,你就可以把信息在你的多个 session 之间连接起来,跨多个 session,对吧?最后,有了 dreaming,你现在就能随着时间不断地组织、丰富并改进你的 memory store,这样当你的 session 数量越来越多、需要在这些 session 中处理的信息越来越多时,你的 memory 仍然能保持在一个


[26:18]

reasonable level. It's manageable. It doesn't blow up. Also, it checks for things like staleness to make sure all the information is most is up to date, right? I wanted to highlight some of the maybe good questions that I got from the audience here. So one of them was around uh generally like sort of what is the like token usage of this feature like?

合理的水平。它是可管理的,不会爆掉。同时它还会检查诸如信息过期之类的问题,确保所有信息都是最新的,对吧?我想挑几个我从现场观众那里得到的不错的问题来讲讲。其中一个大概是问:总体上这个功能的 token 使用量大概是多少?


[26:35]

Um so as I said before like I think by design we actually do want it to be exhaustive. So we do expect it to use a lot of tokens. Um the the nice thing here is that because most of the processing is agentic uh most of the tokens are actually cached. So we're expecting like about a 95% cash rate cash hit rate on um like most dream sessions right and additionally we are

我前面说过,我觉得我们在设计上就是希望它是穷尽式的。所以我们确实预期它会用掉很多 token。好在因为大部分处理都是 agentic 的,所以大部分 token 其实是被缓存的。我们预期在大多数 dream session 上,缓存命中率(cache hit rate)能达到 95% 左右,对吧?另外我们还在


[26:58]

exploring like other ways of offering this at lower costs to you. So uh example of this would be like similar to our batch API we could offer things at a 50% discount by scheduling it at different times. Uh other additional like token usage controls include like switching the model, steering the prompt a little bit more, also providing more like just general budgeting of tokens.

探索一些其他方式,以更低的成本把这个功能提供给你。比如说,类似我们的 batch API,我们可以通过在不同时间调度任务来提供 50% 的折扣。其他额外的 token 使用控制手段还包括切换模型、对 prompt 做更多的引导,以及提供更通用的 token 预算控制。


[27:22]

Um great. Um so I think we're just about winding down. So I'm going to quickly kind of go over again for the folks remaining in the room uh like what we went over today. Uh so again we talked about the problem that most agents face today which is like how do you remember information across sessions? I think this is a pretty like wellestablished kind of problem now. And we talked about

好,很好。我想我们差不多要收尾了。所以我快速地、给还留在会场里的各位再过一遍我们今天讲的内容。我们讲了如今大多数 agent 面临的问题,也就是:怎么在多个 session 之间记住信息?我觉得这现在已经是一个相当公认的问题了。然后我们讲了


[27:49]

how memory is kind of the first step to addressing this right you give agents access to something where they can dump the information read from it etc. Uh but we also saw how this creates a problem where memory stores are can grow unbounded over time. They can grow disorganized information can grow stale etc. And then we saw how dreaming can be used as a way to mitigate this problem.

memory 是解决这个问题的第一步,对吧?你给 agent 一个地方,让它可以把信息倒进去、再从里面读出来,等等。但我们也看到这又带来了一个问题:memory store 会随着时间无限增长。它们会变得杂乱无章,信息会过期,等等。接着我们看到 dreaming 可以怎样被用来缓解这个问题。


[28:09]

Right? So we we take another set of agents that their entire job is to improve that memory store for future use. Um and with that I'd like to thank everyone for for coming to today's workshop. Um hopefully it was helpful and hopefully by the end you'll learn how to uh you'll know how to like integrate maybe memory into your own use cases.

对吧?所以我们再启用一组 agent,它们唯一的任务就是改进那个 memory store,供将来使用。那么到这里,我要感谢大家来参加今天的 workshop。希望对你们有帮助,也希望到最后你们能学会怎么把 memory 集成到你们自己的使用场景里。