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 the customer.
Our customer in this case that I'm going to be talking about throughout and the framework we use repeatedly 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 apps? 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 get a spreadsheet 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 spreadsheet, hand it off to an analyst, and flag anything that it thinks it's not sure of.
When we created version one of this agent for them, we had 41% accuracy. By the end, at version 11, we had 97% accuracy. Cost per source—per source means per item, 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 through instructions and skills and playbooks changing.
Here are the six steps that we use, not just with Domino's, but with other customers as well. We start off with kickoff, followed by ontology, 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 we all can use internally as well.
So step one is kickoff. You should idly talk to your customer or end user and agree on what the win looks like. As of today, what is the job? What is a 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 competitive pricing without losing the judgment edge cases need. So we asked them all of these questions. As of today, the analysts create a spreadsheet and the pricing team finally analyzes it. An analyst spent two hours daily manually actively working on creating the spreadsheet. Every cell was then checked and confirmed. And the agent at the end just had to ask for the analyst to sign off and flag anything else it had to.
Our win in numbers looked like having the highest accuracy, the lowest cost per source as possible, runtime to be as low as possible. And before we even started, they weren't even sure if we can do discount search at all. Step two is ontology. 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 there's one rule 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 PostgreSQL database that the agent can do whatever it wants with. We gave it a target table where we gave it all the items. In this case, let's look at ID number 14. ID 14 is brand B. It's a large pizza. Delivery method, on app B. The agent hypothetically does browser use, finds the price on the website, finds that it's 24 and 19. 24 is a strikethrough price, 19 is a sale price. We also now have a rules file where we actually tell the agent to specifically mark down the price that a user pays at checkout, not 24. This came from 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 live traces were definition of what a large pizza looks like. It's anything that's 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. Step three is figuring out benchmarks and evals. Now, these steps can be interchangeable slightly, but essentially you're trying to figure out what you can run offline evals on and what you can run online evals on.
For offline evals, 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 worked on. Can we actually rerun those 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's doing?
For evals, you try to figure out what you can check deterministically, what you can check with an LLM 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. 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.
At Domino's, our benchmark essentially started off with old 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 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 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 math was computed correctly, if the price was 20% plus or minus compared to the previous run, was it flagged or not. LLM 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.
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 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 it takes. And you should use this agent to figure out how long does the 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 after you get some baseline score they're trying to meet.
For Domino's, version one for us was 41% correct. It took more than two 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 with small narrow scope worked out really well for us to figure out how we can fix things.
Step five is to iterate. You should score, fix, and ship. Here is where you'll do steps two, three, and four. Keep rating, improving your ontology, improving your evals, 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 runtime or cost, if yes, are you okay with that increased runtime 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, I've highlighted two examples. Before I get to that, here is a graph of how our progression went. V1 started off at 41%, more than $2 a source. V11, after a bunch of changes, is $1 a source and 97% accurate.
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 caught that there was actually a deal below that website, below on the same page that was $21 instead, and it missed that. 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 catch this and make sure it doesn't happen again.
Another more intricate change that we had to make was actually browser use behavior of the agent. So in one of the runs, we saw that for 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 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 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, alt text before looking at the actual image reads, and just stopping past a certain zoom level. What that resulted in is one-third the number of image reads, reducing cost by over 50%, and us getting an actual answer on 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 browse around use tool calls and see what went wrong. We made a bunch of these changes, got to V11, got to 97% accuracy, and now it's figuring out here, what next? 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 the new version is there to ship.
All these questions are things you should probably have written down. 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 daily or via 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're always available for them. And we are now at a place where we are expanding with them, trying to cater to multiple markets and multiple other areas.
This is basically how we used 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. Thanks. 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 compared to pricing without losing the judgment edge cases need. So we asked them all of these questions. As of today, the analysts create a spreadsheet and the pricing team finally analyzes it. An analyst spent two 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 to sign off and flag anything else it had to. Our win in numbers looked like just having the highest accuracy, the lowest cost per source as possible, runtime to be as low as possible.
And before we even started, they weren't even sure if we can do discount search at all. Step two is ontology. 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 there's one rule 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 PostgreSQL database that the agent can do whatever it wants with. We gave it a target stable where we gave it all the items. In this case, let's look at ID number 14. ID 14 is brand B. It's a large pizza. Takeaway method, 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 a striked out price, 19 is a sale price. We also now have a rules file where we actually tell the agent to specifically mark down the price that a user pays at checkout, not 24.
This came from 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 live 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 take away.
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. Step three is figuring out benchmarks and evals. Now, these steps can be interchangeable slightly, but essentially you're trying to figure out what you can run offline evals on and what you can run online evals on. For offline evals, you should ideally start off by asking them if they have passed cases that they already have answers for. In this case, we had analysts from Domino's who had spreadsheets that they worked on.
Can we actually rerun those 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's doing? For evals, you try to figure out what you can check deterministically, what you can check why an LLM is 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. 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 old spreadsheets that they had. We tried to create the input environment by going to archive.org and having snapshots of compared to websites at those given dates. What we saw 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 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 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. 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 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 the 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 after you get some baseline score they're trying to meet. For dominoes, like I mentioned earlier, version one for us was just 41% correct. It took more than two 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. Step five is to just iterate. You should score, fix, and ship. Here is where you'll do steps two, three, and four. Keep it rating, improving your ontology, improving your evals, 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 runtime or cost. If yes, are you okay with that increased runtime and cost? And how can you use those failures to create and add to your benchmark cases or eval criteria? Idly, change one thing at a time and fix the instructions before you want to change the model entirely. At Domino's, I've highlighted two examples. Before I get to that, here is a graph of how our progression went. V1 started off at 41%, more than $2 a source. V11, after a bunch of changes, is $1 a source and 97% accurate. 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 caught, that is 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. 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 catch this and make sure it doesn't happen again.
Another more intricate change that we had to make was actually browser use behavior of said 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 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, alt text before looking at the actual image reads, and just stopping past a certain zoom level. What that resulted in is one-third the number of image reads, reducing cost by over 50%, and just us getting an actual answer on 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 browse around 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 here, like, what next? 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 the new version is there to ship. All these questions are things you should probably have written down. 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 daily or even via 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, trying to cater to multiple markets and multiple other areas. So yeah, this is basically how we used 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 thanks.
I had the title title title title title title title title title title title title title title title