Cybersecurity

The Four Stages

Python LLMs GPT AI Agents Git GitHub REST API
1,104 words
🎯 Key Takeaway
AI coding tools evolved through four stages: autocomplete finishes your lines, chat answers questions, assistants read your files and suggest changes, and agents plan, execute, test, and commit autonomously. Each stage adds capability. The agent is not replacing the developer β€” it's extending the developer's reach.

Three years ago, AI finished your code lines. Today, it reads your entire repository, plans a fix, edits multiple files, runs your tests, and commits the result.

That's not a single leap. It's four evolutionary stages, each building on the last. Understanding these stages helps you choose the right tool for your workflow and know what each can (and cannot) do.

This tutorial traces the complete evolution β€” from autocomplete through autonomous agents β€” with a Python demonstration of each stage. It builds on How AI Coding Agents Work and connects to Terminal Agents vs IDEs and Context Engineering.

1. The Four Stages

Stage 1
Autocomplete
Finishes your current line
Stage 2
Chat
Answers coding questions
Stage 3
Assistant
Reads files, suggests edits
Stage 4
Agent
Plans, executes, tests, commits

2. Stage 1: Autocomplete

Autocomplete completes the current line as you type. It predicts the next few characters based on the immediate context.

You type: def calculate_total(items
AI adds: def calculate_total(items: list[dict]) -> float:

You type: for item in items
AI adds: for item in items:
Aspect Detail
What it doesFinishes the current line
Context~1 line (a few hundred characters)
Speed<100ms (real-time)
Can read files?❌ No
Can edit files?❌ No
Can run commands?❌ No

Examples: GitHub Copilot, Codeium, Tabnine

3. Stage 2: Chat

Chat answers coding questions in a conversation. You ask, it explains. But it can't see your files.

You: "What is a decorator in Python?"

AI: "A decorator is a function that modifies another function's
     behavior. Use @decorator_name above the function definition.
     Example: @timer, @cache, @login_required"

You: "Show me how to use it with a REST API"

AI: "Here's an example with Flask..." # generates snippet
Aspect Detail
What it doesAnswers questions, explains concepts, generates snippets
Context~4K-8K tokens (conversation history)
Speed1-5 seconds
Can read files?❌ No (only what you paste)
Can edit files?❌ No
Can run commands?❌ No

Examples: ChatGPT, Claude.ai, Gemini

4. Stage 3: Coding Assistant

A coding assistant lives in your IDE and can read your files. It suggests multi-line changes across your codebase.

You: "Add type hints to the calculate function in main.py"

# Assistant reads main.py...
# Finds the function...
# Proposes a change:

- def calculate(items):
+ def calculate(items: list[dict]) -> float:

πŸ’‘ Suggestion: Added type hints to calculate function.
πŸ“‹ You review and accept or reject.
Aspect Detail
What it doesReads files, proposes multi-line edits, explains changes
Context~32K-128K tokens (relevant files)
Speed2-10 seconds
Can read files?βœ… Yes
Can edit files?⚠️ Suggests only (you approve)
Can run commands?❌ No

Examples: Cursor (edit mode), GitHub Copilot Chat, Cody

5. Stage 4: Coding Agent

A coding agent plans, executes, tests, and commits β€” autonomously within your approval boundaries.

You: "Fix the failing test in test_api.py"

Agent plans:
  1. Read test_api.py to understand the expected behavior
  2. Read api.py to find the bug
  3. Fix the code
  4. Run pytest to verify
  5. Review git diff

Agent executes:
  βœ… [file_reader] Read test_api.py
  βœ… [file_reader] Read api.py
  βœ… [file_editor] Fixed bug in api.py
  βœ… [terminal] pytest β€” 12/12 passed
  βœ… [git] diff: 1 file changed, 3 insertions, 1 deletion

You review: git diff β†’ looks good β†’ git commit
Aspect Detail
What it doesPlans, reads, edits, runs tests, uses Git, iterates
Context~128K-1M tokens (entire codebase)
Speed10 seconds to 5 minutes
Can read files?βœ… Yes
Can edit files?βœ… Yes (with approval)
Can run commands?βœ… Yes (pytest, git, npm, etc.)

Examples: Claude Code, Cursor Agent, Aider, OpenCode

6. Side-by-Side Comparison

Capability Autocomplete Chat Assistant Agent
Read filesβŒβŒβœ…βœ…
Edit filesβŒβŒβš οΈβœ…
Run commandsβŒβŒβŒβœ…
Use GitβŒβŒβŒβœ…
PlanβŒβŒβŒβœ…
Run testsβŒβŒβŒβœ…
Human approvalβ€”β€”βœ…βœ…
Context window~1 line~4-8K~32-128K~128K-1M
Latency<100ms1-5s2-10s10s-5min

7. The Agent Loop in Detail

Stage 4 agents follow a loop that repeats until the task is complete:

Plan β†’ Read β†’ Edit β†’ Test β†’ Review β†’ ↻ Repeat or βœ“ Done

What Each Step Does

Step Tool Used What Happens
PlanLLM reasoningCreates step-by-step plan for the task
Readfile_readerLoads relevant files into context
Editfile_editorMakes code changes
TestterminalRuns pytest, npm test, etc.
ReviewgitShows diff for human approval

The loop typically runs 2-5 iterations. If tests fail, the agent reads the error, fixes the code, and re-runs tests β€” without human intervention.

8. Human Approval: The Safety Boundary

Even autonomous agents don't operate without oversight. The key safety model:

Agent suggests β†’ Human decides.
The agent proposes changes. You review the diff. You approve or reject. The agent never commits without your explicit approval.
Action Approval Level
Read a fileAutomatic (no approval needed)
Run a testAutomatic (read-only)
Edit a source fileReview diff before accepting
Install a packageConfirm before executing
Git commitReview message + diff
DeployExplicit approval required

9. When to Use Each Stage

Task Best Stage Why
Typing a function nameAutocompleteFastest, least disruptive
"What is a decorator?"ChatConceptual question, no codebase needed
"Add type hints to main.py"AssistantNeeds to read file, suggest changes
"Fix the failing test"AgentNeeds to read, edit, test, iterate
"Refactor the auth module"AgentMulti-file, multi-step, needs tests
"Explain this codebase"AssistantRead-only, explanation-focused

10. FAQ

Will agents replace developers?
No. Agents extend developers, not replace them. The agent proposes; the developer decides. Complex architectural decisions, business logic, and code review still require human judgment. Agents are powerful tools, not autonomous coworkers.
Can an agent break my code?
Yes, if you approve bad changes. That's why agents run tests after edits β€” if tests fail, the agent knows the change broke something and attempts to fix it. Always review the git diff before committing. Use version control so you can revert.
What's the difference between an assistant and an agent?
An assistant suggests changes β€” you review and apply them manually. An agent executes changes, runs tests, and iterates automatically. The key difference is execution: assistants don't touch your files, agents do (with your approval).
Should I always use the most powerful stage?
No. Use the simplest tool that works. Autocomplete for typing, chat for questions, assistant for file-aware suggestions, agent for multi-step tasks. Over-using agents for simple tasks wastes time and tokens. For more on token management, see AI Tokens and Context Windows.

Continue Learning

πŸ’¬ Discuss on BestWordz Community

Join the conversation about Python, LLMs, GPT on the BestWordz Community forum.

Visit Forum β†’