Preview environment - you also see content that isn't published yet.
Workshops45 MIN

Harness, Part 1: The LLM Call

One terminal script, one model, one answer - the smallest building block of an agent, built straight against the API.

What this is about

Every agent, however powerful, stands on the same foundation: a single API call. Text goes in, text comes out. That is stage 1 of our staged model - and it's exactly what you build today. Not with a framework, not with an SDK, but directly: one HTTP call against an endpoint you chose yourself.

You will see two things with your own eyes. First: it really is nothing more than one call - all the magic of a language model sits behind an interface you can understand in an hour. Second: the call is stateless. On the second call, the model knows nothing about the first. That hole is not a defect - it is the most important property of the whole architecture, and the reason Part 2 of this series exists.

Building "OpenAI-compatible" does not mean you need OpenAI, by the way: this API format is the de-facto standard almost every provider and every local model speaks - from OpenRouter to Ollama on your own machine. You decide during the build where your model lives.

And so you know where this is heading: by the end of Part 4 your agent is complete - conversation, identity, tools, loop - and fits in a good 200 lines of code without a single dependency. The same engine that drives the big coding agents; they just wrap more comfort around it.

At the end of this part, this works: you ask your agent a question in the terminal and get an answer.

How the build works

You don't build alone - and you don't build by hand either. You hand the build prompt below to your coding agent (Claude Code or a comparable terminal tool), and it does the work: it asks you a few questions - not a single one of them technical -, makes the technical decisions itself and explains them to you, builds the piece, and walks through the acceptance test with you.

Along the way, a file called harness-doku.html comes into being: the growing documentation of your harness. After every part of the series, a section is added. It is your reference - and the memory of the series: every later build prompt reads it to know where you both stand.

// member deepdive

This section belongs to the Member tier. You get access to full code, deeper explanations, and rabbit-hole material.

See tiers →

It works when

You ask your agent a question in the terminal and get an answer from the model you chose yourself. And you have seen the proof that the call keeps nothing: the follow-up "What did we just talk about?" comes up empty. That exact hole is what Part 2: The Message History fills.