Building ISO: A Hyperpersonalized AI Food Ordering Agent for Millions of Users

ifood · E-commerce · 2025 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Food-delivery ordering agent

iFood needed an agent that could reduce food-ordering decision paralysis for millions of users, personalize recommendations, act across app and WhatsApp channels, and keep latency acceptable for hungry users.

Constraints:

Architecture

ISO is a hyperpersonalized food-ordering agent available in the iFood app and WhatsApp. It turns natural-language requests into search queries, uses user context to rerank options, can take actions such as coupons/cart/payment, optimizes latency through flow shortcuts and asynchronous context processing, and validates failures through evaluation cases.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  user[User] --> iso-agent[ISO Agent]
  iso-agent --> app-channel[App Channel]
  iso-agent --> whatsapp-channel[WhatsApp Channel]
  iso-agent --> context-builder[Context Builder]
  context-builder --> asynchronous-context-processing[Asynchronous Context Processing]
  iso-agent --> search-and-rerank-tool[Search and Rerank Tool]
  search-and-rerank-tool --> context-builder
  iso-agent --> commerce-action-tools[Commerce Action Tools]
  asynchronous-context-processing --> latency-optimizer[Latency Optimizer]
  latency-optimizer --> evaluation-suite[Evaluation Suite]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
User Hungry customer interacting through the iFood app or WhatsApp. ISO Agent
ISO Agent Food-ordering agent that understands intent, calls tools, and takes actions on behalf of the user. User, App Channel, WhatsApp Channel, Context Builder, Search and Rerank Tool, Commerce Action Tools
App Channel Native app surface with floating button, rich UI, follow-up questions, cart, and payment. ISO Agent
WhatsApp Channel Messaging commerce channel used heavily in Brazil. ISO Agent
Context Builder Builds conversation and user-profile context from preferences, order history, food categories, and time of day. ISO Agent, Asynchronous Context Processing
Asynchronous Context Processing Moves prior-message compaction and user-behavior selection out of the synchronous slow path. Context Builder, Latency Optimizer
Search and Rerank Tool Converts intent into searches and reranks food options using context. ISO Agent, Context Builder
Commerce Action Tools Applies coupons, manages cart, checks loyalty discounts, checkout, and payment experiments. ISO Agent
Latency Optimizer Flow shortcuts, prompt compression, smaller models, and English prompts used to reduce P95 latency. Asynchronous Context Processing, Evaluation Suite
Evaluation Suite Cases added when production errors or prompt edge cases appear. Latency Optimizer

Data flow

The agent receives an app or WhatsApp request, combines conversation context with preprocessed user-profile context, converts the request into semantic/exact search queries, reranks results with user context, returns UI/tool responses to the agent, and then can apply coupons, update carts, or initiate payment.

3 supporting quotes
“the agent takes into account the conversation context whether the user has indicated some preference but also their order history”transcript, stated
“converting the user input into search queries. Um for something simple as pizza, we going to do some semantic and exact type of search.”transcript, stated
“Then we get results and we use uh this uh user context to rerank and pick the best options for the user. So these results uh end up as a tool response but also as um a UI element. So we display them directly in the in the app interface and we also give them to the”transcript, stated

Why this architecture

The architecture is agentic because simple search is not enough: ISO must interpret vague food intent, personalize with user context, and take commerce actions while keeping flows short and fast.

“what should I order and it's important to understand soil is not a chatbot it's an agent uh there are various tools it can it cannot just search for food but it can also take action for on behalf of the user so uh it can apply certain coupons it can add to the cart uh it can”transcript, stated
“it can also take action for on behalf of the user so uh it can apply certain coupons it can add to the cart uh it can also make the payment on behalf of the user uh plus a lot of these decisions are happening autonomously so it's a kind of an agent agent behind the scene”transcript, stated

Models used: LLMs · smaller models · proprietary AI models

Scale

Alternatives considered (roads not taken)

Simple food search bar or chatbot.

Rejected because: The problem includes vague intents, personalization, and commerce actions beyond search.

“you can use it like a search bar you can go and talk burger you can go and say burger or you know pizza and so on. But uh it also understands very complex intent. So you can say you know I'm hungry or you can say you know I'm I'm”transcript, stated
“uh it also understands very complex intent. So you can say you know I'm hungry or you can say you know I'm I'm with two friends and I want to eat uh so what should I order and it's important to understand soil is not a chatbot it's an agent uh there are various tools it”transcript, stated

Run every request through the full complex agent flow.

Rejected because: Simple requests did not need the complete slow path, so shortcuts reduced latency.

“that um we could have a flow to handle complex requests but when things were simple we didn't need to do all of that. So we created some shortcuts uh that were faster and this could be searching for food like getting preferences uh searching for um promotions available.”transcript, stated
“So we created some shortcuts uh that were faster and this could be searching for food like getting preferences uh searching for um promotions available.”transcript, stated

Keep all context work synchronous.

Rejected because: Prior-message compaction and user-behavior selection did not need to run in the slowest path.

“requests and we realized that part of it could be um move to asynchronous processes for instance compacting the context of the previous messages or uh picking the best uh information from the user behavior. All these processes didn't need to be um done synchronously.”transcript, stated
“user behavior. All these processes didn't need to be um done synchronously. So what we did was moving tokens that were processed during this flow to asynchronous processes. So that didn't decrease the total amount of tokens but”transcript, stated

Patterns

tool-use-orchestration (agent-commerce)

ISO orchestrates search, coupons, cart, loyalty, checkout, and payment actions rather than only returning text.

“it can apply coupons it can figure out if a customer has uh a loyalty program with i food uh what discounts to apply”transcript, stated

agent-memory (personalization)

The agent uses order history, food categories, preferences, time of day, and conversation state as memory-like context.

“their order history their their preferred food categories the time of the day if it's breakfast or dinner”transcript, stated

query-rewriting (retrieval)

ISO expands vague food requests into multiple search queries before reranking results.

“generic um food uh requests like I'm hungry or something like that where we really need to expand uh into different queries”transcript, stated

latency-optimization (runtime)

iFood reduced P95 latency by simplifying flows, moving context work async, compressing prompts, and using smaller models where possible.

“compressing the prompt and al also using smaller models uh when possible.”transcript, stated
“moving tokens that were processed during this flow to asynchronous processes.”transcript, stated

eval-driven-development (evaluation)

Production errors and user complaints become evaluation cases before prompt changes are accepted.

“if there was um a case in production that led to the error that led to that edge case being added to the prompt, we added an an evaluation uh case”transcript, stated

Tradeoffs

Intent handling

Chose Agentic food recommender with tools and actions over Simple search/chatbot.

Rationale: The agent needed to handle vague preferences and take commerce actions, not just retrieve food items.

“soil is not a chatbot it's an agent uh there are various tools”transcript, stated

Latency design

Chose Separate simple fast paths from complex flows over One full agent path for every request.

Rationale: Simple requests do not need the full complex flow and can be handled faster.

“we could have a flow to handle complex requests but when things were simple we didn't need to do all of that.”transcript, stated

Context processing placement

Chose Asynchronous preprocessing for prior messages and behavior signals over Doing all context work synchronously in the slowest flow.

Rationale: Moving tokens out of the slow path reduced latency even if total token work did not disappear.

“that didn't decrease the total amount of tokens but it decreased the total amount of tokens that get get run um in the slowest uh flow.”transcript, stated

Gotchas (what bit them)

Hungry users will not tolerate slow agent loops.

Root cause: The first simple agent flow prioritized making the flow work and landed at high latency.

Resolution: Create shortcuts, move context work async, compress prompts, and use smaller models where possible.

“users are hungry. They don't want to wait.”transcript, stated
“our latency was pretty high. We had around 30 seconds P95”transcript, stated

Prompt bloat accumulates from production edge-case fixes.

Root cause: Teams can respond to every bug, complaint, or eval failure by adding another system-prompt rule.

Resolution: Create evaluation cases for those scenarios and address root causes instead of endlessly adding prompt rules.

“whenever there is a bug in production or user complaint or we find some error in evaluations, it's very easy to add an edge case”transcript, stated
“this gives bloated prompts and it's usually a code smell when you see this.”transcript, stated

Non-English prompts can inflate latency and context pressure.

Root cause: Token tariffs penalize languages other than English in their measurements.

Resolution: Use English prompts to reduce tokens compared with Portuguese versions.

“languages that are not English are penalized and this leads to higher latency and also uh quicker context route”transcript, stated
“we made sure that all our prompts were in English.”transcript, stated

Evaluation

iFood adds evaluation cases from production errors, user complaints, and edge cases before changing prompts; the team also tracks latency and context optimization effects.

Metrics: P95 latency · Evaluation-case pass/fail · Prompt token count · Context processing latency · User-visible flow success

“we find some error in evaluations, it's very easy to add an edge case to the system prompt”transcript, stated
“we added an an evaluation uh case for that.”transcript, stated

Outcomes

iFood reports 160 million monthly orders, 50-55 million monthly users, 1,500 cities, 150 proprietary AI models, 14 billion monthly predictions, and ISO live to millions.

“ISO is live uh to millions of users in Brazil uh uh both on app and WhatsApp.”transcript, stated
“We had around 30 seconds P95 and we decreased that uh up to 10 seconds”transcript, stated