DEV Community

Miguel Miranda de Mattos
Miguel Miranda de Mattos

Posted on

You’re Not Writing Code Anymore — You’re Designing Agents

Agentic Coding

Why senior engineers must rethink the development loop in the age of autonomous systems
The Shift Is Already Happening
For decades, software engineering has been a story of abstraction:

assembly → high-level languages
servers → cloud platforms
scripts → pipelines
Agentic coding is the next step — but this time, the abstraction is not over infrastructure.

It is over the act of development itself.

You are no longer just writing code.
You are designing systems that write, run, and fix code.

The Moment Everything Changes
Most engineers today have used AI coding assistants.

They autocomplete. They suggest. They accelerate.

But they stop here:

Here is the code.
Agentic systems cross that boundary.

They operate in a loop:

Goal → Generate → Execute → Observe → Fix → Repeat

And crucially:

They do not stop until the system works.

Start Small: The Fibonacci Agent

Goal:

Write a Python script that computes Fibonacci numbers

def generate(goal, error=None):
    return llm(goal + (f"\nFix error: {error}" if error else ""))
while True:
    code = generate("fibonacci")
    try:
        exec(code)
        break
    except Exception as e:
        error = str(e)
Enter fullscreen mode Exit fullscreen mode

This is the smallest useful agent.

The Core Loop (The Real Abstraction)

while not success:
    code = generate(goal, error)
    write(code)
    rc, out, err = run()
    error = err
Enter fullscreen mode Exit fullscreen mode

This loop is:
a compiler
a debugger
a DevOps pipeline
a junior engineer

Minions vs Stripes

Minions (WHAT):

  • run code
  • install dependencies
  • write files

Stripes (HOW):

  • retry loop
  • error handling
  • decision flow

Architecture: Minimal Autonomous Coding System

      +------------------+
      |       LLM        |
      +------------------+
                ↓
      +------------------+
      |   Code Generator |
      +------------------+
                ↓
      +------------------+
      |   File System    |
      +------------------+
                ↓
      +------------------+
      |   Runtime        |
      +------------------+
                ↓
      +------------------+
      |  Error Feedback  |
      +------------------+
                ↓
           Control Loop
Enter fullscreen mode Exit fullscreen mode

Extended with:

  • Dependency Installer (pip/npm/go)
  • Process Manager (servers, timeouts)
  • Retry Strategy (stripe)

The Experiment: One Goal, Three Implementations

Build a REST API that stores user notes
The objective was not just to generate code, but to:

  • 1. execute it
  • 2. resolve failures
  • 3. adapt to each ecosystem
  • 4. reach a running system autonomous ly

We then applied the same loop across:

Python (FastAPI)
Go (net/http)
TypeScript (Express)
The goal stayed the same. Only the environment changed.

Full working implementations:

https://github.com/mmmattos/agentic-coding-demo

Python Agent (FastAPI)

import subprocess, re, os, time
from openai import OpenAI
client = OpenAI()
WORKDIR = "python_agent"
FILENAME = os.path.join(WORKDIR, "app.py")
os.makedirs(WORKDIR, exist_ok=True)
def generate(goal, error=None):
    prompt = f"Build a FastAPI notes API. Fix errors: {error}"
    r = client.responses.create(model="gpt-4.1-mini", input=prompt)
    return r.output_text
def run():
    p = subprocess.Popen(["python", "app.py"], cwd=WORKDIR,
                         stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
    time.sleep(3)
    if p.poll() is None:
        return 0, "", ""
    out, err = p.communicate()
    return p.returncode, out, err
def fix(err):
    m = re.search(r"No module named '(.+?)'", err)
    if m:
        subprocess.run(["pip", "install", m.group(1)])
        return True
    return False
error = None
for _ in range(5):
    code = generate("REST API", error)
    open(FILENAME, "w").write(code)
    rc, out, err = run()
    if rc == 0:
        break
    if fix(err):
        continue
    error = err
Enter fullscreen mode Exit fullscreen mode

Go Agent

import subprocess, re, os, time
from openai import OpenAI
client = OpenAI()
WORKDIR = "go_agent"
FILENAME = os.path.join(WORKDIR, "main.go")
os.makedirs(WORKDIR, exist_ok=True)
def generate(goal, error=None):
    prompt = f"Build a Go REST API with net/http. Fix errors: {error}"
    r = client.responses.create(model="gpt-4.1-mini", input=prompt)
    return r.output_text
def run():
    p = subprocess.Popen(["go", "run", "main.go"], cwd=WORKDIR,
                         stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
    time.sleep(3)
    if p.poll() is None:
        return 0, "", ""
    out, err = p.communicate()
    return p.returncode, out, err
def fix(err):
    if "go.mod file not found" in err:
        subprocess.run(["go", "mod", "init", "notesapi"], cwd=WORKDIR)
        return True
    m = re.search(r"no required module provides package (.+?);", err)
    if m:
        subprocess.run(["go", "get", m.group(1)], cwd=WORKDIR)
        return True
    return False
error = None
for _ in range(5):
    code = generate("REST API", error)
    open(FILENAME, "w").write(code)
    rc, out, err = run()
    if rc == 0:
        break
    if fix(err):
        continue
    error = err
Enter fullscreen mode Exit fullscreen mode

TypeScript Agent

import subprocess, os, re, time
from openai import OpenAI
client = OpenAI()
WORKDIR = "ts_agent"
FILENAME = os.path.join(WORKDIR, "server.ts")
os.makedirs(WORKDIR, exist_ok=True)
def generate(goal, error=None):
    prompt = f"Build an Express TypeScript REST API. Fix errors: {error}"
    r = client.responses.create(model="gpt-4.1-mini", input=prompt)
    return r.output_text
def setup():
    if not os.path.exists(os.path.join(WORKDIR, "package.json")):
        subprocess.run(["npm", "init", "-y"], cwd=WORKDIR)
        subprocess.run(["npm", "install", "express", "sqlite3"], cwd=WORKDIR)
        subprocess.run(["npm", "install", "-D", "typescript", "ts-node", "@types/node", "@types/express"], cwd=WORKDIR)
def run():
    p = subprocess.Popen(["npx", "ts-node", "server.ts"], cwd=WORKDIR,
                         stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
    time.sleep(3)
    if p.poll() is None:
        return 0, "", ""
    out, err = p.communicate()
    return p.returncode, out, err
def fix(err):
    m = re.search(r"Cannot find module '(.+?)'", err)
    if m:
        subprocess.run(["npm", "install", m.group(1)], cwd=WORKDIR)
        return True
    return False
setup()
error = None
for _ in range(5):
    code = generate("REST API", error)
    open(FILENAME, "w").write(code)
    rc, out, err = run()
    if rc == 0:
        break
    if fix(err):
        continue
    error = err
Enter fullscreen mode Exit fullscreen mode

The Real Insight

The agent is not fixing code.
It is fixing the system.

Failures were environmental:

  • missing dependencies
  • missing modules
  • runtime mismatches
  • process lifecycle

The hardest part of software engineering is not writing code — it’s making systems work.

Unattended agentic coding is the first serious attempt to automate that entire loop.

Key Topics for Next Articles
In this article we have scratched the surface of agentic coding .
In upcoming articles, we'll cover the following topics:

1.Multi-file & Repository-Aware Agents
Move from single-file generation to full project structures (modules, configs, folders).

2.Stateful & Incremental Code Editing
Agents that read, modify, and improve existing code instead of regenerating from scratch.

3.Test-Driven Agentic Development
Shift from “it runs” → “it works” by validating behavior via API calls, tests, and assertions.

4.Robust Environment & Tooling Orchestration
Handling real-world constraints (Python, Node, nvm, dependencies, ports) reliably.

5.Multi-Agent Architectures (Minions & Stripes)
Introduce specialized agents (planner, coder, tester, fixer) collaborating toward a goal.

  1. Observability, Metrics & Feedback Loops Track attempts, failures, convergence, and use richer signals (logs, responses, tests) to guide agents.

Full Code & Examples
https://github.com/mmmattos/agentic-coding-demo

Top comments (0)