Please enable JavaScript to use CodeHS

Are LLMs Smarter Than a 5th Grader? — Advanced

Advanced: What are coding agents?

A coding agent is an AI agent specialized for software engineering. It can read a codebase, write new code, run tests, and fix bugs. It combines an LLM with tools like a file system, terminal, test runner, and version control.

Coding Agents ~14 min Upper High School
The Big Idea

Beyond completion

A coding agent goes beyond writing the next few lines of code. It can read multiple files, understand a task, plan changes, run tests, and iterate when something fails. The same ReAct loop we saw earlier applies: think, act, observe, repeat.

Coding agents are used for tasks like refactoring, adding features, writing tests, fixing bugs, and answering questions about large codebases. They do not replace software engineers, but they change the nature of the work.

Key idea: a coding agent is a human-machine collaboration. The engineer provides direction, reviews output, and handles architecture; the agent handles routine implementation and exploration.


CS Minute

The write-test-debug loop

Modern software engineering is built on fast feedback. Write code, run tests, see what fails, fix it. Coding agents can accelerate this loop by handling the mechanics of editing and testing.

The agent receives a specification and a codebase. It proposes a change, runs the test suite, reads error messages, and patches the code. This cycle continues until tests pass or the agent gives up and asks for help.

Good agents also know their limits. They ask for clarification when a specification is ambiguous, and they avoid risky changes that could break production.


How It Works

Tools a coding agent uses

A coding agent is only as capable as its tools. Typical tools include:

  • File system: read, write, and search files in a repository.
  • Shell: run commands, install packages, and inspect environment state.
  • Test runner: execute unit tests and report failures.
  • Version control: view diffs, make commits, and open pull requests.
  • Linter: catch style issues and potential bugs before tests run.

Tool descriptions are written into the prompt so the model knows what it can call and what arguments each tool expects.


Critical Thinking

Limitations and the human role

Coding agents can be confidently wrong. They may introduce subtle bugs, change code in ways that break existing behavior, or produce code that is hard to maintain. Code review remains essential.

Humans still define the problem, design the architecture, evaluate trade-offs, and ensure the software is safe, fair, and maintainable. In the best teams, agents are force multipliers, not replacements.

Career note: understanding systems, testing, and design becomes even more valuable when agents can generate code. The job shifts toward specifying, verifying, and integrating.


Interactive

Debug a function

The function below is supposed to return the average of a list of numbers, but it has a bug. Try to spot the problem, then click Run agent fix to see what a coding agent would change. The console shows a simple simulation.

// console output appears here

Code

A coding agent loop

A coding agent can read files, edit code, run tests, and reflect on errors. This Python loop shows the same cycle in miniature.


Your Turn

Check yourself

What skills become more important for a software engineer if coding agents can write routine code?

Your answer:

Sample answer: As agents generate routine code, human engineers spend more time on problem specification, architecture, testing, debugging, security, and review. The job becomes higher-level and more focused on making sure the right thing is built correctly.


Check Yourself

Quick quiz

1. What makes a coding agent different from a simple code completion model?

2. Which of the following is a typical tool for a coding agent?

3. Why is human review still important when using coding agents?

Keep learning

You now understand coding agents. In the final advanced tutorial, we put it all together and ask: are LLMs really smarter than a 5th grader?

Part of the advanced remake of the “Are LLMs Smarter Than a 5th Grader?” series.