KatInterview

Build a Conversational Catalog Search Agent with Guardrails

System DesignModel answer
MediumModel answerSystem Designagentic-searchretrievalllm-agents

Last updated

Design a multi-step conversational search assistant over a read-only catalog that clarifies intent, enforces hard constraints, grounds answers in records, and falls back safely.

You are asked to design a conversational search assistant. A user describes what they want in plain language, and the system may ask a follow-up question, run searches, compare candidates, and refine its answer over several turns.

Use a read-only product catalog as the example corpus. Users may phrase needs informally (for example, a budget, a use case, and a few "nice to haves"), and every result you show must be backed by records the system is allowed to read. No traffic level, latency target, model, or vendor is given, so state your own assumptions.

Taking actions such as placing an order is out of scope. If you suggest any, describe them as a separate extension with their own contract.

Questions worth raising first

  • Which attributes are structured fields, and which exist only in free text?
  • Which kinds of requests need a clarifying turn, and which should just return results?
  • How fresh must data be, and which fields (price, availability) need an authoritative check before display?
  • How do you trade off result quality, factual grounding, latency, and cost?

Part 1: The interaction

Walk through one request from first message to final answer: clarification, retrieval, comparison, and refinement. Explain:

  • How the system separates hard constraints from soft preferences.
  • How it conveys uncertainty and the absence of good matches.
  • How constraints persist across turns and get corrected when the user changes their mind.

Part 2: The agent and retrieval system

Describe the components, the tools the agent can call, and the data flow. Explain how you prevent:

  • Claims unsupported by catalog data
  • Unbounded tool use
  • Stale results
  • Retrieved text overriding the agent's instructions

Also say where an agent actually helps, where plain deterministic search is enough, and how you would evaluate the system, including failure modes unique to agent planning.

Hints

Hint 1

Treat the user's request as a structured state object (hard filters, soft preferences, open questions) that is updated each turn, rather than as raw chat history the model must reinterpret.

Hint 2

Let code, not the LLM's prose, enforce hard constraints: the model proposes filters, the search layer applies them, and a validator checks every displayed claim against a record field.

Hint 3

Route simple, well-specified queries straight to conventional search; only invoke the multistep agent when ambiguity, comparison, or reformulation clearly adds value, and cap steps, tokens, and tool calls.

Hint 4

Evaluate against a plain keyword/faceted search baseline, and add agent-specific metrics: unnecessary clarifications, constraint violations, ungrounded claims, loop/step counts, and injection robustness.