---
title: Handle book discovery requests
summary: Guidance for direct book answers, recommendations, and delegated research.
version: 1.0.0
type: guides
order: 2
badges:
  - content: Guide
    backgroundColor: teal
    textColor: teal
---

**Audience & Outcome:** This guide is for AI engineers and catalog integrators working with [[agent|book-agent]] inside [[service|chat-api]]. You will learn how [[agent|book-agent]] balances direct catalog lookups, concurrent sub-agent research, Plan Mode approvals, and strict catalog grounding.

BookWorm handles catalog search, title lookups, and tailored recommendations through [[agent|book-agent]]. Rather than running a heavy multi-step research pipeline on every turn, [[agent|book-agent]] answers simple lookups directly via read-only [[service|mcp-server]] tools, delegates complex multi-criteria requests to two concurrent specialist researchers, and enforces explicit catalog grounding so missing facts are never invented.

## Context and motivation

Customer book discovery spans a wide complexity spectrum—from single-step factual questions (_"Do you have books by Frank Herbert?"_) to open-ended, multi-constraint recommendations (_"Find two short science-fiction novels under \$20 similar to Dune and verify which authors are in stock"_).

Running multi-agent research on simple queries adds unnecessary latency and token cost, while answering complex queries with a single shallow lookup produces incomplete or hallucinated recommendations. BookWorm resolves this tension by combining direct MCP tool calls, optional Plan Mode approval, concurrent sub-agent delegation, and strict catalog-only grounding.

## How it works

The visual below shows how [[agent|book-agent]] retrieves catalog facts through [[service|mcp-server]], fans out complex queries to parallel researchers, and coordinates handoffs or rich UI rendering.

<MermaidFileLoader file="mermaids/02-handle-book-discovery-diagram-1.mmd" />

### Five core discovery mechanisms

1. **Read-only MCP catalog grounding:** [[agent|book-agent]] and both researchers call only four read-only tools exposed by [[service|mcp-server]] (`search_catalog`, `get_book`, `list_categories`, `list_authors`), backed by [[service|catalog-api]] over gRPC. When a price, rating, or availability fact is absent from tool output, [[agent|book-agent]] states that the detail is unavailable instead of guessing.
2. **Direct handling vs. concurrent researcher delegation:** For single-step lookups or preference clarifications, [[agent|book-agent]] calls MCP tools directly. For complex requests combining factual verification and preference curation, it invokes [[agent|book-catalog-researcher]] (low temperature `0.2` for factual precision) and [[agent|book-recommendation-researcher]] (temperature `0.4` for curation) concurrently, then synthesizes and deduplicates their findings.
3. **Plan Mode and Execute Mode harness:** For multi-step research, **Plan Mode** decomposes the work into tracked todos, optionally persists the plan, and waits for customer approval before switching to **Execute Mode**. Single-step lookups bypass planning and approval.
4. **User-scoped memory and compaction:** Episodic and semantic memory recalls user-scoped reading preferences (keyed by Microsoft Entra ID user claims) without inferring demographics or stereotypes. Context compaction preserves multi-step research findings across long conversations.
5. **Client-side UI tools and specialist handoffs:** When Storefront supplies client-side UI tools, [[agent|book-agent]] invokes rich cards or basket actions (enforcing browser-side user confirmation); otherwise it falls back to Markdown. For review analysis, it resolves a single book ID before handing off to [[agent|rating-agent]]; for store policies, it hands off to [[agent|qa-agent]].

:::note
All [[agent|book-agent]] and researcher tool calls pass through [[service|presidio-api]] PII middleware, guardrail middleware, decision-based tool selection, and default-deny governance policies.
:::

<AccordionGroup>
<Accordion title="Design trade-offs and alternatives considered">

| Decision                                                  | Benefits                                                                                                                     | Costs and limits                                                                 |
| :-------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------- |
| **Conditional delegation to two specialized researchers** | Keeps simple lookups fast while pairing factual verification with recommendation curation on complex queries                 | Adds synthesis and deduplication logic when one branch returns partial results   |
| **Plan Mode approval gate for multi-step research**       | Prevents wasted tool calls when criteria are ambiguous and keeps steps transparent                                           | Adds an extra conversational turn if the customer has not approved the plan      |
| **Strict catalog-only grounding**                         | Eliminates fabricated titles, authors, prices, or stock states                                                               | Produces narrower answers when catalog metadata or vector matches are incomplete |
| **Client-side Storefront basket tools**                   | Lets customers inspect or add books without giving [[service\|chat-api]] direct write authority over [[service\|basket-api]] | Rich cards and basket actions depend on Storefront tool registration             |

**Rejected alternatives:**

- **Running parallel researchers on every query:** Doubles latency and token usage on simple title or author lookups without improving accuracy.
- **Exposing [[service|catalog-api]] gRPC directly inside [[service|chat-api]]:** Bypassed central MCP governance, inspector debugging, and reuse across [[system|chat-system]] and [[system|rating-system]].

</Accordion>
</AccordionGroup>

## Related documentation

- [[flow|agent-orchestration]] — End-to-end orchestration flow for [[service|chat-api]].
- [[adr|adr-005-govern-agent-tools-per-agent]] — Per-agent tool governance and least-privilege rules.
- [[adr|adr-006-user-scoped-episodic-and-semantic-memory]] — User-scoped memory isolation for [[agent|book-agent]].
