Building Production Web Agents for Food Ordering

ifood · E-commerce · 2023 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.5 (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: E-commerce web agents for food ordering

Prosus/iFood wanted agents that could complete food-ordering and other e-commerce tasks through existing websites because many consumer actions are not exposed as agent-friendly APIs.

Constraints:

Architecture

The team built a custom modular web-agent framework after existing frameworks failed production-style tasks. The system separates planning from execution: a planner talks with the user, validates required information, and breaks the task into detailed steps, while an execution agent navigates a constrained web action space. The executor can run in traditional screenshot+DOM mode, fast mode using stored trajectories for familiar pages, or reflex mode using deterministic macros for predictable web actions. DOM cleaning, platform-specific instructions, merged tools, trajectory storage, simulations, and deterministic data pulls reduce LLM calls and improve reliability.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  user[User] --> main-agent[Main agent]
  main-agent --> deterministic-user-context-loader[Deterministic user-context loader]
  main-agent --> planning-agent[Planning agent]
  deterministic-user-context-loader --> planning-agent
  planning-agent --> platform-specific-prompt-loader[Platform-specific prompt loader]
  planning-agent --> execution-agent[Execution agent]
  platform-specific-prompt-loader --> execution-agent
  execution-agent --> browser-state-reader[Browser state reader]
  browser-state-reader --> dom-cleaner[DOM cleaner]
  dom-cleaner --> execution-agent
  execution-agent --> tool-selector[Tool selector]
  tool-selector --> website[Website]
  execution-agent --> trajectory-store[Trajectory store]
  trajectory-store --> execution-agent
  execution-agent --> reflex-automation[Reflex automation]
  reflex-automation --> website
  simulation-harness[Simulation harness] --> website
  simulation-harness --> trajectory-store
  browser-state-reader --> website
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
User Provides food-ordering intent, address, preferences, dietary restrictions, and other required context. Main agent
Main agent Coordinates user interaction, gathers prerequisites, invokes planning, and processes execution results. User, Planning agent, Deterministic user-context loader
Deterministic user-context loader Pulls user profile details such as dietary restrictions directly instead of using an agent to query databases. Main agent, Planning agent
Planning agent Reasons about user intent, required information, and step-by-step instructions for the executor. Main agent, Execution agent, Platform-specific prompt loader
Platform-specific prompt loader Loads instructions according to the current website or food-ordering platform. Planning agent, Execution agent
Execution agent Chooses constrained web actions such as clicking, typing, scrolling, accepting banners, and detecting task completion. Planning agent, Browser state reader, Tool selector, Trajectory store, Reflex automation
Browser state reader Provides screenshots, DOM/HTML, page state, and clickable elements to the execution agent. Execution agent, DOM cleaner, Website
DOM cleaner Filters huge webpage DOMs down to useful clickable elements and essential state. Browser state reader, Execution agent
Tool selector Limits and combines available web tools based on page and task context. Execution agent, Website
Trajectory store Stores successful paths and page states for familiar pages so fast mode can skip screenshots. Execution agent, Simulation harness
Reflex automation Deterministic macro layer for predictable web actions that do not require agent reasoning. Execution agent, Website
Simulation harness Runs repeated website-exploration attempts against defined success states to learn trajectories. Trajectory store, Website
Website Food-ordering or e-commerce web surface that exposes human-facing browser workflows. Browser state reader, Tool selector, Reflex automation

Data flow

The user asks for a food-ordering outcome. The main agent gathers required deterministic context such as address and dietary restrictions, then the planner turns the request into detailed page-specific steps. The execution agent receives a constrained tool/action space plus cleaned DOM and screenshot/page state. If the page and task are familiar, fast mode uses stored trajectories and skips screenshots; if a workflow segment is fully predictable, reflex mode executes it as a macro; otherwise traditional mode loads screenshot and content for step-by-step action selection. Simulations repeatedly explore websites, store successful paths and page states, and feed that learned navigation back into future executions.

6 supporting quotes
“the information in this case could be the screenshot of the page or the Dom HTML um lots of things that you can get from a browser”transcript, stated
“what it can do are the actions that a human can also do like clicking uh entering text uh scrolling and so on those are like the tools it has”transcript, stated
“usually there is a planner that decides um what once it gets the task decides how to perform it it could be several steps”transcript, stated
“there is um an agent that chooses which tool to use um like if there is a cookie Banner it needs to click accept”transcript, stated
“storing all the trajectories that the agent had done we defined three modes that the agent could operate uh so one was the traditional mode uh where it would grab and screenshot of the page load the content and then decide what what action to take next the”transcript, stated
“the agent would try to do things in a fast way and then if it would not succeed would do it in a slower way ah so it was almost like the slow way was the plan B in case it couldn't do it fast it would do it slow and you would give it a little bit more”transcript, stated

Why this architecture

The custom architecture exists because general web-agent frameworks were unreliable on production food-ordering tasks. The team treated the system as software engineering rather than data science: constrain tools, keep modules separate, make deterministic steps deterministic, load platform-specific instructions, and use the web's simulatability to map action spaces. Planning and execution are split because planning needs intent reasoning, while execution needs precise action-space translation.

5 supporting quotes
“at the end we decided to uh build our own basically framework like your own build our own web agent yeah and how does the logic work or what is the backbone of a web agent do because I know the API agents use tools and you have the potential to do function”transcript, stated
“the way to make an agent succeed is to limit the amount of choices it has to do as much as possible this all these tools were optimized for specific uh goal which is being able to serve the web but our goal was different so in our case um we couldn't use a”transcript, stated
“myself that uh these tools are not necessarily what I need the other thing that helps is to um approach this as a software engineering problem rather than data science and I say that because I come from data science background so this was really um really big for me um what does that mean”transcript, stated
“it's important to understand where you need the agent and where you don't and try to limit the amount of llm calls as much as possible”transcript, stated
“of course web is is one of those interfaces because planning itself requires a lot of reasoning of understanding the intent of the user if you do the execution that basically means I actually need to know the action space really well and to be able to translate that plan into the action space of”transcript, stated

Models used: Foundation planning models · Foundation execution models · Multimodal vision models · Web-agent frameworks evaluated: Multion, Web Voyager, Agent E · Selenium-like browser automation tooling

Scale

Alternatives considered (roads not taken)

Use existing web-agent frameworks directly

Rejected because: Frameworks such as Multion and Web Voyager did not translate reliably to the team's real food-ordering tasks.

“we looked at all the other Frameworks um so yeah we so um one good example is web Voyager is one of the first web agents um they also uh published a benchmark it's public many agents Benchmark against this and what they say is that the success rate can”transcript, stated
“at the end we decided to uh build our own basically framework like your own build our own web agent yeah and how does the logic work or what is the backbone of a web agent do because I know the API agents use tools and you have the potential to do function”transcript, stated

Expose clean APIs for all commerce actions

Rejected because: Many real consumer workflows are only available through browser interactions and are not yet API-ified for agents.

“most of the things that we want to give agents access ACC to aren't made for agents to access they aren't API ified yet”transcript, stated
“behind the website that you're interacting with uh but there's no obvious place to kind of plug the agent into um in a very structured way that the agent for example today uh interacts with all sorts of other uh tools that we're giving them access to yeah and I want to call out too that I've heard”transcript, stated

Give the executor all possible web tools

Rejected because: The team found that limiting the action space and merging always-paired tools improved reliability.

“task that you have to do and be smart about it um if if there are things that you don't need don't uh don't add them to the agent mhm and so did you go and map out the trajectories and the user flow on these food ordering apps and maybe it was like you would go to I food and say hey I want”transcript, stated
“if there are actions that you always do at the same time why would you use two tools for that for instance um when you search for something you type in and then you press enter yeah so these are two separate actions but you can combine them into one tool cuz”transcript, stated

Always run full screenshot-based agent execution

Rejected because: Known pages and repeated tasks can use stored trajectories or deterministic reflex mode for speed and reliability.

“faster mode that didn't involve a screenshot and we would do that on pages that we knew so if we would search for a certain food um and the food would be different but the task would be similar we would not load the screenshot of the page because that was”transcript, stated
“and there there was a third mode um which we called reflex mode uh in which we would automate the web actions directly like sort of a macro let's say some parts of this be automated so why would you have an agent do it right so yeah we combine all these things and the agent would try to do things in”transcript, stated

Use an agent to query user data

Rejected because: Pulling structured user data deterministically and adding it to context is simpler and more controllable.

“I very naively built an agent that could uh interact with the database retrieve the information but actually we didn't need to do that”transcript, stated
“information but actually we didn't need to do that why why would you use an agent if you can just pull the data and add it to the context like to the prom so that was a big Revelation for me because um it made things much more simple um and give us control so make use of the Frameworks uh where you”transcript, stated

Rely on Web Arena benchmark performance

Rejected because: The team found benchmark averages did not translate to their target tasks and websites.

“on you know and looking at others benchmarking on web Arena which turns out doesn't translate at all to the test we were doing right it was one that the actual average results didn't didn't compare but also um they were super unpredictable right so one time they worked one time didn't so”transcript, stated
“the actual average results didn't didn't compare but also um they were super unpredictable right so one time they worked one time didn't so we'd had have to devise simulations where we would go to look at how many times out of 20 would this thing succeed on”transcript, stated

Patterns

tool-use-orchestration (agent-architecture)

The executor uses browser actions as tools, but the tool set is constrained and combined according to page/task context.

“those are like the tools it has yeah uh those are nothing but tools that the agent can call”transcript, stated
“make use of um uh all the tools you have available but select them in a smart way”transcript, stated

multi-agent-orchestration (agent-architecture)

The system separates a user-facing/main agent, a planner, and a constrained execution agent.

“has limited tools uh and does only needs to understand whether it has finished or not MH uh so we would have a planner telling uh the ex the executor um a very specific task for instance if I would um search for a t-shirt on Alex first thing would be open the Alex page uh search in the bar”transcript, stated
“stop when it was finished and give the response to the main agent that then would process it and decide what to do next”transcript, stated

fallback-degradation (operations)

The agent attempts faster known-path modes first and falls back to slower screenshot/context-heavy execution when needed.

“the agent would try to do things in a fast way and then if it would not succeed would do it in a slower way”transcript, stated
“the slow way was the plan B in case it couldn't do it fast it would do it slow”transcript, stated

agent-memory (context-engineering)

Successful trajectories and page states are stored so the agent becomes familiar with repeated websites and tasks.

“uh these methods don't really change the speed at which the agent uh Works um but what what we did was um also storing all the trajectories that the agent had done we defined three modes that the agent could operate uh so one was the traditional mode uh where it would grab and screenshot of”transcript, stated
“you're storing the the path that it took or you're storing the action what are you because you're not storing the screenshot”transcript, stated

eval-driven-development (quality)

The team used representative e-commerce tasks, variations, and repeated simulations to optimize the system toward an 80% target.

“we chose some uh tasks that were representative of uh typical e-commerce um interactions and we try to optimize for those”transcript, stated
“our Target was 80% yeah okay but it of course it heavily depends on the task and on the website and on the user itself”transcript, stated

structured-output-contract (output-control)

The planner gives broken-down, specific instructions to reduce executor ambiguity and keep execution within a known action space.

“the lessons we learned is that we had to be very specific with the with the instructions uh break them down as much as possible”transcript, stated
“delegate that to the planning agent so have um the instructions as detailed as possible um break them down in steps”transcript, stated

Tradeoffs

Build a custom framework

Chose A domain-specific web-agent framework for food ordering over General-purpose web-agent frameworks.

Rationale: Existing tools were optimized for general web browsing rather than the narrower production food-ordering task.

“this all these tools were optimized for specific uh goal which is being able to serve the web but our goal was different”transcript, stated
“we needed to build a web agent that could interact with platforms to order food and that's a different task”transcript, stated

Separate planner and executor

Chose Reasoning-heavy planning plus constrained execution over A single agent doing all reasoning and clicking.

Rationale: Planning requires user-intent reasoning, while execution requires knowing the action space and completing specific web steps.

“separation of the planning and the execution um as you start to interface with the world”transcript, stated
“execution only has limited tools uh and does only needs to understand whether it has finished or not”transcript, stated

Use fast/reflex modes when possible

Chose Known-trajectory execution and deterministic macros over Full screenshot-and-reasoning execution for every page.

Rationale: Repeated familiar tasks can be faster and more reliable when the agent already knows the path or no reasoning is needed.

“we would not load the screenshot of the page because that was not needed so the agent would know exactly where to click because it had seen that uh task before”transcript, stated
“agent do it right so yeah we combine all these things and the agent would try to do things in a fast way and then if it would not succeed would do it in a slower way ah so it was almost like the slow way was the plan B in case it couldn't do it fast it would do it slow and you would give it a”transcript, stated

Limit agent tools

Chose Page/task-specific tools and merged actions over Large universal action space.

Rationale: Smaller action spaces reduce executor ambiguity and make web actions more predictable.

“the way to make an agent succeed is to limit the amount of choices it has to do as much as possible”transcript, stated
“type in and then you press enter yeah so these are two separate actions but you can combine them into one tool”transcript, stated

Prototype freely, then productionize deterministically

Chose Fast exploration followed by modular, controlled production design over Leaving the prototype as a broad high-abstraction agent.

Rationale: Large platforms need predictable systems that can scale to tens or hundreds of millions of users.

“you can prototype a lot of stuff very quickly but at the end of the day you know we our our main job is to take something that we uh can see work and scale it”transcript, stated
“need to distill the the actual essence of you know the system to one that can be put into production and scale”transcript, stated

Gotchas (what bit them)

General web-agent benchmarks did not predict real task performance.

Root cause: Success varied by website/task, and real food-ordering workflows involved dynamic state changes absent from broad averages.

Resolution: Build representative simulations for the actual target tasks and measure repeated success.

“web Arena which turns out doesn't translate at all to the test we were doing”transcript, stated
“how many times out of 20 would this thing succeed on a task that we care about”transcript, stated

Agents got stuck in loops or did not know what to do next.

Root cause: Planner tasks, action spaces, and coordinate-to-action mapping were unclear for complex pages.

Resolution: Separate planning/execution, reduce the tool/action space, and provide more specific instructions.

“most of the times we saw agents getting stuck in Loops um um and uh yeah just not knowing what to do next”transcript, stated
“maybe the task was not clear or the task that the planner gave was not clear so or the action space was not clear”transcript, stated

Screenshots and DOMs can both mislead web agents.

Root cause: Raw DOMs contain irrelevant information, while visual models struggle to map desired actions to exact coordinates.

Resolution: Clean DOMs, keep only useful clickable elements, and combine visual/page-state strategies selectively.

“there is a lot of information there but the agent doesn't need all of it uh it should get as least information as possible”transcript, stated
“where on this website do you click to do that just understanding what is the coordinate that corresponds to the action I want to take”transcript, stated

Over-agentifying deterministic work reduced control.

Root cause: The first design used an agent to retrieve user database information even though a direct data pull was sufficient.

Resolution: Use deterministic data loading for prerequisites and reserve agents for genuinely open-ended web navigation.

“I very naively built an agent that could uh interact with the database retrieve the information but actually we didn't need to do that”transcript, stated
“why would you use an agent if you can just pull the data and add it to the context”transcript, stated

Food ordering cannot proceed without required user context.

Root cause: Execution needs prerequisite information such as address and desired dishes before web navigation can succeed.

Resolution: Make the planner deterministically verify required inputs before invoking the web executor.

“to have all all the right information to be able to perform the task so this was very important for instance you cannot uh order food if you don't have an address yeah like the user has to be willing to to provide the address um yeah so yeah this was a was a challenge uh and to be back to go”transcript, stated
“the planner needs to know that it needs to provide an address a list of dishes and so on”transcript, stated

High-level frameworks were useful for prototyping but not enough for production control.

Root cause: Production e-commerce agents need predictable behavior, modularity, and scale readiness.

Resolution: Distill the prototype into modular software with deterministic workflows and controlled agentic components.

“it's really tempting to use all these high level Frameworks with high level of of abstraction um do everything through an agent but this is not the right way”transcript, stated
“their deterministic workflows are much more preferred if you can”transcript, stated

Evaluation

Evaluation used representative e-commerce tasks, task variations, repeated simulations, and success-state definitions such as finding an item or adding it to cart. The target success rate was 80%, with results interpreted by website, task complexity, and user specificity.

Metrics: Success rate over repeated task attempts · Target success rate of 80% · Representative e-commerce task completion · Task variation robustness · Agents stuck in loops · Required-prerequisite completeness · Fast-mode versus traditional-mode success

4 supporting quotes
“we chose some uh tasks that were representative of uh typical e-commerce um interactions and we try to optimize for those”transcript, stated
“go and explore and as long as we've defined what success looks like like for example found the couch or added it to cart”transcript, stated
“our Target was 80% yeah okay but it of course it heavily depends on the task and on the website and on the user itself”transcript, stated
“one that the actual average results didn't didn't compare but also um they were super unpredictable right so one time they worked one time didn't so we'd had have to devise simulations where we would go to look at how many times out of 20 would this thing succeed on a task that we care about”transcript, stated

Outcomes

The source reports Prosus-scale consumer context of about two billion users, a prediction that 10% of e-commerce transactions may be agent-run, six months of web-agent work, repeated task simulations such as success out of 20 attempts, an 80% target success rate, and eventual platform-scale requirements of tens to hundreds of millions of users.

4 supporting quotes
“at the end we decided to uh build our own basically framework like your own build our own web agent”transcript, stated
“storing all the trajectories that the agent had done we defined three modes that the agent could operate”transcript, stated
“our Target was 80% yeah okay but it of course it heavily depends on the task and on the website and on the user itself”transcript, stated
“this is not data science project but a software engineering project where there are some um some llm steps in”transcript, stated