DEV Community

weiwuji
weiwuji

Posted on

From Loop to Graph: Our 52-Day Agent Engineering Evolution

The Pain: You just wrapped your head around Loop Engineering, and now the AI world is talking about Graph Engineering. You learn one concept, the next arrives — forever chasing, never landing.
What You'll Learn: A real, working Agent engineering evolution path (Prompt → Context → Loop → Graph), each layer with physical evidence — not invented concepts, but steps I actually took over 52 days.


0. Not a Concept Race, an Engineering Evolution

A recent essay, "Beyond Workflow: Toward Graph Engineering," nailed the key point:

"Many people think the upgrade path for Workflow is adding more nodes, more branches, and more conditionals. But once complexity truly grows, the question is no longer 'how to add nodes' — it's how to describe entities, relationships, state, and dynamic decisions in a changing environment. That is the fundamental divide between Graph Engineering and traditional Workflow."

Many treat Graph Engineering as "yet another concept" to chase. For practitioners like us, it is not a concept — it is the next stop on an evolution path. And I have genuinely walked that path.


1. Scaffold Evolution Overview: Prompt → Context → Loop → Graph

Agent scaffold evolution in four stages

Stage Core Question Abstraction Level Bottleneck
① Prompt Engineering How to make the model understand Single conversation Complex tasks can't finish in one shot
② Context Engineering How to give enough context Single session Limited window / noisy input
③ Loop Engineering How to execute in loops Looping execution Runaway loops / no state
④ Graph Engineering How to coordinate multiple agents Multi-agent orchestration State management / failure localization

Evolution logic: each stage solves the bottleneck of the previous one —

Prompt (single-shot capability) → Context (memory capability) → Loop (execution capability) → Graph (organization capability)
Enter fullscreen mode Exit fullscreen mode

2. Our Context: Query the Index First, Then Feed Context

My first stop was Context Engineering. The classic pitfall: feeding the entire knowledge base to the LLM — context explosion, burning tokens, slow answers.

Context engineering two-step method

I switched to a two-step method:

  1. Query the index: the knowledge base maintains a static "concept → article" mapping table plus rule matching, locating "which nodes to look at" in milliseconds
  2. Feed relevant fragments: only the matched nodes go to the LLM — slimmer context, dramatically lower token cost

This is a lightweight RAG: no vector database, no embeddings — cheaper and faster for small knowledge bases.


3. Our Loop: Harness Engineering (the Core of 52 Days)

The second stop was Loop Engineering — my deepest investment and biggest payoff. Its core isn't "let the loop run," it's making every loop iteration stronger:

Harness engineering: error-immunity closed loop

Error occurs
→ ① error-ledger records it (symptom → root cause → fix → status)
→ ② correction sedimentation (distill into rules/skills)
→ ③ physical rule materialization (write into verify scripts/gates)
→ ④ gate immunity (blocked at the gate)
→ back to ① (new errors keep coming)
Enter fullscreen mode Exit fullscreen mode

Real evidence (what I ran over 52 days):

  • error-ledger: every corrected error is structurally recorded (symptom → root cause → fix → status)
  • Daily self-evolution cron (21:00 every night): automatic error review + hot-topic research + topic suggestions
  • Gate matrix: 6 physical gates before task output (task context exists / skill exists / rules executed / timeout / regression / schema)
  • Maker/Checker separation: producer and verifier are physically separate — no self-review

This is the complete closed loop from "Self-Improving Agents Are Not a Myth"reflection is probabilistic, evolution is physical.


4. Our Quasi-Graph: Multi-Agent Collaboration (in Progress)

The third stop is Graph — we're already running it, we just hadn't named it in "graph" language yet.

Our multi-agent collaboration graph

Using my production business agent system as an example:

  • Nodes: Email Agent / Report Agent / Ticketing Agent / Writing Agent (each with its own role)
  • Edges: Maker produces → Checker validates → gate allows/blocks (the collaboration relationship)
  • Shared state: SQLite (ticketing) + ledgers + knowledge base (append-only)
  • Governance: rules → verify scripts → gate matrix (the governance layer of the graph)

Key insight: we never wrote a line of "graph framework" code, yet our system is naturally a graph — because as complex tasks multiply, agents naturally evolve from "one person doing everything" to "a team working together". Graph isn't invented; it's the natural result of evolution.


5. The Four-Layer Agent Engineering Scaffold (Practitioner Path)

If you want to build your own Agent engineering system, build it in this order (the order I actually hit):

Layer What It Is Verification Standard
① Context Engineering (foundation) Knowledge base + index + memory management Knowledge retrieval hit rate > 90%?
② Loop Engineering (skeleton) Loops + error records + correction sedimentation + gates The same error never happens twice?
③ Observability (nervous system) Gates + audit + tracing + ledgers Can you localize a failure within 5 minutes?
④ Graph Engineering (organization) Multi-agent + state management + dynamic decisions Adding an agent doesn't disturb the others?

Don't skip layers: jumping straight to Graph without solid Context = a graph full of "amnesiac nodes." My 52-day order was Context → Loop → quasi-Graph, with evidence at every layer.


6. Cognitive Upgrade: Graph Is the Watershed

Graph Engineering is the watershed from "engineering" to "architecture."

Before (Prompt/Context/Loop): how to make an Agent do work (engineering)
After (Graph/platform): how to design an Agent organization (architecture)
Enter fullscreen mode Exit fullscreen mode

Future AI competition isn't only about model capability — it's about how to design an intelligent system that reliably completes complex tasks. That consensus is growing. And for designing "intelligent systems," the graph is the correct abstraction.

For us: Graph Engineering is not another concept — it's the engineering answer to "how to manage agents once you have many."


7. Where You Are Now

You no longer settle for "learning one more concept" — you start asking "which layer is my agent system on now, and how should it evolve next."

You are becoming the practitioner who turns concepts into scaffolds.

Remember: Prompt asks, Context remembers, Loop runs, Graph organizes. Evolution with physical evidence at every layer is what real engineering looks like.


📖 Further Reading

  • Self-Improving Agents Are Not a Myth: A Complete Loop from Error-Ledger to Loop Engineering — the full practice of the Loop stage
  • Practice = Technology × Scenario × Value: What Cognitive Monetization Means in the AI Era — the practitioner methodology
  • Why "All-Powerful" Agents Fail: Scene Routing That Splits One Agent into 6 Experts — node splitting for multi-agent collaboration
  • The Observability Trio: Gate + Audit + Correction — A Feedback Loop for Commercial Agents — the governance layer of the graph

About the author: Wu Ji (无记) — AI & digitalization practitioner focused on Agent engineering, Loop Engineering, and digital transformation. Practical, hands-on tutorials — follow along and it just works.

Top comments (0)