Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Session-Scoped Document Q&A Agent

Design a multi-tenant document-grounded chat agent with resumable ingestion, low-latency streaming, interruption, and separate document and conversation lifecycles.

Problem statement

For this exercise, assume an enterprise agent lets a tenant-authorized user upload as many as 200 PDF, DOCX, TXT, or CSV documents totaling hundreds of megabytes in one session, then conduct a streaming multi-turn question-and-answer conversation grounded in those documents.

Support more than 100,000 active sessions, target first token in under 500 milliseconds and the complete answer in under three seconds, and keep a metadata-only session list responsive within 10 milliseconds.

Treat uploaded documents and retrieved passages as untrusted data: they must not widen tenant authorization, tool access, or system instruction scope. Upload, generation, and stop requests need durable identities and explicit duplicate, overloaded, stopped, committed, expired, and uncertain outcomes.

A user can stop an in-progress generation. Uploaded source bytes and every vector derivative must be physically deleted after 24 hours, while chat history remains available for seven days and marks citations unavailable after source expiry.

Explain ingestion status, parse/chunk/embed orchestration, retrieval, streaming, caching, tenant isolation, guardrails, provider throttling, interruption and billing, failure recovery, idempotency, and expiry.

Exclude model training, document editing, external web search, voice, image generation, and permanent knowledge-base administration.

What to build

  1. A tenant-authorized user can idempotently upload and observe ingestion of up to 200 supported documents totaling hundreds of megabytes in one session, and can list metadata-only session summaries without reading document contents.
  2. A user can conduct a multi-turn conversation whose streamed answers cite evidence retrieved only from that session's authorized document versions while treating all retrieved text as untrusted data.
  3. A user can idempotently stop an in-progress generation and observe the terminal message, stream, and billing outcome even after a lost response.
  4. The platform physically deletes source documents and vector derivatives after 24 hours while retaining privacy-safe chat history for seven days.

At scale

  • Support more than 100,000 active sessions, with as many as 200 PDF, DOCX, TXT, or CSV documents and hundreds of megabytes of uploaded data per session.
  • Target time to first token below 500 milliseconds, complete-answer latency below three seconds, and session-list access below 10 milliseconds.
  • Physically delete uploaded documents and vector derivatives after 24 hours, while retaining chat history for seven days.