Search⌘ K
AI Features

Requirements of the AI Code Assistant API

Understand how to define requirements for an AI code assistant API supporting code completion, repository questions, and assisted edits. Explore editor context, conversation history, streaming, cancellation, request tracking, latency targets, scalability, privacy, reliability, and platform prerequisites such as indexing and telemetry.

An AI code assistant helps developers write, understand, and modify code within their editors. It uses context from the developer’s current work, such as the open file, code around the cursor, and selected text, to provide relevant assistance. Supporting these interactions requires an API that connects editor clients with inference services and keeps suggestions aligned with the code being edited.

In this chapter, we’ll design an AI code assistant API that supports three core operations: completion, chat, and assisted edits. Our API will allow developers to request code suggestions, ask questions about their code, and receive proposed changes for review. For example, a developer might accept a suggested next line, ask how an existing function works, or request a change to a selected block of code.

We’ll examine how the services involved use editor and repository context to produce relevant results. The API will also track request identifiers and file versions so that clients can associate each result with the correct editor state, discard outdated suggestions, and cancel requests that ...