Restaurant Menu AI Concierge with Hyperbrowser
In this cookbook, we'll create an AI-powered restaurant menu concierge using Hyperbrowser. Unlike traditional restaurant review apps that just show static menu information, our agent will:
- Navigate directly to a restaurant's website
- Analyze the complete menu in real-time
- Make personalized recommendations based on dietary preferences
- Calculate total meal costs
- Consider presentation quality for social media worthiness
All with just a few lines of code and a natural language prompt!
Prerequisites
Before beginning, you'll need:
- A Hyperbrowser API key (sign up at hyperbrowser.ai if needed)
Store your API key in a .env
file in the same directory as your code.
Step 1: Import Libraries and Set Up Environment
import osfrom dotenv import load_dotenvfrom hyperbrowser import AsyncHyperbrowserfrom hyperbrowser.models import StartBrowserUseTaskParamsfrom IPython.display import Markdown, displayload_dotenv()
Step 2: Initialize the Hyperbrowser Client
hb = AsyncHyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
Step 3: Define the Menu Recommendation Function
This function demonstrates the power of autonomous web agents for specialized tasks:
- It takes a natural language request with multiple parameters (restaurant name, meal type, dietary restrictions, aesthetic preferences)
- The agent navigates to the restaurant's website without requiring a specific URL
- It identifies and interprets the menu, filtering based on dietary preferences
- It uses vision and judgment to select Instagram-worthy options and calculates total cost
Unlike traditional web scrapers that would break with website changes, this approach adapts automatically to different restaurant websites and menu formats.
async def menu_suggestions(user_requirements: str):resp = await hb.agents.browser_use.start_and_wait(StartBrowserUseTaskParams(task=f"You are a restaurant menu concierge. You are tasked to satisfy the users requirements to the best of your ability. Here are the users requirements: {user_requirements}.",use_vision=True,))if resp.data is not None:return resp.data.final_resultreturn None
Step 4: Execute the Agent and Display Personalized Recommendations
The output below shows real-time menu recommendations from Rooh SF based on the specified dietary preferences and presentation criteria. The agent has successfully:
- Found the restaurant's website
- Identified vegetarian options across menu categories
- Selected visually appealing dishes
- Created a three-course meal recommendation
- Calculated the approximate total cost
response = await menu_suggestions("I want to go to rooh SF for dinner, and I'm looking for a 3 course meal. I'm vegetarian, so keep that in mind when suggesting a menu. While not required, it'd be nice if the food looked instagram worthy. Also return me the approximate cost of the meal.")if response is not None:display(Markdown(response))else:print("No response from the agent")
Okay, I can suggest a 3-course vegetarian meal at Rooh SF. For an appetizer, I recommend the Dahi Puri ($16), described as semolina puff with yogurt mousse, containing flavors of avocado, tamarind, raspberry, and mint. For the main course, I suggest the Paneer Pinwheel ($28), which is paneer cheese stuffed and rolled with nuts & spices, and layered over tomato makhni gravy. Finally, for dessert, I recommend the Panna Cotta ($15). The approximate cost of this meal is $16 + $28 + $15 = $59. I have chosen these items based on the menu descriptions and the likelihood that they would be visually appealing.
Another example
Let's explore another example of our menu recommendation agent in action. This time, we'll focus on a different cuisine and restaurant - Momofuku NY, known for their ramen dishes. In this example, 'll:
- Navigate to Momofuku NY's website
- Specifically look for their ramen offerings
- Present all available ramen options
- Recommend the most savory option based on menu descriptions and ingredients
This demonstrates how our agent can handle specific dish inquiries rather than full course meals, showing its flexibility across different types of requests.
response = await menu_suggestions("I'm looking to go to Momofuku NY. I'm curious about what choices they have for ramens. Get me all the choices, and suggest me the most savory one.'")if response is not None:display(Markdown(response))else:print("No response from the agent")
Momofuku Noodle Bar in East Village offers the following ramen choices:
-
Garlic Chicken Ramen: baby spinach, poached egg. Price: 21
-
Pork Ramen: pork belly, poached egg, bamboo. Price: 22
-
Spicy Mushroom Ramen: miso, toasted chili oil, yu choy. Price: 22
Based on the description, the Pork Ramen sounds like the most savory option due to the inclusion of pork belly.
Conclusion
This cookbook demonstrates how Hyperbrowser can transform complex web-based tasks into simple natural language requests. The menu recommendation agent we've built:
- Searches google and navigates to the correct website
- Finds specific elements within the page that correlate to location.
- Finds elements in the page and recommends them based on the users criterias.
- Gives practical information like pricing to inform dining decisions
- Can be easily modified to search any restaurant or accommodate any dietary preference
This approach can be extended to create specialized agents for various domains beyond restaurants - from travel planning to product research - anywhere web data needs to be intelligently filtered and presented.