# The 0 / 5 / 20 incident learning curve: watching an agent get better without retraining

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

The 0 / 5 / 20 incident learning curve: watching an agent get better without retraining

“It learns over time” is the most common claim made about AI agents with memory, and the hardest one to show. You can’t just say it. You have to run the same question at different points in the agent’s life and put the answers side by side. That’s what I did with DejaVu, an incident-response agent that remembers past incidents and which fixes worked. Same alert, same model, same code; the only thing that changes is how much history is in memory. This article walks through the three answers and how the experiment is built. Repo: https://github.com/cybersleuth25/Deja-Vu

“它会随着时间推移而学习”是关于具有记忆功能的 AI 智能体最常见的说法,也是最难证明的一点。你不能只是说说而已。你必须在智能体生命周期的不同阶段提出相同的问题,并将答案进行对比。我通过 DejaVu 做了这个实验,这是一个能够记录过往事故及有效修复方案的事故响应智能体。相同的警报、相同的模型、相同的代码;唯一改变的是内存中历史记录的数量。本文将介绍这三个答案以及实验的构建方式。代码仓库:https://github.com/cybersleuth25/Deja-Vu

The question: The alert is the same every time: Checkout 500s: DB connection pool exhausted (payments-api). It’s a good test case because the “obvious” fix, restarting the connection pool, is the one that keeps failing for this team. An agent that learns should stop recommending it.

问题:每次警报内容都相同:Checkout 500s: DB connection pool exhausted (payments-api)。这是一个很好的测试案例,因为“显而易见”的修复方法——重启连接池——正是该团队一直失败的方法。一个会学习的智能体应该停止推荐它。

0 incidents: the generic answer. With an empty memory, the agent can only fall back to standard advice: Do first: Restart connection pool (generic); Restart service (generic); Increase pool size (generic). Avoid: none. No similar incidents in memory. This is the “before” picture. It’s what you’d get from any chatbot, and its first suggestion is precisely the one that has never worked here.

0 起事故:通用答案。在内存为空的情况下,智能体只能退回到标准建议:首先执行:重启连接池(通用);重启服务(通用);增加连接池大小(通用)。避免:无。内存中没有类似事故。这是“之前”的情况。这是你从任何聊天机器人那里都能得到的答案,而它的第一个建议恰恰是这里从未奏效过的方法。

5 incidents: the first match. After the five oldest incidents are in memory, one of them is a DB pool outage: Matched: INC-0004. Do first: Roll back pool config (1/1). Avoid: Restart connection pool (failed 1/1). The change “Tidy db config” touched db/pool.py 3h ago; a change to the same files preceded INC-0004. One past incident is already enough to flip the advice. The agent now leads with the rollback, warns against the restart, and notices that a recent change to the same file came before the last outage too. With a single data point, “1/1” is a hint rather than proof, and the answer shows the count so the engineer can judge that.

5 起事故:首次匹配。当内存中存入最早的五起事故后,其中一起是数据库连接池中断:匹配项:INC-0004。首先执行:回滚连接池配置 (1/1)。避免:重启连接池(失败 1/1)。“Tidy db config”这一变更在 3 小时前触及了 db/pool.py;对相同文件的变更也曾出现在 INC-0004 之前。仅凭一起过往事故就足以改变建议。智能体现在优先推荐回滚,警告不要重启,并注意到最近对同一文件的更改也发生在上次中断之前。由于只有一个数据点,“1/1”更像是一种提示而非证据,答案中显示了计数,以便工程师进行判断。

20 incidents: a track record. With the first 20 incidents in memory: Matched: INC-0004, INC-0009, INC-0014, INC-0020. Do first: Roll back pool config (3/4); Patch connection leak (1/1). Avoid: Restart connection pool (failed 4/4). This outage on payments-api matches 4 past incidents… Roll back pool config worked 3 of 4 times; Restart connection pool failed 4 of 4. Now it’s a track record. The restart has failed four times out of four. The rollback worked three times out of four, and the one time it didn’t, the cause was a connection leak, which is why “Patch connection leak” now appears as a second option. That’s the kind of nuance an engineer only gets from someone who was there for all four outages. Nothing was retrained between these runs. The model is the same at 0, 5 and 20. Only the memory grew.

20 起事故:成功记录。当内存中存入前 20 起事故后:匹配项:INC-0004, INC-0009, INC-0014, INC-0020。首先执行:回滚连接池配置 (3/4);修补连接泄漏 (1/1)。避免:重启连接池(失败 4/4)。这次 payments-api 的中断匹配了 4 起过往事故……回滚连接池配置在 4 次中有 3 次奏效;重启连接池 4 次全部失败。现在这成了成功记录。重启操作四次全部失败。回滚操作四次中有三次奏效,而唯一一次失败的原因是连接泄漏,这就是为什么“修补连接泄漏”现在作为第二个选项出现。这种细微差别只有经历过全部四次中断的人才能体会。在这些运行之间没有进行任何重训练。模型在 0、5 和 20 次时完全相同。只有内存增加了。

How the experiment works: The script sorts the incident history by date and replays it in windows: the first 0, then the first 5, then the first 20. For each window it asks the agent the same question. Two details keep the experiment honest: Time order. The windows follow the real order of the incidents, so at “5 incidents” the agent only knows what the team would have known at that point. The live run uses the real memory. With —live, recall goes to the actual Hindsight bank. A thin wrapper drops any recalled incident outside the current window, so the agent can’t peek at the future even though the bank holds everything. The LLM is switched off for this run (llm=None), so the text comes from a fixed template. That’s on purpose: if the answer changes, it’s because the memory changed, not because the model phrased something differently.

实验原理:脚本按日期对事故历史进行排序,并以窗口形式重放:前 0 个,然后是前 5 个,最后是前 20 个。对于每个窗口,它都会向智能体提出相同的问题。两个细节保证了实验的真实性:时间顺序。窗口遵循事故发生的真实顺序,因此在“5 起事故”时,智能体只知道团队当时所掌握的信息。实时运行使用真实内存。使用 —live 参数时,召回操作会访问实际的 Hindsight 数据库。一个轻量级封装会丢弃当前窗口之外的任何已召回事故,因此即使数据库中存有所有信息,智能体也无法窥探未来。本次运行关闭了 LLM (llm=None),因此文本来自固定模板。这是故意的:如果答案发生变化,那是因为内存发生了变化,而不是因为模型措辞不同。

What “getting better” means here: Looking at the three answers, the improvement is concrete. And it keeps going after that. In the live app, every time an engineer clicks Worked or Failed on an action, the verdict is retained into Hindsight memory, and the next similar alert includes it. The learning curve doesn’t stop at 20; it’s what happens every time someone records an outcome.

这里所谓的“变好”意味着什么:观察这三个答案,改进是具体的。而且在此之后它还会继续。在实时应用中,每当工程师对某个操作点击“奏效”或“失败”时,该结论就会被保留到 Hindsight 内存中,下一次类似的警报就会包含该信息。学习曲线不会在 20 次时停止;每当有人记录结果时,它都会持续增长。

Limitations: The history is synthetic and clean. The 32 incidents were written for this project, with patterns planted on purpose. Real histories are messier, so a real curve would rise more slowly. It depends on people recording outcomes. If nobody clicks Worked or Failed, there’s no track record to learn from. One question, one curve. The experiment uses a single alert type. Other incident types improve too, but I only built the side-by-side for this one.

局限性:历史记录是合成且整洁的。这 32 起事故是为本项目编写的,其中特意植入了模式。真实的历史记录会更混乱,因此真实的曲线增长会更慢。它依赖于人们记录结果。如果没有人点击“奏效”或“失败”,就没有可供学习的记录。一个问题,一条曲线。该实验仅使用了一种警报类型。其他类型的事故也会有所改善,但我只为这一种类型制作了对比展示。

Takeaway: If you claim your agent learns, show the curve: same question, growing memory, answers side by side. For DejaVu, the jump from “restart the pool” to “restarting the pool failed 4 of 4, roll back the config instead” is the whole product in one table, and it happened without retraining anything.

总结:如果你声称你的智能体在学习,请展示曲线:相同的问题、不断增长的内存、并排的答案。对于 DejaVu 来说,从“重启连接池”到“重启连接池 4 次全部失败,改为回滚配置”的跨越,就是整个产品的核心价值,而且这一切无需任何重训练即可实现。