KatInterview

Design a Multi-Agent AI Chat Platform for Financial Services

System DesignModel answer
MediumModel answerSystem Designsystem-designllm-architecturestreaming

Last updated

Design a scalable and secure backend system for an LLM-powered multi-agent financial assistant with real-time streaming, conversation persistence, and strict compliance controls.

Design the backend architecture for an enterprise financial assistant platform powered by Large Language Models (LLMs) and specialized autonomous agents.

Context & Requirements

Users interact with a chat interface to ask complex financial questions, review market data, generate financial models, and analyze internal corporate filings. The platform must handle agent orchestration behind the scenes while maintaining real-time responsiveness and strict financial compliance.

Core Functional Requirements

  1. Interactive Chat & Streaming: Process user messages and stream assistant responses with low initial token latency.
  2. Context & State Management: Maintain session state, allow conversation resumption/branching, and manage context token limits efficiently.
  3. Multi-Agent Orchestration: Route incoming user requests across autonomous agents (e.g., Query Planner, RAG Retriever, Deterministic Calculator, Compliance Checker, and Final Synthesizer).
  4. Tool Execution Gateway: Securely execute internal database queries, third-party financial API calls, and code execution sandboxes.
  5. Auditing & Compliance: Provide deterministic audit trails, strict PII/MNPI (Material Non-Public Information) filtering, and enforcement of document access control lists (ACLs).

Non-Functional Requirements

  • Scale: Support 50,000 active users, 5,000 peak concurrent active sessions, with a system load of ~20 incoming user messages per second (fanning out to ~200 agent/LLM calls per second).
  • Latency: Time-to-first-token (TTFT) should be under 1.5 seconds for direct queries; multi-step analytical workflows must stream intermediate status events.
  • Reliability & Isolation: 99.9% uptime. System state must persist across worker node crashes. Zero cross-tenant data leaks.

Describe the system architecture, API schemas, data models, worker orchestration flow, and strategies for handling failure and security.

Hints

Hint 1

Decouple the initial message ingestion HTTP request from the long-lived response stream. Consider how persistent run IDs allow client reconnects without re-triggering model generation.

Hint 2

LLMs frequently struggle with precise financial arithmetic. How can your agent framework delegate math operations to a sandboxed execution engine?

Hint 3

How do you enforce fine-grained access control (ACLs) when performing vector similarity searches across confidential financial documents?