01 · The problem
A sales agent that invents a product detail costs a customer, so no product answer comes from the model directly: every one is routed through retrieval, and greetings bypass retrieval entirely.
02 · How it works
- 01
Built the conversation as a LangGraph state machine, intent to retrieval to lead capture to response, with a typed state carrying intent, stage and extracted fields across turns.
- 02
Classified intent with an LLM and rule-based checks together rather than prompting alone, so a misread message fails to a safe branch, and covered the graph with 55 tests before deploying it live.
- 03
Routed every product answer through retrieval rather than the model, with greetings short-circuited so they never trigger a retrieval call.
03 · What it cost, and what it returned
Built the agent as a LangGraph state machine with a typed state object carrying intent, stage, retrieved context and extracted lead fields across turns, covered by 55 tests.
