 Command

Pranesh Nikhar's personal site. Vim-style keybinds for navigation; theme + font pickers below.

Theme
 Font Body Code
Reader
Keybinds
Navigation
j / ↓ Next item k / ↑ Previous item g First item in region G Last item in region zz Center focused item h / l Move left/right region ] / [ Next/previous heading } / { Next/previous block d / u Half-page down/up
Layout
<zh> / <zl> Toggle left/right sidebar <zr> Toggle reader view <zj> / <zk> Focus main/navbar <S-h/j/k/l> Focus left/main/navbar/right ⌃H / ⌃L Focus left/right sidebar ⌃J / ⌃K Focus main/navbar ⇧C / ⇧E Collapse / expand all sections
Dialogs
⌃P / : Command palette ⌃X Theme picker / Search ? Show keybinds Esc / ⌃C Close dialog
History
n Next document b Previous document ⌃O History back ⌃I History forward
 Search
about: Pranesh Nikhar about/more: 🪪 More docs/test: Docs Test ideas: 💡 Ideas more: ➕ More now: Now posts: 📬 Posts projects: 📚 Projects webtui: Style posts/agentic-eda: AgenticEDA — Automated Exploratory Data Analysis with LangGraph posts/cap-theorem-outage-story: CAP Theorem with a Real Outage Story posts/codepilot: CodePilot — From Requirements to Deployable FastAPI Backend posts/common-auth-mistakes: Common Auth Mistakes Developers Make posts/compiled-vs-jit-vs-interpreted: Why Is X Language Fast or Slow? — Compiled vs JIT vs Interpreted posts/cs-degree-gaps: Things CS Degrees Don't Teach You posts/cve-2025-breach-analysis: CVE-2025 Breach Analysis — Midnight Blizzard and the 16 Billion Credential Leak posts/fixloop: FixLoop — AI Agent Loop for Self-Correcting Code posts/functional-vs-oop: Functional vs OOP — Same Problem, Both Ways posts/getman: Getman — Declarative API Tester for CLI & TUI posts/how-compilers-optimize: How Compilers Actually Optimize Your Code posts/http3-quic: HTTP/3 and QUIC — Why They Matter posts/leetcode-vs-engineering: LeetCode vs Real Engineering Skills posts/llm-from-scratch: LLM from Scratch — GPT-Style Transformer in PyTorch posts/lsm-trees-bloom-filters: LSM Trees & Bloom Filters — Production Deep Dive posts/mcp-workflow-builder: MCP Workflow Builder — Visual DAG for MCP Tools posts/persistent-memory: Persistent Memory — Long-Term Memory for AI Agents via MCP posts/playcli: PlayCLI — Terminal Video Player posts/postgres-mvcc: How PostgreSQL MVCC Works — Multi-Version Concurrency Control Deep Dive posts/raft-consensus: Raft Consensus Algorithm Explained posts/rust-borrow-checker: Rust Borrow Checker — Catches Real Bugs posts/titan: Titan — Terminal AI Coding Agent posts/what-happens-url: What Happens Between Typing a URL and Seeing the Page posts/what-happens-when-you-run-a-program: What Actually Happens When You Run a Program posts/zero-knowledge-proofs: Zero-Knowledge Proofs Explained Simply webtui/components/accordion: Accordion webtui/components/badge: Badge webtui/components/button: Button webtui/components/checkbox: Checkbox webtui/components/dialog: Dialog webtui/components/input: Input webtui/components/popover: Popover webtui/components/pre: Pre webtui/components/progress: Progress webtui/components/radio: Radio webtui/components/range: Range webtui/components/separator: Separator webtui/components/spinner: Spinner webtui/components/switch: Switch webtui/components/table: Table webtui/components/textarea: Textarea webtui/components/tooltip: Popover webtui/components/typography: Typography webtui/components/view: View webtui/contributing/contributing: Contributing webtui/contributing/contributing: ## Local Development webtui/contributing/contributing: ## Issues webtui/contributing/contributing: ## Pull Requests webtui/contributing/style-guide: Style Guide webtui/contributing/style-guide: ## CSS Units webtui/contributing/style-guide: ## Selectors webtui/contributing/style-guide: ## Documentation webtui/installation/astro: Astro webtui/installation/astro: ## Scoping webtui/installation/astro: ### Frontmatter Imports webtui/installation/astro: ### ‹style› tag webtui/installation/astro: ### Full Library Import webtui/installation/nextjs: Next.js webtui/installation/vite: Vite webtui/plugins/plugin-dev: Developing Plugins webtui/plugins/plugin-dev: ### Style Layers webtui/plugins/plugin-nf: Nerd Font Plugin webtui/plugins/theme-catppuccin: Catppuccin Theme webtui/plugins/theme-custom: Custom Theme webtui/plugins/theme-everforest: Everforest Theme webtui/plugins/theme-gruvbox: Gruvbox Theme webtui/plugins/theme-nord: Nord Theme webtui/plugins/theme-vitesse: Vitesse Theme webtui/start/ascii-boxes: ASCII Boxes webtui/start/changelog: Changelog webtui/start/installation: Installation webtui/start/installation: ## Installation webtui/start/installation: ## Using CSS webtui/start/installation: ## Using ESM webtui/start/installation: ## Using a CDN webtui/start/installation: ## Full Library Import webtui/start/installation: ### CSS webtui/start/installation: ### ESM webtui/start/installation: ### CDN webtui/start/intro: Introduction webtui/start/intro: ## Features webtui/start/plugins: Plugins webtui/start/plugins: ## Official Plugins webtui/start/plugins: ### Themes webtui/start/plugins: ## Community Plugins webtui/start/theming: Theming webtui/start/theming: ## CSS Variables webtui/start/theming: ### Font Styles webtui/start/theming: ### Colors webtui/start/theming: ### Light & Dark webtui/start/theming: ## Theme Plugins webtui/start/theming: ### Using Multiple Theme Accents webtui/start/tuis-vs-guis: TUIs vs GUIs webtui/start/tuis-vs-guis: ## Monospace Fonts webtui/start/tuis-vs-guis: ## Character Cells posts/termium: Termium — Chromium-Based Terminal Browser posts/new-projects-july-2026: New Projects — GRIT, Sage, Terrain Analyser, Self-Healing RAG, and More watchlist: 🎬 Watchlist posts/graph-engineering-rag: Graph Engineering replaced RAG at Microsoft, Stanford and Anthropic posts/graph-engineering-claude: Graph Engineering with Claude: 14-Step Roadmap from 0 to Graph Architect posts/agent-harness-loop-graph-engineering: Agent Harness Engineering vs Loop Engineering vs Graph Engineering
 Theme Current: Light j/k or ↑/↓ + Enter

Agent Harness Engineering vs Loop Engineering vs Graph Engineering

A practical guide to the 3 layers people keep mixing together — harness, loop, and graph — and why reliable agent systems need all three designed intentionally.

Most people talk about AI agents like it’s one thing.

It isn’t.

When an agent moves beyond a toy demo and starts touching files, APIs, documents, customers, or production code, you are no longer just “prompting a model.” You are designing a system.

And in that system, three ideas keep getting mixed together:

  1. Agent harness engineering
  2. Loop engineering
  3. Graph engineering

They all sit around the same model. They all affect reliability. And yes, they can all contain loops. But they solve different problems. If you mix them up, you end up debugging the wrong layer.


The 30-Second Answer

Here’s the clean version:

  • Harness engineering builds the environment around the model
  • Loop engineering designs the repeated work-and-feedback cycle
  • Graph engineering makes the workflow topology explicit

A good mental model is: Environment → Feedback → Flow

  • The harness gives the model tools, memory, control, and a workspace
  • The loop decides how work gets retried, checked, and improved
  • The graph defines what step is allowed to happen next

That is the difference.


Why These Terms Matter Now

A raw model cannot do real work by itself. It cannot:

  • maintain project state across sessions
  • safely call tools
  • inspect a browser
  • enforce permissions
  • retry failed work
  • validate output quality
  • route tasks across specialists
  • stop at the right moment

All of that comes from the system around it. As agentic software matures, a practical stack is emerging:

  • The harness gives the model operating conditions
  • The loops make the work repeatable and verifiable
  • The graph makes complex workflows explicit and controllable

Once you see these as separate layers, a lot of AI architecture confusion disappears.


1. Harness Engineering

What A Serious Harness Usually Includes

Context Injection — What the model sees before it acts:

  • instructions
  • retrieved knowledge
  • conversation state
  • memory
  • policies
  • task-specific rules

Action Surfaces — What the model can do:

  • API calls
  • browser actions
  • shell commands
  • code execution
  • MCP tools
  • databases
  • custom functions

Persistence — What survives across time:

  • files
  • checkpoints
  • session state
  • progress logs
  • git history
  • long-term memory

Execution Control — How the run is managed:

  • retries
  • timeouts
  • budgets
  • model selection
  • subagent spawning
  • approval gates

Safety And Governance — What keeps the system safe:

  • least-privilege permissions
  • isolation
  • allowlists
  • secret handling
  • human approval

Observability — What lets you debug it:

  • traces
  • tool inputs and outputs
  • state transitions
  • latency
  • cost
  • eval results

Why Harness Engineering Matters

Two teams can use the same model and get completely different outcomes. Why?

Because one team gives the model:

  • clean tools
  • stable state
  • structured memory
  • clear permissions
  • observable execution

And the other gives it:

  • a vague prompt
  • messy tools
  • noisy context
  • no memory
  • no verification

The model may be the same. The working conditions are not.

Harness engineering matters whenever the agent:

  • cannot access the right capability
  • loses context between sessions
  • acts inconsistently across environments
  • cannot be audited
  • has too much permission
  • cannot recover cleanly after interruption

If the model cannot operate reliably, the first place to look is the harness.


2. Loop Engineering

What It Is

Every tool-using agent already has a tiny built-in loop:

  1. call the model
  2. observe the result
  3. run tools
  4. feed the observations back
  5. repeat until done

Loop engineering begins when you intentionally design additional cycles around that behavior. Not just “ask again.” Not just “retry.” But a real work-and-feedback system.

Anatomy Of A Good Loop

ComponentDescription
TriggerWhat starts a new cycle? (user request, failed test, new document, scheduled run, webhook, evaluator feedback)
GoalWhat specific condition are we trying to reach? Not “keep improving” — a real target.
StateWhat does the next cycle need to know? (current draft, previous attempt, tool results, errors, progress status)
Action PolicyWhat is the agent allowed to do? (edit, delegate, call tools, spend tokens, write files, open PRs)
EvidenceHow do we know whether it worked? (tests, schema validation, citations, diffs, metrics, reviewer approval)
FeedbackWhat exactly failed? The feedback should be compact and actionable.
Stop RuleWhen does it end? (success, timeout, budget exhausted, max retries hit, irrecoverable failure, escalation to a human)

The Most Important Principle In Loop Engineering

Do not loop on confidence. Loop on evidence.

“The agent says it is done” is not a stop condition. A real stop condition looks more like:

  • the tests pass
  • the schema validates
  • the citations resolve
  • the reviewer approves
  • the policy check is clean

That is loop engineering.

Why Loop Engineering Is Not Just Prompt Engineering

A prompt tells the model what to do during a call. A loop defines what the system does after the call. That includes:

  • how it checks results
  • how it reacts to failure
  • how it persists progress
  • how it decides to continue
  • how it terminates

Prompting improves a response. A loop improves a process. That is a very different engineering problem.


3. Graph Engineering

What It Is

Graph engineering makes workflow structure explicit.

It answers a different question: not just “what should the agent do?” but “what is allowed to happen next?”

In graph engineering:

  • steps are nodes
  • transitions are edges
  • branching is explicit
  • parallel work is explicit
  • joins are explicit
  • retries are explicit
  • human interrupts are explicit

The graph becomes the control map for the system.

What Graph Engineers Actually Design

Node Boundaries — What belongs in a deterministic function, an LLM call, a specialist agent, or a human review step.

State Schema — What each node can read or write.

Routing Conditions — What evidence moves the job forward, backward, sideways, or to escalation.

Concurrency — What can run in parallel, and what must wait.

Cycles And Exits — Where retries are allowed, how many are allowed, and how they stop.

Durability — Where checkpoints happen and how the workflow resumes after interruption.

When Graphs Are Worth It

Graphs are valuable when the process includes:

  • meaningful branching
  • approvals
  • specialist handoffs
  • parallel work
  • recovery paths
  • multi-step workflows with explicit control points

They are less useful when the job is simply: “Give one agent a few tools and let it work.” In that case, a solid harness plus a few loops may be enough.

A graph adds clarity, but it also adds structure. Too much structure too early can make the system brittle.


How The 3 Layers Work Together

Let’s say you are building a research-and-publishing agent. It has to:

  1. scope a topic
  2. gather sources
  3. screen citations
  4. draft a report
  5. pass legal review
  6. publish only after approval

Here’s how the layers map:

LayerResponsibility
HarnessBrowser access, search tools, file workspace, memory, citations, approvals, traces, model routing
LoopRetrying source retrieval when evidence is weak, fixing citation failures, running grader checks, refreshing work when the market changes
GraphControls the path: scoping → research → screening → synthesis → drafting → review → publication, with a human gate before release

That is why the 3 layers are not interchangeable. They work together, but they are not the same thing.


Diagnose The Failure Before You Pick The Fix

Here’s the practical rule:

If the agent cannot operate, fix the harness. Examples: missing tool access, stale state, weak memory, bad permissions, no observability.

If the agent almost works but is unreliable, fix the loop. Examples: first draft is close but weak, success is inconsistent, retries are uncontrolled, there is no proof of completion.

If the process itself is complex, fix the graph. Examples: many specialists, approvals, branching logic, parallel paths, structured handoffs.


Common Mistakes

1. Building The Graph Too Early

Teams often diagram a huge workflow before seeing how the work actually behaves. Better approach: start with a simpler harness, collect traces, find the stable patterns, formalize only what deserves control.

2. Letting The Same Model Write And Grade Without Safeguards

Self-review can help, but it shares the same blind spots. Prefer: deterministic checks where possible, separate reviewer context, external evaluators, human approval for high-impact actions.

3. Using “Keep Trying” As A Loop

That is not a loop design. That is an uncontrolled cost leak. Every loop needs: a measurable goal, real evidence, retry limits, escalation rules.

4. Treating The Harness Like A Junk Drawer

More tools do not automatically mean better agents. Too many tools create: selection mistakes, noisy context, weak reliability, wider risk surface. A good harness is not crowded. It is precise.

5. Blaming The Model For Orchestration Failures

A model cannot compensate for: broken APIs, stale state, missing exit conditions, vague tool schemas, invisible failure modes. Fix the layer that owns the failure.


A Simple Production Checklist

LayerChecklist
HarnessAre tools narrow and documented? Is state durable? Are permissions least-privilege? Can operators pause, inspect, and resume? Are traces visible?
LoopWhat evidence proves success? What feedback is returned on failure? How many retries are allowed? What is the stop rule? What happens when the budget runs out?
GraphWhich paths must be deterministic? What can run in parallel? Where are the human gates? What state is shared? Where do recovery paths begin?
EvaluationCan you replay real traces? Can you compare versions? Can you attribute improvement to a real change?
OperationsAre you tracking cost? Latency? Failure rate? Intervention rate? Task success in production?

The Simplest Way To Remember The Difference

If you only remember one thing, remember this:

  • Harness engineering makes the model operational
  • Loop engineering makes the work iterative and verifiable
  • Graph engineering makes the execution path explicit and controllable

None replaces the others.

A perfect graph will not save a weak harness. A strong harness will still waste money without good loops. And clean loops become hard to manage when branching and approvals stay hidden in ad hoc code.

Reliable agent systems show up when all 3 layers are designed intentionally. That is the actual architecture stack.


Final Takeaway

People keep talking about AI agents like the breakthrough is the model.

In production, that is rarely the real differentiator. The differentiator is the system around the model:

  • the harness that lets it work
  • the loops that let it improve
  • the graph that lets it operate under control

That is how toy agents become real systems.

 praneshnikhar.site / posts / agent-harness-loop-graph-engineering · Top 1:1