Courses / System Design Interview / Chapter 47
Module 10 · Design Problems V: AI and Data Systems · Chapter 47 of 49
Design an AI Code Assistant
Builds on Non-Functional Requirements: Availability, Scale, Latency and More, Back-of-the-Envelope Estimates, Distributed Caches, Rate Limiters, AI Building Blocks: Inference, Embeddings, Retrieval and Agents, Design an Online Judge like LeetCode, Design a Chat Assistant like ChatGPT and Design an LLM Customer Support Bot. Next up: Lessons from Real System Failures.
Part 1 · Requirements: completion, chat and edits
Three jobs in one editor
A code assistant sits inside an editor, suggesting the next lines as you type, answering questions about a project and making edits on request. The hard parts are not the model but the code around it: which code to send, how fast to answer, and how far to trust the reply.
The three jobs are different enough to design apart. Inline completion offers ghost text at the cursor, and the developer decides in a moment whether to press Tab. Chat answers a question about the code in a side panel, with the reply streamed as it is written. An agentic edit takes an instruction such as rename this field everywhere and fix the tests, reads and changes several files, runs checks, and shows a diff for a person to approve.