Conversation architecture and boundaries
Workflow layers, session persistence tiers, governance controls, and domain boundaries for Chat API and MCP Tools.
Purpose & Scope
This document defines the runtime workflow stages, three-tier session and memory model, governance controls, and cross-domain boundaries for Chat APIServicev1.0.0Chat APIInternal HTTP host for BookWorm's interactive multi-agent chat workflow, agent discovery, and session persistence. Ownerai-capabilities-teamDiagramRepositoryOpen docs and MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs in the ConversationalDomainv1.0.0ConversationalRoutes BookWorm customer requests through privacy-filtered AI agents for catalog-backed book discovery and read-only sto...Ownerai-capabilities-teamDiagramOpen docs subdomain. Use it to verify where Conversational responsibilities start and end relative to CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs, ShoppingDomainv1.0.0ShoppingCoordinates the customer basket and pre-purchase checkout intent, from selecting books through handing an accepted purch...Ownercommerce-fulfillment-teamDiagramOpen docs, OrderingDomainv1.0.0OrderingCreates durable Orders from a buyer's current basket, locks purchase-time pricing, and owns order lifecycle transitions ...Ownercommerce-fulfillment-teamDiagramOpen docs, and ReviewsDomainv1.0.0ReviewsCaptures individual customer feedback for books, publishes rating changes for Catalog discovery, and provides privacy-sc...Ownercatalog-experience-teamDiagramOpen docs.
Visual Reference
The visual below shows how storefront chat requests traverse the API Gateway and Chat APIServicev1.0.0Chat APIInternal HTTP host for BookWorm's interactive multi-agent chat workflow, agent discovery, and session persistence. Ownerai-capabilities-teamDiagramRepositoryOpen docs workflow layers to reach Microsoft Foundry, Chat Session Blob StorageContainerv1.0.0Chat Session Blob StorageAuthoritative Azure Blob Storage container owned by the Conversational bounded context for durable AG-UI multi-turn chat...Ownerai-capabilities-teamDiagramOpen docs, Presidio APIServicev1.0.0Presidio APIExternal HTTP sidecar API for detecting PII in text and anonymizing detected entities in the Chat and Rating AI agent pi...SubscribesAnalyzeText, AnonymizeText +3APIsOpenAPIOwnerplatform-engineering-teamDiagramOpen docs, MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs, and Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs.
Loading graph...
Conversational Workflow, Governance, and Integration Boundaries
Core Invariants & Design Rules
- No relational database, cache, or message broker: Chat APIServicev1.0.0Chat APIInternal HTTP host for BookWorm's interactive multi-agent chat workflow, agent discovery, and session persistence. Ownerai-capabilities-teamDiagramRepositoryOpen docs uses no PostgreSQL, Redis, or Kafka. All state is split across durable AG-UI session blobs in Chat Session Blob StorageContainerv1.0.0Chat Session Blob StorageAuthoritative Azure Blob Storage container owned by the Conversational bounded context for durable AG-UI multi-turn chat...Ownerai-capabilities-teamDiagramOpen docs, ephemeral container-local research scratchpads, and user-scoped Microsoft Foundry preference memory.
- Strict read-only domain boundaries: Chat APIServicev1.0.0Chat APIInternal HTTP host for BookWorm's interactive multi-agent chat workflow, agent discovery, and session persistence. Ownerai-capabilities-teamDiagramRepositoryOpen docs and MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs never mutate backend domain state. Catalog access is read-only via MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs over gRPC to Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs; review summarization is read-only via A2A gRPC to Rating AgentAgentv1.0.0Rating AgentRead-only review intelligence specialist that summarizes customer feedback over A2A gRPC and map-reduce workflows while ...PublishesAnalyzeText, AnonymizeTextOwnercatalog-experience-teamDiagramRepositoryOpen docs on Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs; store-policy answers come strictly from static policy skills with zero live access to Basket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets, Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs or Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs.
- Client-side basket isolation: Any user-confirmed basket UI actions (
addToBasket,viewBasket,showBasketSummary) execute strictly in the Storefront browser client, never as server-side mutations in Chat APIServicev1.0.0Chat APIInternal HTTP host for BookWorm's interactive multi-agent chat workflow, agent discovery, and session persistence. Ownerai-capabilities-teamDiagramRepositoryOpen docs. - Layered safety & confidence gating:
- Input validation: Enforces non-empty prompts, truncates inputs over
2000characters to1900characters, and rejects prompt-injection patterns before model routing (bypassing pure tool-result resume turns). - Decision routing & HITL disambiguation: Evaluates safety, English language, and in-scope confidence (
< 0.5rejects) plus route confidence (< 0.6pauses for human-in-the-loop disambiguation acrossbook,qa, andrating). - Response formatting: Strips leaked system-prompt markers, passes empty strings on tool-call-only turns, and falls back to a safe rephrase prompt if no assistant text remains.
- Input validation: Enforces non-empty prompts, truncates inputs over
- Constrained specialist handoffs: Book AgentAgentv1.0.0Book AgentPrimary conversational book discovery and recommendation specialist that grounds catalog answers in read-only MCP lookup...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs may hand off to Rating AgentAgentv1.0.0Rating AgentRead-only review intelligence specialist that summarizes customer feedback over A2A gRPC and map-reduce workflows while ...PublishesAnalyzeText, AnonymizeTextOwnercatalog-experience-teamDiagramRepositoryOpen docs (only when a single book UUID is resolved; terminal—cannot hand back) or to QA AgentAgentv1.0.0QA AgentRead-only customer support and store-policy specialist that answers operational, shipping, returns, account, and billing...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs (for store-policy questions); QA AgentAgentv1.0.0QA AgentRead-only customer support and store-policy specialist that answers operational, shipping, returns, account, and billing...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs may hand off book-specific portions to Book AgentAgentv1.0.0Book AgentPrimary conversational book discovery and recommendation specialist that grounds catalog answers in read-only MCP lookup...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs. Emotional book feedback is handled inline by Book AgentAgentv1.0.0Book AgentPrimary conversational book discovery and recommendation specialist that grounds catalog answers in read-only MCP lookup...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs without persisting Reviews FeedbackEntityv1.0.0FeedbackRepresents an individual customer's rating and optional written review for a Catalog book.Ownercatalog-experience-teamOpen docs.
Tool governance is default-deny. Any new MCP tool, skill tool, Storefront UI tool, or handoff tool fails silently or returns a governance denial unless explicitly allowlisted for the calling agent identity, and qa-agent must remain explicitly denied access to Catalog tools.
Boundaries & Guarantees
| Concern | Strategy & Guarantee | Failure / Edge-Case Behavior | Related Resources |
|---|---|---|---|
| Persistence | AG-UI transcripts persist durably in chat-session-blob (ag-ui/ prefix) with claims-based per-user isolation; Foundry memory stores cross-session reading preferences by Entra ID subject; working file memory is container-local. | Container restarts preserve AG-UI transcripts and Foundry preferences but discard ephemeral working file scratchpads unless backed by persistent storage. | chat-session-blob, adr-006-user-scoped-episodic-and-semantic-memory |
| Caching & Transport | mcp-server operates as a stateless Streamable HTTP (/mcp) adapter backed by catalog-api gRPC; chat-api exposes /ag-ui and /agents with PerUserRateLimit. | Rate-limit exhaustion returns 429 Too Many Requests with Retry-After; missing Catalog attributes are reported as unavailable rather than guessed. | mcp-server, adr-001-mcp-read-only-domain-adapter, adr-002-stateless-streamable-http-transport |
| Messaging & Protocols | No Kafka messaging; chat-api uses HTTP (/ag-ui), MCP Streamable HTTP (/mcp), and A2A gRPC (2m timeout with Entra Agent Identity token exchange to rating-api). | Unavailable downstream MCP or A2A gRPC calls surface partial-evidence or fallback responses without fabricating catalog or review data. | chat-api, rating-agent, adr-003-separate-interactive-and-agent-protocols |
| Concurrency & Governance | Per-user token-bucket rate limiting (30 token limit, 20 per 10s, queue 5) plus global concurrency limits; Presidio PII middleware redacts sensitive entities on specialist turns; conversation guardian bounds turns (30) and retry cycles (3). | Guardrail, injection, or threshold violations short-circuit the turn with a structured rejection message before invoking specialist tools. | presidio-api, adr-002-fail-closed-pii-middleware, adr-005-govern-agent-tools-per-agent |
Book AgentAgentv1.0.0Book AgentPrimary conversational book discovery and recommendation specialist that grounds catalog answers in read-only MCP lookup...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs can delegate multi-step catalog and recommendation lookups concurrently to Book Catalog ResearcherAgentv1.0.0Book Catalog ResearcherInternal delegated subagent that performs low-temperature factual catalog lookups for the Book Agent and never communica...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs and Book Recommendation ResearcherAgentv1.0.0Book Recommendation ResearcherInternal delegated subagent that curates catalog-verified book shortlists matching customer preferences for the Book Age...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs, synthesizing and deduplicating results while surfacing partial-evidence gaps transparently.
When route confidence is below 0.6, execution pauses at the disambiguation interrupt with
three choices (book, qa, rating). Both structured tool-result responses and plain-text
customer replies (such as 1/book, 2/qa, 3/rating) are normalized to resume the
selected specialist at 1.0 confidence.
Safe Change & Verification Checklist
- Preserve read-only boundaries across Chat APIServicev1.0.0Chat APIInternal HTTP host for BookWorm's interactive multi-agent chat workflow, agent discovery, and session persistence. Ownerai-capabilities-teamDiagramRepositoryOpen docs and MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs; never introduce PostgreSQL, Redis, Kafka, or direct backend write clients.
- Update per-agent governance allowlists whenever adding MCP, skill, harness, or Storefront UI tools, keeping
qa-agentdenied from Catalog tools. - Keep Presidio PII middleware, Entra ID
customerauthorization (chatting_read/chatting_write), claims-based session isolation, and Entra Agent Identity token exchange intact. - Verify prompt validation, routing thresholds (
0.5/0.6), HITL disambiguation resume, specialist handoff preconditions, and session persistence in Chat unit tests viamise run test.
Related Resources
- Chat APIServicev1.0.0Chat APIInternal HTTP host for BookWorm's interactive multi-agent chat workflow, agent discovery, and session persistence. Ownerai-capabilities-teamDiagramRepositoryOpen docs — Conversational workflow host and AG-UI endpoint
- MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs — Stateless read-only Catalog MCP adapter
- Book AgentAgentv1.0.0Book AgentPrimary conversational book discovery and recommendation specialist that grounds catalog answers in read-only MCP lookup...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs, Book Catalog ResearcherAgentv1.0.0Book Catalog ResearcherInternal delegated subagent that performs low-temperature factual catalog lookups for the Book Agent and never communica...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs, Book Recommendation ResearcherAgentv1.0.0Book Recommendation ResearcherInternal delegated subagent that curates catalog-verified book shortlists matching customer preferences for the Book Age...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs, QA AgentAgentv1.0.0QA AgentRead-only customer support and store-policy specialist that answers operational, shipping, returns, account, and billing...PublishesAnalyzeText, AnonymizeTextOwnerai-capabilities-teamDiagramRepositoryOpen docs, Rating AgentAgentv1.0.0Rating AgentRead-only review intelligence specialist that summarizes customer feedback over A2A gRPC and map-reduce workflows while ...PublishesAnalyzeText, AnonymizeTextOwnercatalog-experience-teamDiagramRepositoryOpen docs — Conversational specialists
- Chat Agent OrchestrationFlowv1.0.0Chat Agent OrchestrationA customer submits a conversational request through Storefront; Chat API screens input, routes via a non-LLM classifier ...Ownerai-capabilities-teamView flowOpen docs — End-to-end conversational orchestration flow
- ADR-001: Keep conversational orchestration within the Chat SystemDecision Recordv1.0.0ADR-001: Keep conversational orchestration within the Chat SystemThe Chat System owns request validation, local specialist handoffs, and response formatting while business records remai...Ownerai-capabilities-teamOpen docs, ADR-002: Apply PII filtering to agent input and outputDecision Recordv1.0.0ADR-002: Apply PII filtering to agent input and outputChat agents use Presidio middleware to analyze and anonymize sensitive text, and privacy-processing failures are not byp...Ownerai-capabilities-teamOpen docs, ADR-005: Grant tools according to each agent's responsibilityDecision Recordv1.0.0ADR-005: Grant tools according to each agent's responsibilityChat agents receive only the MCP tools or delegated capabilities needed for their role, with governance policies limitin...Ownerai-capabilities-teamOpen docs, ADR-007: Use Microsoft Decision-1 for Chat routing, safety gating, and tool selectionDecision Recordv1.0.0ADR-007: Use Microsoft Decision-1 for Chat routing, safety gating, and tool selectionReplaces the generative router agent with a provider-agnostic IDecisionClient backed by Microsoft-Decision-1 for single-...Ownerai-capabilities-teamOpen docs
- MS Decisions Model Use Case & Lessons LearnedCustom DocMS Decisions Model Use Case & Lessons LearnedHow BookWorm applies Microsoft-Decision-1 (System 1) for single-pass chat routing, safety gating, and dynamic tool selec...Ownerarchitecture-enabling-teamOpen doc — Routing decision model design and lessons learned