A coding agent takes a task written in plain language and works on it inside a copy of a repository. It reads and edits files, runs commands and tests in an isolated environment, and prepares a pull request for a developer to review.
Popular Examples: GitHub Copilot coding agent, OpenAI Codex, Devin
Suppose a developer opens an issue that says, "The /invoices endpoint returns a 500 when the customer has no billing address. Fix it and add a test." They assign the issue to a coding agent. Twenty minutes later, the agent might return a pull request with a two-line fix, a new test case, passing checks, and a short explanation of the change.
This is quite different from code completion. Completion suggests code in milliseconds. A coding agent works for minutes or hours, makes dozens of model calls, and executes code generated by the model. Building one means solving several problems: running that code safely, finding relevant information in a large repository, recovering from failures during long tasks, and keeping developers in control of what gets merged.
In this chapter, we'll design a hosted coding agent. We'll start with the requirements and high-level architecture, then explore sandbox design, context management for large repositories, command permissions, and recovery for long-running tasks.