Engineer's Diary

on building agentic systems

Where judgment lives

Every agent framework has converged on the same loop. None of them has converged on who decides what it means.

By R. AxiomAn article on agent architecture10 min read
abstract

Every agent framework has solved the same mechanical problem — call a model, run a tool, carry the result forward, repeat. None of them has solved the harder problem underneath it: deciding what any of that reasoning is actually allowed to do. That gap is where most agent failures live — not in the model being wrong, but in nobody having decided in advance what happens when it is.

Here's how to build that judgment in on purpose, instead of hoping it shows up. Four roles touch the loop, but only the developer's code ever decides what happens next — so judgment has to be written into the code, not assumed from better reasoning. You can't fully plan ahead either: context, thinking, and action all depend on each other, so the safest approach is small steps you can undo, not one big well-planned move.

The famous reasoning patterns — chain-of-thought, tree-of-thoughts, ReAct, plan-then-execute, multi-agent handoff — aren't really different techniques. They're the same loop, spending the same budget in different ways, which means the real decision is how much outside checking a task needs, not which pattern sounds smartest.

And you can score how much scrutiny any action deserves using seven concrete questions, one of which overrides the rest: can this go wrong in a way you can't undo? Together, these give you a simple way to decide, action by action, how much judgment your system actually needs.

Key insights

  • A smarter model doesn't make your agent safer or more capable on its own. Better reasoning only matters if you've written code that reads it and acts on the difference — otherwise it just makes the transcript more articulate.
  • You can't think your way to a perfect plan before acting. Break work into the smallest step you can undo, learn from it, then take the next one — that's more reliable than trying to gather full context up front.
  • Ask "can this go wrong in a way I can't undo" before anything else. A cheap, well-tested, frequently-run action still needs a human sign-off the moment it can touch something irreversible.
  • A model saying "wait, let me reconsider" isn't a safety check. It's the same reasoning re-examining itself with the same blind spots. A check only counts as real verification if it couldn't have seen the reasoning it's checking.
  • Removing a human from the loop doesn't remove the judgment call — it just moves the bill. Pre-checks, post-checks, and guardrails are what you now have to build to replace the person who used to catch the problem.
  • Almost every framework lets you gate a risky action before it fires — that's it. Deciding what counts as risky, how often to double-check, and what it's all costing you is left entirely to whoever builds on top, everywhere.

Ask an agent framework to "reason," and something real happens: the model generates thinking tokens, the runtime carries them from one call to the next, a tool runs, a result comes back. But watch closely and a strange fact shows up — none of that machinery actually decides anything on its own.

A model can conclude, in its own words, that something is wrong. The runtime will faithfully carry that conclusion to the next turn. But unless a person wrote code that reads it, nothing about the system's behavior changes. The reasoning happened. It just didn't decide anything.

That gap — between reasoning happening and reasoning mattering — is the main idea behind everything in this article. Once you see it, the rest follows.


01the four roles

The four roles: model, SDK, runtime, developer

Break any agent system into its real parts and you get four roles that don't overlap. The model generates content — thinking, tool requests, final text — and nothing else. The SDK turns that content into requests and parses the responses back out; it has no opinion on what any of it means.

The agent runtime — the loop inside Claude Agent SDK's query(), OpenAI's Runner, LangGraph's graph executor — carries reasoning from one call to the next and decides when to stop, but it never reads what the reasoning actually says. And the developer decides what any of it is allowed to trigger.

ResponsibilityModelSDKAgent runtimeDeveloper
Generates reasoning contentowns it———
Carries reasoning across turns—defines the shapeowns it—
Executes tools, controls the loop——owns itsets the limits
Decides what happens next———sole owner

That last row matters most. Nobody else in the stack even tries to do it. A model that reasons better doesn't make your system more capable unless something downstream is built to act on the difference — otherwise all you get is a more articulate transcript.


02the core loop

The context-thinking-action loop

Under those four roles is a harder problem. Context, thinking, and action all depend on each other — and none of them can go first.

Thinking can only work with what's already in context — it can't invent a fact that isn't there, so there's a ceiling on how good your reasoning can be, no matter how hard the model tries.

You need to think before you act, but the only way to know if that thinking was right is to actually act — and acting is exactly the expensive, hard-to-undo step you were trying to think your way around.

And action is the only thing that produces new context, so deciding what to do already requires information you won't have until after you've done it.

The context, thinking, action loop Context bounds thinking, thinking selects the action, and action produces new context, closing the loop with no valid starting point. Context bounds thinking Thinking selects action Action produces context
each one both depends on, and produces, the other two

No agent design escapes this — you can only handle it well or badly. Handling it well means keeping every step small and reversible: take the smallest action that gets you the most new information, think again with just that new piece, then repeat.

Trying to shortcut any one of the three — full context before you think, certainty before you act, one big action to settle everything — doesn't work, because the other two are still incomplete when you try it.


03reasoning patterns

Five reasoning patterns, one loop

Chain-of-thought, tree-of-thoughts, ReAct, plan-then-execute, multi-agent handoff — these aren't five different mechanisms. They're five different answers to two simple questions: how many times do you go around the loop, and who's steering it each time — the model, or your code?

Chain-of-thought is the simple case. One model call, one line of reasoning, no loop at all. The model decides once, and nothing outside it ever checks the work.

Tree-of-thoughts is the opposite case. Something outside the model generates several candidate answers, scores them by some method that isn't just the model's own opinion, and drops the weak ones before they cost you anything. The real difference from chain-of-thought isn't that it's smarter — it's that an actual outside judge gets a vote.

PatternIterations spentWho steers each one
Chain-of-thoughtZero — one generationThe model, once; nothing external ever weighs in
Tree-of-thoughtsManyAn external evaluator, separate from the generation that produced each candidate
ReActMany — one per tool callThe model, fresh at every single iteration
Plan-then-executeOne big decision, then many mechanical stepsThe model steers once; code steers every iteration after
Multi-agent handoffManyControl passes between separate model instances

ReAct spends just as many iterations as tree-of-thoughts, but it steers nothing like it. There's no outside judge comparing options — just the model, deciding alone, one step at a time, based on whatever's happened so far. It's chain-of-thought's habit of never checking itself, just repeated many times instead of once.

Plan-then-execute puts the judgment in one place instead of spreading it out. The model makes one big call up front — the plan — then code runs it mechanically, step by step, without asking the model again unless something forces a re-plan.

Multi-agent handoff doesn't have one steering answer at all. Control passes between separate model instances — sometimes routed by other code, sometimes because one agent decides on its own to hand off.

This also explains why a single "here are some candidates with confidence scores" call isn't a real substitute for search, however good the scores look. That's the model grading its own homework the moment after writing it — nothing has actually been tested yet.

The same goes for a model that stops mid-answer to say "wait, that's not right, let me reconsider." That sentence carries no real weight. It's still the same model, in the same unbroken pass, fixing itself with the same blind spots that caused the mistake in the first place.

Nothing from outside ever got a chance to catch what the model missed. True backtracking can't happen in one shot anyway — backtracking means a path was already tried and failed. The moment that's true, you're in a second round. Which means: you never actually left the loop.

So here's the test for whether a check is really external: could it have seen the reasoning it's checking? If yes, it isn't external, whatever you call it. Asking the same model, in the same conversation, to "verify itself" is one continuous act of generation wearing a different label — not a real judge casting a vote.


04before wiring in an action

Seven questions for scoring risk, one that overrides the rest

"How much should the agent think about this" is the wrong question to ask once for the whole system. Score it per action instead, across the seven questions below.

AxisWhat it determines
Reversibilitywhether you can afford to try before you're sure
Context requirementhow much you need to learn before deciding well
Verifiabilitywhether you can generate, check, and retry instead of deliberating up front
Blast radiuswhether a human must sign off regardless of how well-prepared the decision is
Repetitionwhether it's worth building a fixed, repeatable path for this
Cost per attempthow many candidates you can afford to explore in parallel
Environment stabilitywhether a proven path stays valid, or needs re-checking before reuse

These seven don't carry equal weight. Blast radius sits above the other six as a gate, not as one factor among many — a cheap, well-tested, frequently-run path still needs a separate sign-off the moment it touches shared state, and no amount of good prep replaces that checkpoint.

The other six all answer some version of "how well-prepared is this decision"; blast radius alone answers "who's allowed to let it happen."

One pair of the seven doesn't fit neatly into that ranking. Context requirement and environment stability can actually race each other: a task that needs a lot of context, in an environment that's changing faster than you can gather it, has no clean fix — by the time you've collected enough information, the earliest of it is already out of date.

The only real answer is to shrink the loop to match the faster clock: smaller, more frequent, less-informed decisions instead of one big, well-informed one that arrives too late to be true.

Total cost isn't tokens spent. It's tokens spent, plus the cost of failures that slip through, plus the cost of whatever catches them.

That matters because it's easy to "save money" by building a fixed workflow and skipping the guardrails — you feel the savings right away, while the failures that let through show up later, quietly, on someone else's dashboard.

A system built to use the fewest tokens and a system built for the lowest total cost are not the same system. The difference is usually invisible, until it isn't.


05framework survey

What agent frameworks actually give you

Take the developer's own code out of Claude Agent SDK, Semantic Kernel, Google's ADK, LangGraph, and the OpenAI Agents SDK, and a clear pattern shows up: the mechanics of running a loop are basically solved everywhere. The judgment about what that loop should actually do is not — nowhere, and that's by design, not an oversight.

PracticeNative anywhere?
Reasoning structured for controlOnly ADK's optional planner forces a parseable shape — everywhere else, the developer defines it
Per-action risk classificationnowhere — every framework leaves this entirely to the developer
Authorization gate before high-stakes actionsyes — nearly every framework ships hooks, callbacks, or approval modes for this one
Topology matched to task shapepartial scaffolding in most (prebuilt agent types, native handoffs) — the choice is always the developer's
Smallest reversible increment as defaultyes, by accident — every base loop happens to run turn by turn
Everything else — cadence, sequencing, validation, guard evolution, total-cost accountingnowhere, in any framework reviewed

Two things stand out. Authorization gating is the one place where every framework actually shipped something instead of leaving it optional — which makes sense, since it's a liability question, not a reasoning-quality one.

And the smallest-reversible-step default that the rest of this article depends on isn't a deliberate choice anywhere — it's just what a call-and-respond loop looks like by default. Which means nothing stops a developer from undoing it with one big, overreaching tool.


06in practice

Five practices for building judgment in

Make reasoning actionable, on purpose

Define specific fields — confidence, stuck, needs_review — for anything that should actually change behavior, and keep them general instead of listing every failure case by name. A field that just flags uncertainty catches failures nobody predicted; a field built for one specific failure only ever catches that one.

Size effort to the action, not to habit

Run every action through the seven questions before deciding how much thinking it deserves, and put the blast-radius check at the very end of the pipeline, after everything else — never mixed in with the rest.

Treat the loop as the unit of design

Default to the smallest reversible step that teaches you something new. Limit how much context you gather based on how fast the environment actually changes, not a fixed rule. Tackle the cheapest sub-goals first, so the harder ones inherit context you already paid for. And check a one-shot confidence score against at least one real result before you trust it.

Build for guards that evolve

Pair cheap, rule-based checks for failures you already know about with a lightweight statistical or small-model tripwire for the ones you don't. Turn every miss either one catches into a new rule. The guard layer is never finished — no one predicts every failure mode up front.

Account for total cost, not token count

Count the cost of the failures that slip through, plus whatever you build to catch them. A system that looks cheaper because it hides its failures elsewhere isn't actually cheaper — the bill just arrives later, and lands on someone else.

Here's what autonomy actually costs, stated plainly: taking a human out of every loop doesn't remove the judgment that human was providing — it just moves it somewhere else. Pre-checks, post-checks, and guardrails are the direct replacement for that judgment, not extra overhead bolted on afterward.

The cost gets paid either way. The only real choice is whether you pay it upfront, as engineering, or later, as a failure nobody caught, with someone's name attached.


The frameworks got good at the part that was never actually hard — looping, calling tools, carrying state from one turn to the next. What's left, on every one of them, is the part that was always the job: deciding what any of it is allowed to mean.