In this article
Before you start
Coding agents are one kind of AI agent, and this page assumes you can already write a basic prompt.
Why interviewers ask this
A candidate who treats a coding agent as a fast typist ships changes nobody checked, and a candidate who treats it as a loop with a check step ships changes that were tested. Interviewers use agentic coding questions to see which of the two you are. One prompt reported by candidates asks you to design the model and system behind a coding assistant that has inline completion in an editor and an agent mode with awareness of a whole repository.
A weak answer names a model and a chat box. A strong answer names the loop, where the tests run, who can interrupt, and what the loop costs. Public sources do not describe one standard company format for this round, so this page claims none; it covers what a strong candidate can explain in any format.
What does an AI-assisted coding round assess?
Many searchers mean a coding round in which you may use an AI coding assistant or agent. Candidates report such rounds, and public sources do not describe one standard format, so ask the recruiter what is allowed. A strong candidate shows four habits: splitting the task into small steps the tool can do and you can check, steering the tool with specific instructions, reading the diff and running tests before trusting a change, and explaining the trade-offs of the final code in their own words. To prepare, practise those four habits on a small project with a tool you know, and say your reasoning out loud as you work.
Agentic coding from first principles
- Agentic coding
- Agentic coding is a way of building software in which a language model works toward a coding task by repeatedly calling tools, such as file search, file edit and a test runner, and reading the results, instead of writing one reply and stopping. The model chooses each next tool call itself.
- Agentic harness
- An agentic harness is the layer of software around a language model that provides its tools, runs the tool calls the model requests and manages the context the model sees. The Claude Code documentation uses the term for the layer around the model, so the model only decides what to do next and the harness does it.
- Turn
- A turn is a cycle of the agent loop that starts when the model reads the context and ends when the results of the tool calls it requested, run by the harness, return to the model. A task can take many turns, and every turn costs a model call, so cost and delay grow with the turn count.
In plain words
Think of a contractor fixing a leak. She looks at the pipes first. She makes a repair. She turns the water on to check. If it still drips, she goes round again. That is the loop.
The analogy breaks in one place. The contractor knows when she is done. A model only knows what its tool results say, so it can stop too early or keep going too long.
In one precise sentence, a coding agent is a model plus tools plus a harness, run in a loop of gathering context, acting and verifying until a stop condition is met.
Step 1: Gather context
Gather context is the phase in which a coding agent searches and reads files until the task makes sense, usually before changing anything, though the documentation says these phases blend together. The Claude Code documentation says a task works through three phases, gather context, take action and verify results, and that a bug fix cycles through all three repeatedly. The input is a task such as "the login test fails".
The output is a set of files and error messages in the context, which is the text the model can see. The harness manages that context, so what the agent reads is limited by what fits. The context rot page covers what goes wrong when the context grows too long. You now know where the loop starts: with reading, not writing. An edit made without context is a guess.
Step 2: Take action
Take action is the phase in which the model asks for a tool call and the harness carries it out. The model chooses the next step and the harness runs the tools. The agent loop documentation says Claude evaluates the prompt, calls tools to take action, receives the results and repeats until the task is complete, and that each set of tool results feeds back for the next decision. Typical tools are file search, file edit and a command runner.
The input is the context so far; the output is one tool call and its result. The same documentation says hooks can intercept, modify or block tool calls before they run, which is where a team can enforce a rule such as "never edit this directory" (an illustrative rule). ReAct is a research method that prompts a model to generate verbal reasoning traces and actions in an interleaved manner (Yao et al., 2022), the idea behind this alternation. The Model Context Protocol page covers one way tools are connected.
Step 3: Verify results before errors compound
Verify results is the phase in which the agent checks its own change, most often by running tests and reading the output. Verification matters because errors compound across the steps of a loop. All 20 steps succeed only 0.3585 of the time at 95% per step, while the figure is 0.8179 at 99% per step (illustrative rates).1 A check after each step gives the agent a chance to notice and repair a bad step before the next one builds on it.
A check is only as strong as its test. A green run shows that the tests pass, not that the change is right, so a strong candidate also reads the diff. The input is the edited code; the output is pass or fail evidence that feeds the next turn. The agent evaluation page covers how teams measure this at scale.
Step 4: Repeat, steer and stop
The agent loop repeats until the task is complete, and the person can interrupt at any point. Each full cycle through the loop is one turn. The Claude Code documentation says you can interrupt to steer the agent in a different direction, add context or ask for a different approach, so "autonomous" does not mean "no human"; the human in the loop agents page covers where approvals fit.
A loop also needs explicit stop conditions. Reasonable ones are a passing test run, a turn limit you set, or a question back to the user when the task is unclear. Anthropic advises finding the simplest solution possible and increasing complexity only when needed, because agentic systems often trade latency and cost for better task performance.
Step-by-step description
- Search and read files first.
- The harness runs the tool call.
- Run tests and read the output.
- Next turn, or stop on a clear condition.
- The model chooses the next step and the harness runs the tools.
- Each full cycle through the loop is one turn.
Knowing it is half the job. Saying it is the other half.
Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.
Start Free Trial →Worked example
Take the task "the login test is failing, fix it", run as an illustrative five-turn session. Turn 1 searches for the login test. Turn 2 reads the test and the code it calls. Turn 3 edits one function. Turn 4 runs the tests, and one still fails. Turn 5 edits again and reruns the tests, which now pass. Every turn sends the whole context to the model again.
Suppose the first prompt is 2,000 tokens and each turn adds 1,500 tokens of tool output (illustrative assumptions, caching ignored). Then the five turns read 25,000 input tokens in total, against 2,000 for a single call, and 20 turns would read 325,000, which is 162.5 times a single call.1 That is the latency and cost trade-off Anthropic describes, shown as arithmetic.
| Quantity (illustrative inputs) | Value |
|---|---|
| All 5 steps succeed at 95% per step | 0.7738 |
| All 10 steps succeed at 95% per step | 0.5987 |
| All 20 steps succeed at 95% per step | 0.3585 |
| All 40 steps succeed at 95% per step | 0.1285 |
| All 20 steps succeed at 90% per step | 0.1216 |
| All 20 steps succeed at 99% per step | 0.8179 |
| Input tokens read by one call | 2,000 |
| Input tokens read across 5 turns | 25,000 |
| Input tokens read across 20 turns | 325,000 |
Text description of the diagram
- All 20 steps succeed only 0.3585 of the time at 95% per step.
- The figure is 0.8179 at 99% per step.
Trade-offs and edge cases
Workflow or agent?
A workflow is a system in which code you wrote decides the order of model and tool calls. Anthropic draws this line: workflows orchestrate models and tools through predefined code paths, while agents dynamically direct their own processes. In short, a workflow follows predefined code paths and an agent directs its own process. The workflow is predictable and cheaper to test; the agent handles tasks whose steps you cannot list in advance. Anthropic also notes that for many applications, optimizing single model calls with retrieval and in-context examples is usually enough. So the senior answer is not "use an agent", it is "start with the simplest design that works and add agency when the task demands it".
Text description of the diagram
- A workflow follows predefined code paths and an agent directs its own process.
- Inline completion is one prediction at the cursor, trained with fill-in-the-middle.
What a benchmark score does and does not show
The software engineering (SWE) benchmark SWE-bench Verified is a set of 500 Python-only problems in which a model gets a codebase and an issue and must write a patch (Epoch AI). The patch is checked by two sets of tests, called Pass-to-Pass and Fail-to-Pass. Epoch reports that most problems need under an hour from a human engineer and that the benchmark does not capture the full spectrum of software engineering work.
OpenAI (February 2026) says Verified is increasingly contaminated, reports scores rising from 74.9% to 80.9% in six months, and audited 138 problems (27.6% of the set) that models often failed to solve. It found that at least 59.4% of the audited problems had flawed test design and/or problem description, which is at least 82 problems.1 OpenAI recommends SWE-bench Pro. A high score is therefore not proof of a good engineer or agent.
Inline completion is a different problem
Inline completion is one prediction at the cursor, trained with fill-in-the-middle. Fill-in-the-middle is a data transformation that moves a span of text from the middle of a document to its end, so a left-to-right model learns to infill (Bavarian et al., 2022). The authors report that training with a large fraction of transformed data does not harm left-to-right ability. A coding assistant therefore has two designs: a fast completion path that must keep up with typing in the integrated development environment (IDE), and an agent loop with tools and verification. Keep them separate in your answer.
How would you design an agentic AI coding assistant with inline completion?
Completion path. The completion path serves one prediction at the cursor. The client sends the text before the cursor (the prefix) and the text after it (the suffix) from the open file, plus short snippets from nearby files, to a model trained for fill-in-the-middle, so the suggestion fits the code on both sides.
Because the user keeps typing, the client cancels a stale request when a new keystroke arrives and discards late replies, so a suggestion never describes code that has already changed. This path has no tool loop and no test run. It has a latency budget; public sources do not give one, so state yours as an assumption and say what you cut to meet it, such as a smaller model or a shorter context.
Agent path. The agent path is the loop of this page with repository awareness added through search tools, not by loading the whole repository into the context. The Agent software development kit (SDK) documentation lists Glob ("find files by pattern") and Grep ("search content with regex"). The Claude Code documentation says the agent "searches for relevant files, reads multiple files" and contrasts this with "inline code assistants that only see the current file".
Add a sandbox for command execution so a bad command cannot reach the rest of the machine, permissions and hooks that gate risky tool calls, a test run as the verify step, and a turn budget as a stop condition. Close with an evaluation plan: tasks with known tests from your own codebase, judged on the whole trajectory.
Edge cases
A flaky test can send the agent in circles, so cap the turns. A passing test suite can hide a wrong change, so read the diff. A long session fills the context, so the agent may need a fresh start with a short summary. For real tools see Claude Code vs Cursor.
How to answer it in an interview
How would you use a coding agent to fix a failing test, and how do you know the fix is right?
I give the agent a narrow goal and let it gather context first: find the test, read the code it touches. Then it edits and, before I trust anything, runs the tests, because that is the check that closes the loop. If the test passes I still read the diff, since a green run only proves the tests pass. I keep the loop short, interrupt if it drifts, and for a repeatable fix I would script it as a workflow, because more autonomy costs latency and money.
The spoken structure: name the three phases, say where the check happens, then give the trade-off and who stays in control.
Common mistakes
- "The model runs the loop itself." (wrong) The model chooses the next step; the harness runs the tools and feeds results back. (right) "The model decides, the harness executes, and each cycle is a turn."
- "Agentic coding is autocomplete with a chat box." (wrong) Autocomplete is one prediction at the cursor. (right) "An agent is a tool-using loop with verification; completion is a separate low-latency problem."
- "More autonomy is always better." (wrong) Anthropic advises the simplest solution first. (right) "I add agency only when a fixed workflow cannot cover the task, because it costs latency and money."
- "The benchmark score tells me the agent is good." (wrong) The benchmark is narrow, Python-only and has flawed tests. (right) "I treat a score as one narrow signal and test the agent on my own tasks."
Follow-up questions
What are agentic AI coding interview questions?
Agentic artificial intelligence (AI) coding interview questions ask you to explain or design the loop: how an agent gathers context, which tools it gets, how it verifies, and when it stops. See agentic AI interview questions for the wider list, and prepare a real story for have you built any end-to-end agentic systems.
What is the difference between a workflow and an agent?
In a workflow, your code fixes the order of steps; in an agent, the model chooses its own steps and tool use. Workflows suit predictable tasks, agents suit open-ended ones.
How would you design a coding assistant with inline completion and an agent mode?
Split it into a completion path and an agent path, as laid out under the trade-offs above, and state any latency budget as your own assumption.
How do you evaluate a coding agent?
Run it on tasks with known tests and judge the whole trajectory, not only the final patch. Remember that a public benchmark can be contaminated, so add tasks from your own codebase.
Where does the human stay in the loop?
At the start with a clear goal, at any interrupt, at approval of risky tool calls through hooks, and at review of the final diff.
- An agentic coding interview tests whether you can direct and judge a loop of gather context, act and verify.
- The model chooses the next step; the harness runs the tools; each full cycle is a turn.
- Errors compound across steps, so verification after each step is what keeps a long loop trustworthy.
- Start with a workflow and add agency only when needed, because loops cost latency and money.
- A benchmark score is a narrow signal, and inline completion is a separate design problem.
Sources
- Building effective agents — Anthropic Engineering, 19 Dec 2024
- How Claude Code works — Claude Code Docs (Anthropic), 26 Oct 2026
- How the agent loop works — Claude Code Docs, Agent SDK (Anthropic), 26 Oct 2026
- ReAct: Synergizing Reasoning and Acting in Language Models (arXiv 2210.03629) — arXiv (Yao et al., ICLR 2023), 6 Oct 2022
- Why SWE-bench Verified no longer measures frontier coding capabilities — OpenAI, 23 Feb 2026
- What skills does SWE-bench Verified evaluate? — Epoch AI (published 2025; page data last updated on the date shown), 26 Oct 2026
- Efficient Training of Language Models to Fill in the Middle (arXiv 2207.14255) — arXiv (Bavarian et al., OpenAI), 28 Jul 2022