Building an AI Chatbot: Better Responses and Actionability with LLM and Predefined Logic Trees
Riddhima Sejpal19:492025
Instacart's support chatbot got better by letting the LLM do less
LLMs state wrong answers with total confidence, "like toddlers," and in customer support that quickly erodes trust. Riddhima Sejpal, a Senior Staff Software Engineer with about ten years at Instacart, shows how a purely generative design for Carebot, the company's customer care chatbot, struggled with consistency and with actions such as cancelling an order. So which jobs belong to the LLM, and which to a predefined logic tree?
Learn the routing checks, prompt splitting and evals behind Instacart's hybrid support bot
Riddhima Sejpal, Senior Staff Software Engineer at Instacart, explains how her team built Carebot, a customer care chatbot that uses an LLM to understand intent and predefined logic trees to carry out actions reliably. She argues that this hybrid design, plus small single-responsibility prompts with their own evals, gives more accurate, consistent and actionable responses than a purely generative chatbot.
“So LLM sometimes produces incorrect information with confidence, like, you know, toddlers tell the lie with a lot of confidence.”
“So we were more confident on pushing more actionable things on the predefined path versus more conversation things on the LLM.”
What you will learn
Decide which chatbot tasks belong on predefined logic trees and which suit open LLM conversation.
Design parallel checks for flow matching, intent clarity, sensitive cases and escalation thresholds.
Split one large prompt into single-responsibility prompts, each with the model that fits its job.
Write per-prompt LLM evals to debug failures and safely switch to cheaper models.
Plan human escalation that passes full conversation context to the agent.
Key takeaways from the speaker
Balancing AI and Rule-Based Systems
Optimizing Response Quality and User Experience
Designing Action-Oriented Chatbots
Details
Level
Intermediate
Format
Talk
Technical depth
Practitioner
For
Mid-career, Senior individual contributor
Length
19:49
Published
June 2025
Questions this talk answers
Why not rely on a purely generative chatbot for customer support?
LLMs can hallucinate confidently and answer inconsistently, which erodes user trust. They also lack actionability, because taking actions requires sharing user context with the model, which raises data privacy concerns.
How does Carebot decide between the LLM and a predefined flow?
Several AI prompts run in parallel to check whether the message matches a predefined flow, whether the intent is clear, whether the case is sensitive and whether to escalate. A final prompt decides which response to prioritize.
When should a support chatbot hand the customer to a human agent?
For sensitive cases such as fraud or payments, and when the intent is still unclear after four or five back-and-forth questions. A fixed threshold avoids frustrating a customer who is already in trouble.
Why break a large prompt into smaller ones?
A prompt with a single responsibility is easier to improve without regressions elsewhere, lets the team pick a model per prompt for cost efficiency, and makes per-prompt evals possible.
What results did the hybrid approach deliver at Instacart?
The speaker reports that customer satisfaction went up and agent handoffs went down, and the same approach was replicated for shopper support.
About this talk
In this talk, we explore how to design an AI chatbot that combines the power of large language models (LLMs) with predefined logic trees to deliver high-quality responses and actionable outcomes. The session covers how LLMs enhance conversational understanding, while the static logic tree structures provide a reliable framework for decision-making and action-taking. Attendees will learn strategies to balance flexibility and control in chatbot design, ensuring consistency, accuracy, and an engaging user experience.
Routing chatbot messages with parallel checks (83 s)
Small prompts did wonders (74 s)
My name is Riddhimah. I am a senior staff at Instacart. I have been in the Instacart company for more than 10 years, around 10 years now, I would say, and I've worked on many customers and shopper-facing products. I'm thrilled to be here at Women in Tech Conference this year. This is my first year and it's amazing to see all the energy in the different sessions and I was just leaving for my turn.
So I'm excited. In this session, I'll share an insight from our journey in Instacart on how we built Instacart's customer care support chatbot. We also call it a carebot and we'll explore how combining the LLM models and with the redefined logic tree helped our carebots responses significantly to be more reliant, more accurate and more actionable. So let's dive in.
So to start with, let me introduce what carebot is. It's Instacart's an AI chatbot specifically created for customers' care support. We're also working on it now. After doing this, we also supported the same for our shopper support and it's doing great as well. So carebot utilizes our existing help center articles which were there. We summarize and show it in a more personalized way for the customers.
We provide the interactive follow-up questions just like the chatbot does and it also supports the direct actions which customers can take within the chatbot. So if a customer is stuck on some of their order issues or if they want to cancel or the restitue, they don't have to leave the chatbot. They actually can perform the action within the chatbot itself.
And then there is seamless human escalation also supported. So if there is a need for customer to hand it over to, for us to hand over the customer to an agent, there is a full context shared with the agent. So that also from within the chatbot, they don't have to leave. There is a direct support of that as well.
So before we launched Carebot, our customer and shopper help center articles for entirely static pages. So you can think of like normal, like you have to click one page and that gives a list of options from that you select something. So they were very general article, very informational and accurate, but very generic article, lacking any personalization. So if you are in a certain state, stuck because of some issue, the patient is in the chatbot.
And it might just give you a generic solution, which might not work for you. And also it did not have any interactive with me. So it does not understand where, what you want exactly. Again, it helps. Being a generic, it only gives you a very common problem solution. So there was, because of that, there were like high frustration points sometimes for customers when they are not able to proceed in their journey, whether it might be placing an order or like taking action on an existing order or because of any other reason they want to take action on their account.
So this led to also high volume on the human escalation. Of course, that includes comes with a cost like agent calls and also waiting time is high always when you have to reach out to customer care. We all have faced that. Recognizing these limitations and with the rise of AI, we saw that AI chatbot now is much easier to build. And so as an opportunity, we improved our customer interaction significantly.
The AI chatbot offers natural conversation. It's more like human. It enhanced the contextual understanding because now you know exactly you can fetch that from the current state of where customer is, what it's trying to do, what its current profile looks like. And then based on that, you can do responses again because of that, it's more personalized. And so a customer likes it, you know, and then, of course, it's scalable, because now adding a new flow to an AI is much more faster compared to creating those pages and then asking people or like, you're making that pages mindable for customers. So those were some key benefits of our AI chatbot.
And of course, much better than static stuff. However, adopting a purely generative AI solution brought some challenges, which we point out. So LLM sometimes produces incorrect information with confidence, like, you know, toddlers tell the lie with a lot of confidence. And we call it hallucination. So sometimes you feel like, well, the answer is correct, but well, the answer is correct, but it's not correct.
In context of my use case, is it correct in concept context of Instacart or do we even support this flow? So those were some challenges. Of course, the prompt improvement and all can fix most of it. But we felt that these kind of issues when every time new use cases are encountered, it causes a lot of confusion in the customers.
And because of this, there is also lack of consistency, which can lead to diminishing user trust. They're like, well, I can't trust this. It's sometimes right, sometimes it doesn't work. So I would rather just skip it and go somewhere else for the help. So it wasn't that reliable. Furthermore, purely generative chatbot lacks actionability. And why I say lack here is that you can add to some extent, but not all, because there is like what amount of information you want to share with LLM to take an action, right?
So you have to give the context and there comes the data privacy thing, how much of the user information you want to share with the chatbot to build its context so that it can take some action on behalf of user. So keeping that all in mind and addressing all these challenges, we've adopted a hybrid approach. So we combine the strength of AI and LLM models there with the structured logic trees.
So people who don't know about the structured logic trees, it's more like a defined tree you can think of in your computer science and you might have seen where there is a node and then it has a children node. There is like an option and from there you have another opposite of option till you reach the leaf node. So you can think of an example of like a cancel order. If someone says that I want to cancel an order, what are the reasons?
We'll show you the list of reasons. And then from there we go. This is how the traditional chatbots were made. So combining our AI conversation strength with the predefined tree definitely helped us move faster. So we were more confident on pushing more actionable things on the predefined path versus more conversation things on the LLM. And I'll go over that in a bit. Then the result was more accurate, reliable. We know exactly the customer wants to cancel the order, what flow they have to go.
So if they're clicking the cancel button from the cancel flow somewhere or they're typing in the cancel order, they exactly know how the flow should be. So that also gives them more confidence that, okay, this is how the flow would look like. That also gives you, as an engineering team, a lot of flexibility to run, not only engineering but product team, to run and experiments on these flows.
So if you want to tomorrow add a new friction flow in the cancel order, I'm using the cancel order for example here, much easier. So add a new friction flow thing. Are you sure you want to cancel? It's much easier adding into the predefined flow rather than changing in complete Gen AI prompt thing. And it was just much faster. Same as the way you want to remove something, it's much easier. So experimentation is much faster, easier.
So before we get into the technical design, I'll just show you guys a demo. So this is what I was telling you guys about. There is a flow here saying the cancel order from a card or if you go via a chat, which is here. So here you say cancel or reschedule, here is a list of predefined reasons. You select one of it and do. Or you say, I want to chat instead.
So chat and then in chat you say, I'll cancel my order. Instead of being chatty here, I understand the intent that it is want to cancel the order. We ask which order you want to cancel. This is the order. And then the flow is consistent. So you know what I'm saying that here we are using predefined. We use AI to understand the intent, whether it wants to cancel.
And if there is a predefined flow, we just switch to that. So let's go to the tech design. So reading on that example, this is how the flow looks like. So when a user comes in, you see that there are like multiple predefined steps. But I would say parallel checks we run here. We check that whether whatever the text message or the query has come in, it doesn't match with an existing predefined flow.
If it does, we take a shortcut here. As you saw in the cancel example, we will pass it on to the predefined flow. And from there, the predefined flow will take the charge. If there is another check is more is the message has a very clear intent. So if you write cancel my order, the intent is very clear. You want to cancel.
The question here would be which order, right? Is this your active order, existing order? So that is a clarifying question. Are you talking about this order? But if there is a very unclear intent, say someone just types and says cancel. Cancel my order. Do you want to cancel your account? Do you want to cancel your membership? It's not clear.
So unclear intent will be the flow will be triggered here where it will ask the clarifying question. I understand what you want to say, but can you be more clear? Are you thinking of these options or anything else you have in mind? So that is just more like a better follow up question. Another check here is like, okay, there are some sensitive use cases.
We want our agents to handle like better have a human intervention there. So say something around some fraud has happened or they want to do something with the payments, which is more like a sensitive issue. So we would want customers, we would want customers, we would want customers to request directly instead of being engaged into the AI, we better estimate them to the agent directly so that they get more better help.
Or, um, if there are sometimes it's hard for us to find, uh, the, understand the internet customer is just after four or five back and forth unclear questions. Uh, we have been asking them, I mean, this, no, this, and then like, whatever, rather than being too chatty and frustrating customer, it's better to understand the threshold or fix a threshold.
I would say within your system. And then from there, like, escalate to agent. So that customer can handle, uh, talk to human and get them resolved much faster rather than frustrating someone who is already in trouble more and not able to express it or, uh, just, uh, not, we are not able to understand it, you know? Um, and, uh, and, uh, then if we don't have a big defined flow, uh, but we do have a health center article, which we could actually, with the help of GMI, uh, add more context and be more, uh, precise about their profile, uh, we would summarize that health center article to help them and then show them the response in the, uh, chatbot itself.
So if, uh, if, uh, if, uh, if, uh, if you are a mobile user and your cancel order is in the hidden menu somewhere, uh, we will say that when you go into my accounts and do the orders and do this, uh, but on web, it might be different. So that, that's the kind of more personalized response you get, which you don't get it on the static pages.
Uh, so those are the kinds of responses, uh, comes back as I mentioned, uh, these things, uh, all these prompts are like, uh, they are AI prompts and they do the different functions. They all run in parallel and based off, uh, there is one more prompt about it, which actually, uh, make sure that we, we understand which one to, which response to prioritize and then, um, respond to the customer.
One important practical learning I want to share here from the Careverse implementation was our approach to prompt design. So as we discovered when we were working on this, that breaking a complex, uh, larger prompt to a smaller prompt did wonders. So we were able to move much faster when a single prompt had a single responsibility and, uh, it were, we were able to, uh, even, you know, um, break it into smaller pieces where we, yeah, we, we, it just, that prompt knew exactly what to do.
So, this is your work and just do that rather than giving one big, a lot of responsibilities where it's struggling sometimes saying that, oh, well, uh, if you try to get it better in some, um, aspect, it was to regress somewhere. So, uh, why did it, is it, uh, what a problem or is it my prompting problem?
Um, so here it just made it much easier. It, after doing that, is that actually making the prompts into a smaller prompt, uh, with the ability of selecting the model for prompt. So some models, say for example, help center, article consumerizer, I would use a particular model, which is more better at writing, um, versus the one which is used for, uh, uh, for our, um, clear, clear clarification, asking clarification questions.
It is more one for the chatty, the chat directly. So, um, so you, based on your, uh, need, you can select the model, you can go to the deeper model, the ones where it's only basic responsibilities are there, but one where you have to write it, you rate, or that you can use a more, um, you know, advanced model.
So that actually helped us with constant operational, uh, efficiency as well, because now you can, uh, do the mixed and black forces in the one, uh, big, large prompt. We had only stuck with one model. Um, um, and then additional, uh, things which came with it was better testability. So, uh, you guys, um, many of you guys might know about LFM evals.
Those are like the test cases for your prompts. And so writing those test, uh, evals for per prompt was much better. You could test and debug which use cases are not working and then we kind of fix the prompt in that way. Even when newer, cheaper models keep coming, uh, we can test it, uh, test our prompt against those models and then switch the models if that is doing equivalent work and if it's cheaper for us.
So, um, a lot of main situation on the prompt design here. Um, the real world impact of this was, of course, uh, customer satisfaction better than static pages and there was a big win here. Uh, uh, uh, we, our customer satisfaction metric went up. Uh, uh, support, uh, escalation. Uh, so agent, uh, handoffs went down because we were able to support most of our important use cases within the chatbot itself.
Um, setting up the system like this also helped, uh, in clarity. Uh, sorry. Are you able to hear me now, Terry? I hope, I hope it fixed it. Um, so, um, setting up our system in this way, improve this, uh, kind of put sets us up for, uh, scalability as well. And, uh, as I mentioned, the cost saving, um, uh, benefit which came with it.
So key takeaway, uh, for everyone here is, um, hybrid approach win. Uh, hopefully, uh, we, we, we replicated the same for our, uh, from the customer's care support to the shopper care support. And we are doing great there as well. So hybrid approach definitely works better for us. Uh, prompt design matters. Uh, we, uh, this learning from the care bot across the company because, uh, that really is, uh, one key learning for us.
And, uh, of course, setting up emails is something which, uh, which is going to be initial time, uh, uh, staking part, but it helps you move faster a lot. So, yeah, we, we are going to add, uh, uh, a lot of more, uh, capability on our care bot. Uh, and, um, so if you guys are interested, would love to chat more about it.
Uh, and, uh, thank you. Yeah. Um, feel free to connect with me on the link. My barcode is here. Uh, if you want to have, uh, more chat about this topic. Um, yeah. Yeah. Happy to talk about it. Sure. Christy. Happy to connect. Thanks. Thanks, man. Thank you. Thank you guys. It was nice. It was. Cool. All right.
I think my time is almost up. If anybody has any question, I can answer from the chat itself. Thank you. cool all right I think my time is almost up if anybody has any question I can answer from the chat itself thank you all right you guys see you guys on LinkedIn all right bye-bye
Transcribed automatically; names checked against the speaker record. Select a time to jump there.
Article based on this talk
Why the best support chatbots let the LLM understand and the logic tree act
Riddhima Sejpal shares how Instacart's Carebot pairs large language models with predefined flows to give accurate, consistent and actionable answers.
In short
A purely generative chatbot is fluent but unreliable when customers need something done. Riddhima Sejpal, Senior Staff Software Engineer at Instacart, explains how her team built Carebot, a customer care chatbot that uses an LLM to understand what the customer wants and predefined logic trees to carry out actions such as cancelling an order. Small, single-purpose prompts with their own evals made the system faster to improve and cheaper to run.
Key takeaways
Balancing AI and rule-based systems
Optimizing response quality and user experience
Designing action-oriented chatbots
From static help pages to the limits of pure generative AI
Before Carebot, Instacart's customer and shopper help center was made of static pages: accurate and informative, but generic. Customers stuck mid-journey often got a common solution that did not fit their situation, which drove frustration and a high volume of escalations to human agents, with the cost and waiting time that come with them.
An AI chatbot promised natural conversation, context from the customer's current state and profile, and personalization at scale. Adding a new flow to an AI system was also much faster than building new pages. But Sejpal is candid that a purely generative approach brought its own problems. The first was hallucination: "So LLM sometimes produces incorrect information with confidence, like, you know, toddlers tell the lie with a lot of confidence." (4:38)
Even when an answer sounded right, the team had to ask whether it was correct for Instacart and whether the flow was even supported. Prompt tuning fixed most cases, but new use cases kept creating confusion, and inconsistency cost trust. As she puts the customer's reaction: "They're like, well, I can't trust this. It's sometimes right, sometimes it doesn't work." (5:32) Actionability was the other gap: to act on a user's behalf the model needs context, and that raises the question of how much user data to share with it.
The hybrid design: AI for intent, trees for action
Instacart's answer was a hybrid. Structured logic trees, familiar from computer science and traditional chatbots, define a path from a starting node through options to a leaf. Cancelling an order is the running example: the customer states the goal, sees a list of reasons and follows a known flow. Sejpal describes the division of labour clearly: "So we were more confident on pushing more actionable things on the predefined path versus more conversation things on the LLM." (7:03)
The demo shows this in practice. Whether a customer taps cancel from an order card or types the request into chat, the bot does not get chatty. "We use AI to understand the intent, whether it wants to cancel." (9:13) Once the intent is clear, the conversation switches to the predefined flow, so the experience is the same every time.
The benefit reaches beyond customers. Engineering and product teams can experiment on predefined flows far more easily, for example adding or removing an "Are you sure you want to cancel?" friction step, instead of reworking a full generative AI prompt.
Parallel checks and knowing when to hand off
In the technical design, several AI prompts run in parallel on each incoming message. One checks whether the message matches an existing predefined flow and, if so, takes a shortcut into it. Another judges whether the intent is clear. "Cancel my order" is clear, so the only follow-up is which order. Unclear input is a different matter: "But if there is a very unclear intent, say someone just types and says cancel." (10:38) The customer might mean an order, an account or a membership, so the bot asks a clarifying question.
Other checks route sensitive cases, such as fraud or payment issues, straight to human agents. The team also sets a threshold: if the intent is still unclear after four or five exchanges, the customer is escalated rather than frustrated further. Where no predefined flow exists but a help center article does, the system summarizes it with context from the customer's profile, for instance giving different steps for mobile and web users. A final prompt decides which response to prioritize. Escalations carry full context so the agent does not start from zero.
Small prompts, the right model and per-prompt evals
Sejpal's most practical lesson concerns prompt design: "So as we discovered when we were working on this, that breaking a complex, uh, larger prompt to a smaller prompt did wonders." (13:46) A large prompt with many responsibilities tended to regress in one area whenever it was improved in another. Single-responsibility prompts were easier to reason about and fix.
Splitting prompts also let the team choose a model for each job: a stronger writing model for summarizing help center articles, a lighter one for clarifying questions. That improved operational cost efficiency compared with being tied to one model for one big prompt. It also made testing easier. Describing LLM evals, she says: "Those are like the test cases for your prompts." (16:06) With evals per prompt, the team can find failing use cases, fix them, and test newer, cheaper models before switching.
Results and what to take away
As the speaker reported, customer satisfaction went up compared with the static pages, and agent handoffs went down because most important use cases could be handled inside the chatbot. The design also set Instacart up to scale, and the same approach was replicated from customer care to shopper support. Her summary is direct: "So hybrid approach definitely works better for us." (17:38) Prompt design matters, and setting up evals takes time at first but helps teams move much faster afterwards.
Watch the talk
Building an AI Chatbot: Better Responses and Actionability with LLM and Predefined Logic Trees, by Riddhima Sejpal (about 20 minutes): https://www.womentech.net/video/building-ai-chatbot-better-responses-and-actionability-llm-and-predefined-logic-trees
About the speaker
Riddhima Sejpal is a Senior Staff Software Engineer at Instacart Inc., where she uses technology to solve complex problems and deliver impactful solutions. She is equally committed to mentorship, sharing knowledge and guidance to help others grow in their careers.
Questions this talk answers
Why not rely on a purely generative chatbot for customer support?
How does Carebot decide between the LLM and a predefined flow?
When should a support chatbot hand the customer to a human agent?
Why break a large prompt into smaller ones?
What results did the hybrid approach deliver at Instacart?
Drafted with AI from the talk transcript. Editor review pending.
Frameworks and ideas mentioned
Hybrid LLM and predefined logic tree design
Single-responsibility prompts
LLM evals
Cite this talk
Riddhima Sejpal. "Building an AI Chatbot: Better Responses and Actionability with LLM and Predefined Logic Trees." WomenTech Network, 2025. https://www.womentech.net/video/building-ai-chatbot-better-responses-and-actionability-llm-and-predefined-logic-trees