What is Code Generation?
Code generation and coding agents, told as a story about a parrot that read a mountain of code and fixes it by running it with its own toolbox.
The carpenter asks: why does this function fail? The parrot read a mountain of code too.Code is text too. The pile the parrot read holds encyclopedias, novels, and a lot of code.
Code has tight rules, so the beans fit well. But it continues plausible code too.With mountains of examples, the next bean fits well. But the plausible parrot shows up in code too — calling libraries and functions that do not exist.
A coding parrot reads and writes code, runs it with its tools, and fixes it.The toolbox holds open-file, run, and search. A parrot that runs and fixes on its own is called a coding agent.
Note, code, red error, fix, green pass. Hand back the error and it runs a few laps.Give the tests first and the laps get fewer. Pass means it matches what the tests asked — nothing more.
Passing is not the same as safe. And code pasted without understanding — later nobody can fix it.Security holes are found separately with code scanning. After the green ✓ come human eyes. The parrot that plans its own steps is the agent story.
Code generation = a parrot that read a mountain of code picking the next code bean well. A coding agent is the parrot that runs and fixes with its toolbox. After the ✓, a person reads.
Code has strict grammar and vast public examples, so next-token prediction fits it especially well. A coding agent uses tool calls (read, write, run, search) to run tests and iterate on the errors. Typical risks are calls to APIs that do not exist (hallucination), security vulnerabilities, and unmaintainable code, so code review and secure-coding scans are needed.
When grown-ups say it
- Code generation
- The parrot that writes code. Tight rules and mountains of examples make the next bean fit well.
- Coding agent
- The parrot with a toolbox. Opens files, runs them, fixes them. → the parrot that plans its own errands
- Code completion
- Saying the next line first. While you type, it shows the next few beans ahead of time.
- Test-driven
- The target first. Give the tests first and the parrot fixes the code to pass them.
- Execution feedback
- Handing back the red error. Show it the error message and it fixes itself. A few laps.
- Code review
- A person reads and merges. The step after the ✓. → the last step is human
- Secure coding
- Finding the security hole. Passing does not mean safe. → code scanning
- Tool calling
- The toolbox. The parrot writes a note asking for a tool and the trainer runs it. → the toolbox