Restaurant Order Agent (LangGraph)
LangGraph agent that takes a food order, checks stock, then simulates cooking and serving with retries at each stage.
- Python
- LangGraph
- LangChain
- Groq
- Pydantic
Problem
Explore how a multi-step ordering process (validate the request, extract the order, check stock, cook, serve) with retries and user decisions can be modelled as a LangGraph workflow.
Approach
Built with LangGraph and a Groq-hosted LLM (openai/gpt-oss-120b). The LLM acts as a food-only guardrail and extracts the dish and quantity through Pydantic structured output. The order is checked against a fixed menu and marked confirmed, partial or unavailable; for partial orders the user chooses to accept the available amount or place a new order. Cooking and serving are simulated, with retry limits at each stage, and the LLM writes the apology and success messages.
Architecture
Graph nodes: llm_node -> order_confirm -> user_decision (for partial or unavailable orders) -> cook -> serve. Cooking succeeds 60% of the time with up to 2 attempts; serving succeeds 80% of the time, and a serving failure sends the order back to cook while retries remain. Order, cook and serve retry counters are kept in the typed graph state.
Results
| Metric | Verified Value | Context |
|---|---|---|
| Demo run | Order "2 pizza" cooked and served successfully (status: complete) | Console demo with simulated cooking and serving |
What I Learned
Modelling the workflow as a graph with typed state made every retry limit and failure path explicit. The console version waits for the user with input() inside a node; in a real application LangGraph's interrupt mechanism would be the better fit.