How to Design a Data Agent People Can Verify

Hamel Husain argues that data agents answering business questions like "What was net revenue for product A last quarter?" are useless without showing their work. The fix: expose the SQL, metric definitions, and reasoning so domain experts can verify results instead of pestering data scientists to reverse-engineer the answer.
Chapters
And I have seen this product being built at companies more than any other product. Like everyone is building this. It is some kind of agent, internal agent that will answer business questions. And they have like some kind of chatbot they've been built internally that can go query your database and do, and basically try to replace a data analyst to some degree. And the dream is like, oh, like you can ask a question, like what was the net revenue of product A last quarter? Okay. And then you'll get, you get a response like the net revenue is X. Now a lot of people get really excited when they see this. They're like, this is amazing. Of course, like it seems like an obvious idea, but this is actually really bad. This is a really bad design. Do not make something like this. And you might wonder, be wondering like why? And so what happens in reality when you have some kind of internal tool like this? What happens is you ask this question, you get this answer, you don't really know if it's right. Like, how do you know? And so what ends up happening is they like ping a data scientist. So let's say there's a PM, his name is Doug, and Doug runs this thing in the new— this newfangled tool. this data agent and gives it to you, Hugo. And he's like, hey, like, this data agent gave me this answer. What would, what would you say?
I'd, I'd say, show, show me the working and some of the code or some of the analysis, or I'd wanna, I'd wanna know what the path was to figuring this out, or the SQL query, like, whatever. Show me something.
And the guy, like, you know, again, is like, he doesn't have any of that. He just shows you the screenshots. Like, I don't know. I don't even know what SQL is.
I'd then waste my time reproducing it, probably.
Yeah, yeah, you would be reproducing it. And specifically, like, I mean, what would you do is you'd be like, well, this question is actually super complicated. Like, what the hell is net revenue? What does that mean? Yeah, what table does that come from? What filters need to be applied to get to net revenue? Is there an agreed-upon definition of net revenue? And like, what things need to be joined to be able to come to that? And what the hell is last quarter? Like, what are the dates? What kind of physical calendar are we on? And what is it? How do you know if it's right? Well, one of the best things you can do is try to, try to like see if it's consistent with other numbers. Like, maybe there's a report someone has elsewhere. you can kind of see like whether this number makes any sense. Like you said, you want to look into how maybe it was calculated. Like, how did we get to this net revenue? You know, what was the gross revenue? And then kind of like walk it and do all those numbers make sense? So you would start going through this thought process, right? And it's actually, it might take you all day to figure that out.
Yeah.
Normally.
I mean, I don't need to tell you this, but this is one of the reasons notebooks and literate programming has been so useful for decades, right?
Yes. I mean, so that's what a data scientist would do is they would, they would take notes. They would like kind of write down what is their thought process to come into this number. The thing is like, if you have, even if you had the trace, it might not be enough to like know if it's correct, if it's correct. Like, yeah, you could know what the SQL query is, and maybe some tool calls, but like, was that enough? Like, I don't know, like maybe. But probably not. I need to have some evidence that I can trust this number. I need to think like a data scientist. Basically, I need to think like the domain expert.
Hmm.
And I need to design the product so that the user or the expert can actually evaluate it. Like, how would the— how does the domain expert wanna see this information? They can quickly sort of get confidence in it. And so if you were to redesign this, Okay. To be evaluated, what might it look like? And so it might look something like this. It's like, oh, uh, you have what was net revenue for product A. And then it would have some sort of kind of thing. It would say like, and this is just a mockup, but just to drive home the idea, like you might have some, something from your semantic layer that returns a definition. You might have some intermediate calculations. It might be referenced in notebook. You know, somebody click this notebook, but like, yeah, I'll link you to a notebook where this kind of thing was spelled out and you can see like, what is the AI trying to do? It might even adapt that notebook from another analysis someone else did. These are all design ideas that you might want to do. And the idea is like, there's a really large distance between what I showed initially and this kind of design. that is more like a notebook, which shows like the thinking and the steps and the provenance of like where the data comes from, but also why, you know, give us as many reasons to trust the number as you can think of. We— can we make it super easy to verify? Can we make it a lot easier to verify? And this has a lot to do with evals, because if you design your product to make it a lot easier to verify, You're going to have a way easier time doing evals for it because you will collect, you'll be able to collect way better signals from your end users about like what went wrong and what's wrong. Not to mention you will log the signals that matter because you're surfacing the same thing and you'll make, yeah, you just make it easier to label things either implicitly or explicitly, but also you'll make it a lot easier to automatically like classify errors because you are now Sort of having all the data, and then you'll get like way better feedback this way. And so like this is not science fiction, but there are applications that kind of do this. Like this is this is a real data product that kind of does something similar. It's called Hex. It's a notebook. Like you ask a question, it gives you an answer, but it shows you evidence, and it also has a notebook, and it like has a SQL query in it and all these other stuff, and you can go and iterate on it. And so this is not. Science fiction is actually like good design. And you can find, you know, a lot of times if you feel that a product is hard to eval, or you feel like, I don't even— I don't know how to eval this, you have— you, you know, you are coming from the position of like, yeah, eval sounds great, but like, you just can't do it. It's a strong smell that your product isn't good.










