---
title: Conversational Book Discovery
summary: Routing, grounding, privacy, and response generation for a chat turn.
owners:
  - ai-capabilities-team
badges:
  - content: Runtime Scenario
    backgroundColor: purple
    textColor: purple
---

Chat API coordinates a synchronous, streaming conversation turn across routing, privacy, specialist agents, and read-only knowledge sources. It never mutates baskets or orders.

## Purpose & Trigger

The flow helps a customer discover books, answer store questions, or summarize ratings. It starts when Storefront sends an authenticated chat turn.

## Visual References

_Conversational Book Discovery_

<MermaidFileLoader file="mermaids/004-conversational-book-discovery-diagram-1.mmd" />

## Step-by-Step Walkthrough

1. Storefront sends the turn through API Gateway. Chat API validates the caller and rate limit, loads session state, and rejects unsafe or oversized input.
2. Microsoft Foundry routing determines whether the request concerns a book, store policy, or rating and whether disambiguation is needed.
3. When intent is unclear, Chat API pauses and asks Storefront to collect a clarification. Execution resumes after the customer chooses an intended route.
4. For book or policy work, Chat API anonymizes outbound PII through Presidio and invokes the appropriate specialist and model.
5. Book specialists synchronously query MCP Tools for read-only catalog facts. The tools return grounded data from Catalog API.
6. Rating requests invoke the remote Rating API specialist synchronously over the agent interface.
7. Chat API checks tool permissions and applies response safeguards, formats the result, and persists the updated session.
8. The final response streams to Storefront over the conversation channel.

## Error Handling & Edge Cases

- Prompt validation and routing rejection short-circuit unsafe or out-of-scope turns.
- A stalled disambiguation remains bounded by workflow timeouts and conversation limits.
- MCP Tools or Rating API failures return a bounded workflow error rather than a mutation or fallback write.
- Model and tool outputs are checked for privacy and policy compliance before delivery.

## Quality & Consistency Notes

- Session data and conversation state are persisted separately from catalog and review state.
- Catalog and rating answers reflect live read boundaries at the time of the tool call.
- The flow is advisory: it cannot reserve inventory, change prices, or create commerce state.
