→ / space · N notes · F full
NomadCoder · AI Engineering

Let's Build an
Agent Harness

The twenty lines under every agent — and the truck they can drive.

Varun Srinivas · CTO & Co-Founder, Coditas
Cold Open
That's Claude Code.
Driving a truck.

Same tool that writes my code — running on a Raspberry Pi, driving a toy Cybertruck. How is a robot the same program as a coding assistant?

Who's talking

Hi, I'm Varun.

CODITAS
CTO & Co-Founder
An AI-first software development firm in Pune, India.
BUILD
Vibe Coder
I love building vibe-coded apps and games.
COMMUNITY
Speaker & Host
I love speaking at community events — and host a few at Coditas.
ETHOS
I code, therefore I am
A problem solver and a coder at heart.
Definition · think kitchen, not code

The chef is the talent.
The kitchen is the harness.

the prepped ingredients
the context you set out
knives & pans
the tools it cooks with
taste, adjust, fire again
the loop — act, check, repeat
the health code
the limits it can't cross

A kitchen is everything around the cook that turns raw talent into dinner — on time, every night. An agent harness is the same thing around a model: the model can reason, but the harness is what turns reasoning into work you can serve. Swap the chef — the kitchen still ships dinner.

Why it's the work

A new resource to manage.

01
Network
Move the bytes.
02
Compute
Run the work.
03
Storage
Keep the state.
04
Intelligence
Decide what to do.

For decades, backend meant three resources — and each earned a management layer. Intelligence is the fourth: metered, it scales and throttles, and it fails in new ways. The harness is how you manage it.

The pattern · every resource gets a layer

You never manage a resource
by hand.

Network
the network stack — routing, retries, rate limits
Compute
the scheduler — Kubernetes, autoscaling, pools
Storage
the database — indexes, caching, replication
Intelligence
the harness — context, tools, budget, safety

Each layer allocates the resource, hides its failure modes, and hands you a clean interface. The harness is that layer for intelligence.

The equation
model + harness = agent

The model is the smallest piece of the system — and it keeps shrinking. Everything that makes an agent work is the harness around it. Swap the model, and the same harness holds the output steady.

Reuse · one engine, many products

Build it once.
Reconfigure forever.

CODE
Coding
shell · files · git
WEB
Browser
DOM · clicks · forms
DOCS
Slides
this deck was built by one
BODY
Robot
motors · camera

Held constant: the loop. The only thing that changes is the configuration — skills, tools, the system prompt. Same engine, different passes.

Proof · look at today's agenda

Every talk today is
a different harness.

  • LangGraph — stateful, graph-shaped Dhananjay
  • WebMCP + Angular — a harness in the browser Shaikh
  • Cost & tokens — the same harness, tuned for the bill Sumit
  • Mine — the same loop, driving a truck Varun

Same loop. Different configuration. You'll watch this thesis play out all morning.

Loops · a harness runs on cycles

Not one loop. A few.

01
Agent
the model calls tools until the task is done
02
Verify
a grader scores the output and feeds it back
03
Event
a trigger from outside fires the agent on its own
04
Meta
an agent reads the traces and rewrites the harness

We'll build #1 live. #2 is where guardrails and evals live — a loop wrapped around the loop.

Let's build one.

The loop is the engine — about twenty lines. The harness is the car: brakes, mirrors, a fuel gauge, seatbelts. We'll build the whole car.

Step 1 · Tools are the model's hands
harness.ts — the tools
const tools = {
  read_file: {
    description: "Read a UTF-8 file and return its contents.",
    run: ({ path }) => fs.readFileSync(path, "utf8"),
  },
  write_file: {
    description: "Create or overwrite a UTF-8 file.",
    run: ({ path, content }) => {
      fs.writeFileSync(path, content);
      return `wrote ${content.length} bytes to ${path}`;
    },
  },
};

Two tools. Each is a schema for the model plus a function we run.

Step 2 · Loop #1 in code — the agent loop
harness.ts — run()
async function run(task) {
  const messages = [
    { role: "system", content: SYSTEM },
    { role: "user", content: task },
  ];

  for (let step = 0; step < 10; step++) {
    const { msg } = await callLLM(messages);            //~ think
    if (!msg.tool_calls?.length) return msg.content;    //~ done

    messages.push({ role: "assistant", tool_calls: msg.tool_calls });
    for (const tc of msg.tool_calls) {                  //~ act
      const args = JSON.parse(tc.function.arguments);
      const result = tools[tc.function.name].run(args);
      messages.push({ role: "tool", tool_call_id: tc.id, content: result });
    }
  }
}

Count the lines. ~20. That's loop #1 from two slides ago — the whole agent loop. Everything else is what makes it survivable.

Everything interesting is outside the loop

One line each. A whole talk each.

the y/N permission gate
Safety. Shivprasad — Azure AI guardrails
the token counts per step
Cost. Sumit — Claude Code token optimization
the tool interface
MCP. Shaikh — WebMCP + Angular
MODEL = "z-ai/glm-5.1"
A commodity. Swap it in one string
Better harness · same model
Same loop.
One more tool.

The model didn't change. Its world got bigger. That's the whole game — you upgrade the harness, not the brain.

+ one tool
run_command: {
  description: "Run a shell command.",
  run: ({ command }) =>
    execSync(command).toString(),
},
The rover is this exact loop
read_filelook()
write_filemove()
run_commanddrive()

The camera is a tool that returns "wall · 30cm" — MiDaS turns one image into a symbol. Same loop, same twenty lines. It runs Sonnet, not the biggest model: a body needs reflexes more than genius.

The rover — Raspberry Pi on a toy Cybertruck chassis
Why embodiment teaches
A rover can't fake
having moved.

A software agent believes it turned left and reasons forward on a fiction. A rover that believes it turned left hits a table leg — in front of all of you. Embodiment gives you the verification loop for free. You just can't turn it off.

The whole harness · skeleton vs muscle

Everything a harness manages.

The loop
  • agent loop
  • stop conditions
  • step limits
  • sub-agents / delegation
Model
  • provider adapter
  • structured output
  • routing / fallback
  • retries & backoff
Tools
  • schema validation
  • sandboxing
  • parallel calls
  • MCP
Context & memory
  • window management
  • compaction / summary
  • prompt caching
  • long-term memory · RAG
Safety
  • permissions / confirm
  • budget caps
  • guardrails · injection
  • rate limits
Quality & ops
  • evals / goldens
  • tracing
  • verification loop
  • streaming · checkpoints

built today, ~130 lines  ·  what production adds — every piece bolts onto the same loop

Three things to take home
1
The loop is small.Understand twenty lines of TypeScript and you understand every agent framework.
2
Everything interesting happens outside the loop.When agents misbehave, it's the context, the tools, or the guards — never the model.
3
Own the loop — and the model becomes a commodity.True for a coding agent. True for a truck.

Thank you.

Own the loop. The model is a commodity.

Connect with Varun on LinkedIn
Varun Srinivas · Coditas  ·  scan to connect on LinkedIn
Let's Build an Agent Harness 01 / 17

Speaker notes