Brainbase 如何把 Domino’s 比价 智能体 的准确率从 41% 提升到 97%
原题How We Took an AI Agent From 41% to 97% Accurate - Milind Sunil Shah, Brainbase Labs
看前速览
Brainbase 展示如何通过明确规则、保留证据和反复评估,改进 Domino’s 的竞品比价 智能体。
先定义任务,再扩大范围
明确结账价、配送选项和分析师的验收标准,再上线一小段可衡量的流程。
把生产失败转为评估用例
截图、确定性检查和轨迹复核,有助于区分定价错误、导航问题和验证问题。
交付持续改进的闭环
系统初步部署后,客户可以审查异常并把纠正记录纳入基准用例。
完整摘要
Milind Sunil Shah 介绍了改进 Domino’s 本地竞品比价 智能体 的六步流程。团队先与分析师约定验收标准,定义商品、优惠与配送方式,再从单个城市、单款商品和单个应用起步。历史外卖应用的数据难以重放,团队便保留浏览器截图构造评估用例。他区分了确定性校验、用语言模型检查轨迹,以及让 智能体 复查被标记的价格。两个实际案例说明,智能体 应查看链接之外的同一页面,也应先检查 DOM,再决定是否放大促销图片。据讲者报告,从第一版到第十一版,准确率从 41% 升到 97%,单来源成本由 2 美元降至 1 美元,运行时间从 129 分钟降到 71 分钟。分析师现在只需审查异常,并把纠正记录补入基准用例。
章节
文字稿
简要描述Brief Description
Milind Sunil Shah 介绍了 Brainbase 如何为 Domino’s 迭代开发竞品定价智能体:从明确工作目标、测试精简原型,到移交评估闭环。Milind Sunil Shah explains how Brainbase iterated on a competitor-pricing agent for Domino’s, from defining the job and testing a narrow prototype to handing off the evaluation loop.
目录Table of Contents
- 简介Intro
- 达美乐的定价问题The Domino's pricing problem
- 从 41% 提升至 97%From 41% to 97%
- 六步框架The six-step framework
-
- Kickoff: agree on the win
-
- Ontology: define every term
-
- Benchmarks and evals
-
- Ship a narrow first agent
-
- Iterate: score, fix, ship
- 修复:链接下方的交易Fix: the deal below the link
- 修复:缩放图片后卡住不动Fix: stuck zooming into images
-
- Hand off the whole loop
简介Intro
大家好,我是 Milind,Brainbase 的 MTS。我们帮助企业大规模部署和管理内部智能体。今天我想聊聊如何通过爬山式优化改进后台智能体,以及我们如何与一位客户成功做到这一点。Hey, so I'm Milind, MTS at Brainbase. We help enterprises deploy internal agents at scale and manage them. Today I'm going to be talking about hill climbing back office agents and how we did that successfully with a customer.
达美乐的定价问题The Domino's pricing problem
所以,接下来我会一直谈到的这个案例中的客户,以及我们反复使用的那个著名本地视频,都是达美乐。大家都知道,他们有两万多家门店,业务覆盖 90 多个市场。我们最初从一个地区开始,与他们的首席营销官办公室合作。我们想回答一个他们反复提出的问题:街对面竞争对手那里的披萨多少钱?在他们的外卖应用里多少钱?在他们的官方网站上,使用促销优惠和不使用促销优惠时又分别多少钱?诸如此类。他们最终想要的是一份电子表格,列出各种商品所能找到的最低价格。在我们为他们构建智能体之前,他们一直由一位分析师手动完成这些步骤。单独来看,这些步骤都很简单:打开竞争对手的网站,选对门店,比较配送和自取的价格,找到合适的促销优惠,再找出最低价,最后把所有信息记到电子表格里。So yeah, our customer in this case I'm going going to be talking about throughout and like the famous local video we use repeatedly is is is Domino's. As you all know, they have 20 plus thousand stores, 90 plus markets. We started off with a single region with their CMO office. We wanted to answer this question that they kept asking. What does a pizza cost at the competitor down the street? What does it cost in their delivery app? What does it cost on their actual website with promos, without promos, things like that. They essentially wanted a spreadsheet at the end with the lowest price possible for a bunch of different items. Before we built the agent for them, they had an analyst manually doing these steps. They all look easy in isolation. You open a competitor's website, pick the right store, compare prices with delivery, takeaway, find the right promos, find the cheapest price and write it all down into a spreadsheet.
这一切看起来都挺简单,但只要其中一个步骤出错,最后你就会得到一个看似已经完成、实际上却有问题的单元格。我们不得不构建一个能做同样事情的智能体:读取一堆条目,找到网站,解读价格,填写电子表格,把结果交给另一个智能体,并标记它认为不确定的内容。It all looks easy enough, but if you get one of these steps wrong, you look like you get a cell at the end that looks finished, but it's just wrong. We had to build an agent that does the same. Reads a bunch of items, finds the website, interprets prices, fills the spreadsheets, hands it off to an agent, and flags anything that it thinks it's not sure of.
从 41% 到 97%From 41% to 97%
我们为他们创建这个智能体的第一个版本时,准确率是 41%。到第 11 个版本时,准确率达到了 97%。每个来源的成本——也就是每个竞争对手网站的每个条目的成本——从 2 美元降到了 1 美元。每次运行所需的时间也从 129 分钟降到了 71 分钟。所有这些变化,都只是通过调整指令、技能和操作手册实现的。When we created version one of this agent for them, we had 41% accuracy. By the end at version 11, we had 97% accuracy. Our cost per source means per item per per competitor per website went from $2 per source to $1 per source. And the amount of minutes it took per run went from 129 to 71. All of this went just with just just instructions and skills and playbooks changing.
六步框架The six-step framework
以下是我们采用的六个步骤,不仅适用于 Domino's,也适用于其他客户。我们从项目启动开始,接着是资料汇编、基准测试、首个智能体、迭代,最后交接。我会详细介绍这些步骤的含义,以及我们在每个步骤中为 Domino's 做了什么。希望这也能成为一个可重复使用的框架,供你们在内部采用。Here is like the six steps that we use, not just with Domino's, but with other customers as well. We start off with kickoff, followed by anthology, benchmarks, first agent, iterating, and handing off. I'll talk about what these steps mean in detail and what we did for Domino's in each of these and hopefully it's a repeatable framework that y'all can use internally as well.
1. 启动会议:就成功标准达成一致1. Kickoff: agree on the win
所以,第一步是启动阶段。理想情况下,你应该和客户或最终用户沟通,并就成功的标准达成一致。目前,这项工作的具体内容是什么?最终由人类审核并批准的成果是什么?需要多长时间?成本是多少?你的智能体需要达到多高的准确度?由谁来评判输出?智能体绝不能独自做什么?它绝不能做出哪些假设?对于达美乐,我们最终制定了一份对我们很有帮助的简报。最终,我们的目标是找到一种更快速、可重复的方式来收集本地竞争对手的定价信息,同时保留处理边缘情况所需的判断力。所以,我们向他们提出了所有这些问题。目前,分析师会制作一份电子表格,然后由定价团队对其进行分析。一名分析师每天要花两小时,手动、主动地制作这份电子表格。So, step one is kickoff. You should ideally talk to your customer or end user and agree on what the win looks like. As of today, what is the job? What did the human sign off on at the end of it? How long does it take? How much does it cost? How accurate does your agent need to be? Who judges the output? And what must the agent never do alone? What assumptions should it never make? For Domino's, we ended up creating this brief that worked really well for us. Our outcome at the end had to be a faster, repeatable way to collect local competitor pricing without losing the judgment edge cases need. So, we asked them uh all of these questions. As of today, the analysts create a spreadsheet and the pricing team uh find finally analyzes it. An analyst spent 2 hours daily manually actively working on creating the spreadsheet.
随后,每个单元格都经过检查并得到确认,最后,智能体只需请分析师签字确认,并标出其他需要处理的事项。我们的量化胜利,似乎就是尽可能提高准确率、尽可能降低数据源成本、尽可能缩短运行时间;而在我们开始之前,他们甚至不确定我们能否完成这项折扣搜索。Every cell was then checked and just confirmed and the agent at the end just had to ask for the analyst for sign off and flag anything else it had to. Our win in numbers looked like just having the highest accuracy, the lowest cost of sources possible, run time to be as low as possible, and before we even started, they weren't even sure if we can do this discount search at all.
2. 本体:定义每个术语2. Ontology: define every term
第二步是构建本体。具体是什么意思?我们会尽量把智能体需要了解的所有术语都写下来,避免它自行假设。这意味着我们需要明确告诉智能体:它应该收集什么、每个答案来自哪里、要存到哪里、每个术语对实际手动处理工作的分析师来说是什么意思,以及遇到无法判断的情况时应该怎么做。如果说这里有一个关键要点,那就是每个术语最好都有定义。如果你不把某些内容写下来,智能体就会自行猜测,而且很可能猜错。以 Domino's 为例,具体做法是这样的:我们 Brainbase 有自己的记忆原语,它拥有类似 Postgres 数据库的记忆,智能体可以随意使用。我们给它设定了一个目标表,并把所有项目都交给了它。Step two is anthology. What does that exactly mean? We try to write down all the terms that the agent needs to know to never make assumptions, which means we need to tell the agent exactly what it's supposed to collect, where each answer comes from, where does it go, what does each term mean to the analysts that actually do the work manually, and what should the agent do when it can't figure something out. If if there's one jewel here, it is that every term should ideally have a definition. If you don't write something down, the agent's going to guess and probably get something wrong. For Domino's, here's what it looked like. We at Brainbase have a memory primitive of our own that has memory that looks like a Postgres database that the agent can do whatever it wants with. We gave it a target stable where we gave it up all the items.
在这个例子中,我们来看看编号 14。编号 14 对应品牌 B,是一份大号披萨。呃,外带方式是——抱歉,是配送,而且是在 B 应用上。假设代理使用浏览器,在网站上找到价格,发现价格是 24 和 19。24 是划掉的原价,19 是促销价。我们现在还有一个规则文件,明确要求代理特别记录用户结账时实际支付的价格,而不是 24。这是从一次有效的失败案例中总结出来的。最后保存的数据是:我们又创建了一个名为「价格观察」的表格,其中按对应编号记录了它看到的价格、原价以及实际来源。最后,我们给它一个电子表格,里面包含所有占位商品编号;它要做的就是查找编号并替换价格。如果某个单元格有误,它会指出具体页面,以及它选择该价格所依据的规则。In this case, let's look at ID number 14. ID 14 is brand B. It's a large pizza. Uh takeaway method is Sorry, it's delivery and on app B. The agent hypothetically does browser use, finds the price on the website, finds that it's 24 and 19. 24 is the striked out price, 19 is the sale price. We also now have a rules file where we actually tell the agent to specifically mark down the price that it that a user pays at checkout, not 24. This came from like a valid failure. What it saves at the end, we created a table again called price observations where it with the corresponding ID stores what price it saw, what the full price was, and the actual source. And at the end, we give it a spreadsheet that has all placeholder item IDs, and all it has to do is look up the ID and replace the price. When a cell is wrong, it points to the exact page and the rule behind why it chose the selected price.
我们从实际使用记录中总结出的其他规则包括:明确什么算大号披萨。无论是单品还是套餐,都属于大号披萨。外送不等于自取,之前把两者混淆了。系统应该计算促销折扣:如果价格打七折,应先计算折后价,再录入电子表格。如果无法核实,就把它记为待确认项,不要猜测。Other rules that we mentioned that came through actual life traces were definition of what a large pizza looks like. It's anything that's actually the item itself or a bundle. Delivery is not equal to takeaway. It got confused with that. It's supposed to do promotion math. If it's 30% off the price, it should do that before entering it in the spreadsheet. And if it can't verify it, write it down as a gap and do not guess.
3. 基准测试与评估3. Benchmarks and evals
第三步是找出基准测试和评估方式。现在,这些步骤可以稍微灵活调整,但本质上,你要弄清楚哪些内容可以用于离线评估,哪些可以用于在线评估。对于离线评估,理想情况下,你应该先问他们是否有现成的历史案例和对应答案。在这个例子中,我们有来自 Domino’s 的分析师,他们手头有之前处理过的电子表格。我们能否重新运行这些输入案例,并得到相同的最终输出?最后,你要如何确定该如何为智能体执行的每一项操作打分?对于评估,你要弄清楚哪些内容可以用确定性方式检查,哪些可以交由 LM 作为评判者来检查,哪些可以交由智能体作为评判者来检查。我们认为这是一种稍微独特的理念:如果存在输出产物,你可能会希望智能体进行多轮交互、调用多个工具,以判断该产物有多准确。Step three is finding out benchmarks and emails. Now Now, these steps can be interchangeable slightly, but essentially you're trying to figure out what you can run offline emails on and what you can run online emails on. For offline emails, you should ideally start off by asking them if they have past cases that they already have answers for. In this case, we had analysts from Domino's who had spreadsheets that they had worked on. Can we actually rerun those um input cases to get the same final output? And then at the end, how do you figure out how to score each thing that the agent is doing? For evals, you try to figure out what you can check deterministically, what you can check why an LM as a judge, and what you can check as an agent as a judge. That's a concept that we think is slightly more unique, where if there's an output artifact, you probably want an agent to take multiple turns, multiple tool calls to figure out how correct that artifact is.
最后,如果出了问题会发生什么?如果某项被标记了,又会发生什么?你应该尽可能多地用这三项来打分。嗯,在 Domino’s,我们的基准测试最初基本上是从他们所有的电子表格开始的。我们尝试通过访问 archive.org,获取竞争对手网站在指定日期的快照,来构建输入环境。我们发现,这种方法不适用于外卖应用,因为它们提供数据的方式不一样。于是,从 agent 的第一个版本开始,我们就把它执行的所有操作都保存为浏览器截图,并以此构建内部基准测试环境。至于评测,我们会用代码检查一些事项,例如每个 ID 单元格是否都被替换成了价格、折扣映射是否计算正确、价格与上一次运行相比是否在正负 20% 的范围内,以及是否被标记。And at the end, what happens when something goes wrong, and what happens when it's flagged? You should try to score as many things as you can with these three things. So, yeah, at Domino's, our benchmark essentially started off with all the spreadsheets that they had. We tried to create the input environment by going to archive.org and having snapshots of competitor websites at those given dates. What we saw that it was that it didn't work with delivery apps because they didn't serve data the same way. So, we ended up storing browser screenshots for everything the agent was doing starting from version one of the agent, and that's how we create up our environment for the internal benchmark. For evals, we use code for things like checking if every ID cell was replaced with the price, if the discount map was computed correctly, if the price was 20% plus or minus compared to the previous run, was it flagged or not.
LM 作为评判器,只会检查操作轨迹,确认是否选中了正确的商品,以及是否应用了正确的促销。Agent 作为评判器则会逐一查看所有被标记的价格,并实际确认这些标记是否有效。最后,分析师会查看最终的标记,并尝试找出出错的原因。LM as a judge just checks the trace to see if the right item was selected, and if the right promo was applied. Agent as a judge actually goes to every flagged price and actually confirms if the flag was valid or not. And the analyst at the end will go look at the final flags and try to figure out what the reason for it was if something went wrong.
4. 推出一个范围明确的首个智能体4. Ship a narrow first agent
第四步实际上是推出某个版本的首个智能体。理想情况下,你应该在自己的技术栈中推出一个范围较窄的首个智能体,从第一天起就能对它进行评分。你可能需要先弄清楚,值得评分的最小功能范围是什么;还要确定准确度应该达到多少,以及耗时应该控制在多久。你应该用这个智能体来弄清楚它需要运行多久、成本是多少、会在哪些地方出错,诸如此类。第一个版本的任务是接受评估,而不是表现出色。等你有了一个他们希望达到的基准分数后,再扩大范围。就像我之前提到的,对 Domino's 来说,我们的第一个版本只有 41% 的正确率,耗时超过两小时,每个来源要花 2 美元,而且运行得很不理想。我们发现了一些可以改进的地方,做了修复,然后不断改进并扩大了范围。Step four is actually shipping some version of a first agent. You should ideally ship a narrow first agent in your stack that you can score from from day one. You should probably figure out what the smallest slice worth scoring is. You should figure out how accurate things should be, how long and you should use this agent to figure out how long does it run take, what does it cost, what does it get wrong, and things like that. Version one's job is to be measured, it's not to be good. You should widen the scope uh widen the scope after you get some baseline score they're trying to meet. For Domino's, as like I mentioned earlier, version one for us was just 41% correct. It took more than 2 hours. It was $2 per source. And it just wasn't working well. We found a bunch of changes, made fixes, and then improved and increased the scope.
所以,我们最初只有一个应用,在一个城市里提供一项商品。后来又增加了汉堡和外卖选项,接着增加了另一个应用,最后还扩展到了其他网站。对我们来说,从小规模、范围有限的项目起步,确实很有帮助,让我们弄清楚该如何解决问题。So, we started off with just one app, one item in one city. Moved on to adding burgers and takeaway options. Moved on to adding another app, and finally other websites as well. So, starting off small narrow scope worked out really well for us to figure out how we can fix things.
5. 迭代:评分、修复、发布5. Iterate: score, fix, ship
第五步就是不断迭代。你应该进行评分、修复,然后发布。接下来你要做的就是第二、第三和第四步。持续迭代,完善你的案例集、邮件和基准测试,直到找到有效的方法。你应该找出代价最高、出现最频繁的失败,修复它们,并确定应该采用哪些改动来解决问题。如果这些改动会增加运行时间或成本,你是否可以接受?你又该如何利用这些失败来创建基准测试案例,或将其纳入评估标准?理想情况下,一次只改一件事;在考虑彻底更换模型之前,先修改指令。在达美乐,我们重点介绍了两个例子。在讲这两个例子之前,先来看一张图,展示我们的进展过程。我们最初的得分是 41%。嗯,每个来源的成本超过 2 美元。Step five is to just iterate. You should score, fix, and ship. Here is where you'll do steps two, three, and four. Keep iterating, improving your anthology, improving your emails, your benchmarks to get things that work. You should figure out which failures are most expensive, most frequent, fix them, what changes should be used to fix them. If that change results in increased run time or cost, if yes, are you okay with that increased run time and cost? And how can you use those failures to create and add to your benchmark cases or eval criteria? Ideally, change one thing at a time and fix the instructions before you want to change the model entirely. At Domino's, we highlighted two examples. Before I get to that, here is a graph of how our progression went. We one started off at 41%. Um more than $2 a source.
经过一系列改动后,我们11,每个来源收费1美元,准确率为97%。We 11 after a bunch of changes, it's $1 a source, and 97% accurate.
修复:链接下方的交易Fix: the deal below the link
嗯,是的。下面是一个非常简单的规则修改示例。我们给代理提供了一个链接,让它查找 B 品牌的一份大号披萨,通过该品牌自营网站配送。它打开了链接,链接中的相关版块已经高亮显示。它点击该版块,找到了大号披萨和价格,然后就停下了。分析人员发现,最后有人手动注意到,同一页面下方其实还有一项优惠,价格只要 21 美元,但代理漏掉了,对吧?所以,我们只需要添加一条简单的规则:不要只查看链接直接跳转到的版块,而是要查看整个页面。这样一个简单的改动就帮我们发现了这个问题,并确保它不会再次发生。So, yeah. Here's an example of a very simple rule change that we made. We gave the agent a link of a large pizza to find for brand B. Via delivery on its own website. It went to the link which had the section already highlighted. It clicked on it, found the large pizza, found the price, and ended there. The analyst got that somebody manually caught at the end that there was actually a deal below that website below on the same page, that was just $21 instead, and it missed that, right? So, all we had to do there was add a simple rule to not stop at the section that it gets linked to, but actually look at the entire page. And a simple change like that helped us just like catch this and then make sure it doesn't happen again.
修复:缩放图片后无法退出放大状态Fix: stuck zooming into images
另一个我们不得不做的、更复杂的改动,实际上涉及代理的浏览器使用行为。在其中一次运行中,我们发现,品牌 D(这是一个品牌)促销页面上的所有促销价格都嵌在图片里,因此并未被实际识别为文本。代理所做的是查看全部 26 张促销图片,寻找它要找的商品。它又把这些图片放大到 4 倍、5 倍、6 倍查看。它在第 13 分钟找到了正确的卡片,但仍然继续放大,以便再次检查和确认,结果陷入了循环,我们不得不在第 15 分钟手动停止它。手动查看运行记录和网站后,我们意识到 HTML DOM 实际上非常重要,本可以帮代理省下大量工作。因此,我们在最新的规则中告诉代理,先查看 HTML DOM,查看图片标题、所有文本等内容,然后再查看图片本身,并且在达到一定缩放级别后就停止放大。Another more intricate change that we had to make was actually browser use behavior of set agent. So, in one of the runs, we saw that for brand D this is a brand called brand D promotions page, where all the promotion prices were inside images, so not actually captured in text. What the agent did is it looked at all 26 promo images to find the item it was looking for. It looked them looked at them again by zooming in 4x, 5x, 6x. It found the right card at minute 13, but it still kept zooming to double-check and verify, and it was just in a loop, and we had to manually stop it at minute 15. We realized after manually looking at the trace and the website, that the HTML DOM is actually super important and could have saved the agent a lot of work here. So, we tell the agent in our latest rules to go look at the HTML DOM first, look at things like image titles, all text before looking at the actual image rates, and just stopping past a certain zoom level.
结果是,图像请求次数降到了原来的三分之一,成本降低了 50% 以上,而且我们终于得到了明确的答案和一份完整的报告。因此,虽然我们有自动化检查和评估标准来帮助发现很多问题,但有些问题还是需要工程师实际查看追踪记录和浏览器中的工具调用,看看究竟哪里出了错。所以,我们做了不少这样的改动,迭代到了 V11,准确率达到 97%,现在要做的就是想想:接下来该做什么?What that resulted in is is 1/3 the number of image rates, reducing cost by over 50%, and just us getting an actual answer and a finished report. So, while we have automated checks and eval criteria to help us catch a lot of things, some things require our engineers to actually look at traces and browser on use tool calls and just see what went wrong. So, yeah, we made a bunch of these changes, got to V11, got to 97% accuracy, and now it's just figuring out, hey, like like what next?
6. 移交整个闭环6. Hand off the whole loop
所以,我们的做法是设法弄清楚,怎样才能在最后最好地把整个流程交接给客户。我们想弄清楚:是谁在运行这些智能体,谁在审核输出,谁在修正问题,谁在把这些修正转化为规则和基准测试用例,以及由谁决定新版本何时可以发布。这些问题你们大概都应该记录下来。嗯,你们要交接的是整个闭环,而不只是智能体。理想情况下,如果改动足够小,用户应该有能力自行完成这些修改。以 Domino's 为例,我们正是这么做的。现在,智能体会按照他们的安排运行,可以每天多次运行,也可以由电子邮件触发手动运行。目前,分析师只需审核例外情况。每当他们发现一处需要修正的问题,就能自动将其添加为基准测试用例。So, so our way of this is trying to figure out how best to hand off to the customer at the end. We want to figure out who's running these agents, who's reviewing the outputs, who's trying to correct who's trying to take the corrections into and converting into rules and benchmark cases, and who decides when new version is ready to ship. All these questions are things you should probably have written down. Um you're trying to hand off an entire loop and not just the agent. Ideally the user should be empowered enough to make these changes if they're small enough themselves. So for Domino's, that's exactly what we did. The agent now runs on their schedule either multi um daily or even by email trigger manually. Analysts review only the exceptions at this point. Each correction that they catch, they're automatically able to add as a benchmark case.
如果他们做不到,那显然他们随时都可以为他们提供服务。我们现在正与他们一起拓展业务,尝试进入多个市场和其他领域。所以,基本上,这就是我们如何运用我们的框架与达美乐合作,将一个几乎无法正常工作的智能体改进到几乎完美运行,同时降低成本。我们发现,这个框架对各种其他用例都非常有效,尤其是在数据来源杂乱、需要从中找出正确答案的场景中。谢谢。If they can't, then they obviously they're always available for them. And we are now at a place where we are expanding with them. Um trying to get it into multiple markets and multiple other um areas. So yeah, this is basically how we used um our framework to work with Domino's to go from an agent that barely works to an agent that works almost perfectly while reducing the cost. We found this framework to be very effective for various other use cases, especially where you have messy sources of data where you're trying to figure out the right answer. And um thanks.