14 Sep 2026
Edge computing means running computation close to where data is produced, on a phone, a camera, a gateway in a barn, instead of shipping everything to a data center first. Edge AI is the same idea applied to machine learning: the model runs on (or next to) the device, so predictions happen in milliseconds, keep working offline, and don’t send raw data anywhere. This post covers the basics, the small models that make it practical in 2026, a quick look at agriculture, and where the research says things are going.

What edge computing actually is
The cloud model is simple: devices collect data, send it to a big data center, and wait for an answer. That works until it doesn’t. Bandwidth costs money, round trips add latency, and some places (a field, a ship, a mine) just don’t have a reliable connection.
Edge computing pushes part of that work back toward the source. Weisong Shi and colleagues framed it this way in Edge Computing: Vision and Challenges (IEEE IoT Journal, 2016), where the “edge” is any computing resource along the path between the data source and the cloud. Mahadev Satyanarayanan’s The Emergence of Edge Computing (IEEE Computer, 2017) adds the idea of cloudlets: small data centers one network hop away from users.
In practice there are a few layers:
- Device edge: phones, microcontrollers, cameras, drones, cars.
- Near edge: gateways, routers, an NVIDIA Jetson sitting in a shed.
- Far edge / regional: telecom edge servers and small regional data centers.
- Cloud: training, aggregation, anything heavy that isn’t time-sensitive.
You don’t pick one. Most real systems split the work across tiers.
From edge computing to Edge AI
Edge AI is what you get when the workload you’re moving closer to the data is model inference. Zhou et al. called it “the last mile of AI” in Edge Intelligence: Paving the Last Mile of Artificial Intelligence with Edge Computing (Proceedings of the IEEE, 2019), and the reasons they gave still hold:
- Latency. A crop-spraying drone can’t wait 400 ms for a server to say “that’s a weed”.
- Privacy. Audio, health data and photos never leave the device.
- Cost. No per-token API bill and much less upstream bandwidth.
- Availability. It keeps working with no signal.
The catch is obvious: devices have little memory, little power and slow memory bandwidth. So most of Edge AI is about making models smaller without making them dumb. The classic toolbox includes quantization, pruning and distillation (see Han et al.’s Deep Compression), plus newer LLM-specific tricks like activation-aware quantization (AWQ). Training can also stay distributed: federated learning lets devices improve a shared model without uploading their raw data.
The newest small models worth knowing
A couple of years ago “on-device LLM” mostly meant a demo. Now the open model hubs have a solid lineup sized for phones and single-board computers. A few I’d look at first on Hugging Face:
- Gemma 4 E2B / E4B (Google). The “E” stands for effective parameters (about 2.3B and 4.5B). They take text, image and audio input, have a 128K context, and ship as Apache 2.0. Google publishes ready-to-run builds for its on-device runtime in LiteRT-LM, and reports up to 2.2x faster decoding on mobile GPUs with multi-token prediction.
- SmolLM3 (Hugging Face). A fully open 3B model trained on 11T tokens, with the data and training recipe published. The SmolLM3 write-up is one of the best free explanations of how a small model gets trained.
- Phi-4-mini (Microsoft). Phi-4-mini-instruct is 3.8B, MIT licensed, strong at reasoning for its size. Phi-4-multimodal adds vision and speech.
- Others worth a look: Qwen3.5 (0.8B and 4B), Ministral 3, IBM Granite 4.0 Nano, Liquid AI’s LFM2.5 and Llama 3.2 1B/3B.
Phones also ship their own: Gemini Nano on Android and Apple’s Foundation Models framework on iOS. As an Android developer I find that part interesting, because it changes the question from “can I run a model here?” to “which one is already on the device?”.
If you want to try one on your laptop in a minute, llama.cpp can pull a quantized GGUF straight from Hugging Face:
llama-cli -hf ggml-org/gemma-3-1b-it-GGUF -p "Explain edge computing in one sentence."
One warning from recent research. The August 2026 study Large Models for Small Devices (Das et al.) measured compression on real hardware and found that no technique wins everywhere. Q5_K_M quantization held up well for question answering, while pruning hurt it badly. For image segmentation the ranking flipped. Pruning also broke k-quant block alignment, made files 21 to 49% bigger, and slowed a Raspberry Pi by up to 3.4x. They even found a compressed model with 71% accuracy that was putting 97 of 100 answers in the same class. So benchmark your model on your device, with your data. Paper numbers don’t transfer as well as we’d like.
A quick look at Edge AI in AgTech
Agriculture is probably the best argument for Edge AI. Farms are big, connectivity is bad, margins are thin, and decisions are time-sensitive.
Some places where it’s already useful:
- Plant disease detection from a phone photo, offline. This line of work goes back to datasets like PlantVillage, and today runs on MobileNet or EfficientNet-class models.
- Targeted spraying, where cameras on the boom tell crop from weed in real time and only spray weeds.
- Livestock monitoring with collar sensors and cameras that flag lameness or unusual behavior locally.
- Soil and irrigation sensors on microcontrollers that decide when to water without a server.
The March 2026 review Affordable Precision Agriculture by Samanta and Saha surveyed 2023 to 2026 work and found a few patterns. Most precision-ag systems still depend on the cloud, which shuts out smallholders. Cheap microcontrollers (ESP32, STM32) dominate the hardware. Quantization shows up in about half the papers, while pruning and hardware-aware architecture search are rarely tried. And most papers don’t report RAM, latency or energy, so it’s hard to compare anything. Their summary of the direction is “localized inference with centralized training”, which matches what I’d expect: train in the cloud, run in the field.
I wrote about the human side of this in AI Beyond Tech: farms and the data center race. Edge AI is the technical piece that makes a lot of those ideas affordable.
The future of Edge AI
So where is this going? The academic work points in a few directions, and they mostly agree.
Small models become the default, not the fallback. NVIDIA researchers argue in Small Language Models are the Future of Agentic AI (Belcak et al., 2025) that most agent sub-tasks are narrow and repetitive, so a small model is good enough and much cheaper. Large models get called only when needed. That fits the edge perfectly.
Agents move onto devices. The survey Cognitive Edge Computing looks at how reasoning models and autonomous agents can run on constrained hardware, and the broader Empowering Edge Intelligence survey (later in ACM Computing Surveys) covers the on-device model landscape and its open problems.
The network becomes part of the model. Network Edge Inference for Large Language Models (2026) argues that the design problem is shifting from “fit everything on one device” to co-designing model, memory, compute and communication across device, edge server and cloud. Think split inference, speculative decoding with a small draft model on the phone, and KV caches that live on a nearby server.
Measurement gets serious. Das et al. call for tools that profile prefill and decode separately and recommend a configuration per device. Benchmarks like MLPerf Tiny started this for microcontrollers. LLMs on phones need the same discipline, because memory bandwidth, not FLOPs, is usually what limits you.
My own take: the cloud isn’t going away, it’s just becoming the place where models are trained and where the hard 10% of requests go. The other 90% (classify this leaf, summarize this note, answer this simple question) will happen on hardware you already own. For mobile developers that’s good news. On-device AI is turning into a normal part of the app, like camera or location, and the people who understand memory, battery and latency on real devices are going to be useful for a long time.
References
- Shi et al., Edge Computing: Vision and Challenges, IEEE IoT Journal, 2016
- Satyanarayanan, The Emergence of Edge Computing, IEEE Computer, 2017
- Zhou et al., Edge Intelligence: Paving the Last Mile of AI with Edge Computing, 2019
- Das et al., Large Models for Small Devices, arXiv, 2026
- Samanta and Saha, Affordable Precision Agriculture, arXiv, 2026
- Belcak et al., Small Language Models are the Future of Agentic AI, arXiv, 2025
- Network Edge Inference for Large Language Models, arXiv, 2026
- Hugging Face, SmolLM3: smol, multilingual, long-context reasoner
- Google AI Edge, Gemma 4 on LiteRT-LM
14 Aug 2026
When people talk about large language models, they usually mean code, chatbots and office productivity. But some of the most useful LLM work is happening far from tech: on small farms in Kenya and India, on construction sites, and in teams trying to cut carbon. Meanwhile, the race to build bigger models in bigger data centers is harming people and the environment, sometimes the very farmers the technology is supposed to help. Both things are true, and we still get to choose which one wins.

In a lot of agriculture, the bottleneck isn’t tractors or sensors. It’s getting the right information to the right farmer at the right time. A 2019 review in Science by Fabregas, Kremer and Schilbach found that advice sent by mobile phone in sub-Saharan Africa and India raised yields by about 4% and the odds of adopting recommended inputs by 22%. But Cole and Fernando’s randomized study of a voice advisory service for cotton farmers in Gujarat is a useful warning: farmers trusted it and changed their practices, yet yields and profits didn’t clearly improve.
LLMs add flexibility: a farmer can ask in their own language, by voice, with a photo of the leaf. That’s the idea behind FarmerChat from Digital Green (paper), which passed 1 million users across five countries in early 2026. In an independent 60 Decibels study, 7 in 10 Kenyan farmers applied its advice within 30 days.
The engineering lesson matters. GPT-4 passes agronomy certification exams, but Microsoft’s RAG vs Fine-tuning study found the real gains came from grounding models in local data. Digital Green fine-tuned on 25,000+ expert-reviewed Q&A pairs. Quality came from local knowledge and human experts, not a bigger model. A 2026 review still flags its one-way design, and a randomized trial across 600 Kenyan villages is now testing whether it moves yields and income. Good. That’s the evidence we should demand.
AI on the construction site
Construction rarely shows up in AI keynotes, but its footprint is huge. Catherine De Wolf of ETH Zurich points out that about half of the materials we consume go into buildings, which produce roughly a third of global waste. Her team uses AI to catalogue materials from buildings slated for demolition and match them with new projects. At UWE Bristol, ASPEC predicts embodied carbon at the planning stage, when changing materials is still cheap.
LLMs fit here for the same reason they fit on the farm: the work is mostly documents. Reading a 300-page spec to flag high-carbon choices, or turning a safety manual into something a crew will read, doesn’t need a frontier model. It needs accuracy, the right documents, and a low cost per run.
AI for sustainability work
Sustainability teams spend much of their time reading supplier reports and reconciling emissions data. For food companies, most of the footprint sits upstream on farms: fertilizer, land use, irrigation. Matching thousands of supplier sheets against farm data is tedious, text-heavy work, exactly where LLMs shine. They let a small team do what used to need a consultancy.
The race, and who pays for it
While farmers and builders find modest uses for AI, the biggest companies are racing to build ever larger models, and the bill lands on people who never signed up for it.
Energy. The IEA’s Energy and AI report projects data center electricity demand will more than double by 2030, to around 945 TWh, slightly more than Japan uses today. In the US, data processing is expected to use more electricity than aluminum, steel, cement and chemicals manufacturing combined. MIT researchers describe the industry as being on an unsustainable path.
Water. Here the farm and data center stories collide. Agriculture already accounts for around 70% of global freshwater withdrawals, and data centers now compete for the same water, often in dry regions. In Making AI Less “Thirsty”, Shaolei Ren and colleagues estimated that training GPT-3 could have evaporated about 700,000 liters of freshwater, and projected AI could account for 4.2 to 6.6 billion cubic meters of water withdrawal in 2027. Ren also notes that companies are secretive about their energy and water use. A farmer in a drought year can’t be secretive about water. Neither should a hyperscaler.
Air and health. A Caltech and UC Riverside study estimated that air pollution from AI’s power demand could cost the US nearly $20 billion a year in health damage by 2030, linked to around 1,300 premature deaths. The harm falls hardest on low-income communities near power plants and backup generators.
A real example. In South Memphis, xAI powered its Colossus supercomputer with gas turbines that, according to the Southern Environmental Law Center, ran without public notice or oversight. The county approved a permit for 15 turbines in July 2025 after months of opposition, and the NAACP appealed. This neighborhood has lived with industrial pollution for decades. Moving fast meant someone else breathing the exhaust.
Safety. In the Future of Life Institute’s Summer 2026 AI Safety Index, none of the nine companies graded scored above a C+, and the report found that companies have been weakening safety commitments as their models grow more capable.
Let’s be honest about what’s going on. AI companies are big corporations chasing money and power. That’s wild capitalism, and AI isn’t an exception. But I don’t think the technology itself is the problem. The internet gave us open knowledge and a way to stay close to family across the world. It also gave us surveillance, scams and misinformation. Same tech, very different outcomes. I believe AI is the same, and that we can point it at the good things. That’s what I’m working towards. As a tech enthusiast, I want to use technology for good.
What good looks like
The uses that actually help people don’t need any of that excess. Take diabetic retinopathy, a leading cause of blindness that’s easy to miss where eye specialists are scarce. Researchers in Bangalore tested Medios, an AI model that runs offline on the smartphone attached to a retinal camera. No cloud, no internet. It caught 98.8% of referable cases and 100% of vision-threatening ones according to the study in the Indian Journal of Ophthalmology. Or a farmer in Kenya getting a straight answer about fall armyworm in Swahili, on a cheap Android phone, over WhatsApp. An architect reusing steel beams instead of ordering new ones. An analyst finding the 20% of suppliers behind 80% of the emissions. Real wins for food and the planet, and all small, specific tasks.

AI is getting cheaper. So why the endless buildout?
Stanford’s 2025 AI Index found that the cost of querying a GPT-3.5-level model fell from $20 per million tokens in November 2022 to $0.07 by October 2024, a drop of more than 280 times.
And research says we can go further without bigger infrastructure. In Power Hungry Processing, Sasha Luccioni, Yacine Jernite and Emma Strubell found general-purpose generative models are orders of magnitude more expensive than task-specific ones for the same task. A UNESCO and UCL report showed that smaller task-specific models, shorter prompts and quantization could cut energy use by up to 90%. In 2026, UNESCO, France and India launched a global competition to compress models without losing performance. Ren’s group has shown that scheduling workloads during cooler hours reduces water lost to evaporation.
Put that next to the agriculture research and the picture is clear. What made agronomy answers better was local data and expert review, not scale. A farmer’s pest question is short, specific and repeated across thousands of farms. That’s the ideal workload for a small, grounded model, ideally one that runs on a phone with bad connectivity.
So who is the next hyperscale data center really for? Mostly the race to the next frontier model. Not the farmer. That’s why I think we should freeze the data center race:
- Pause new hyperscale AI data centers until companies must publicly report energy, water and air pollution per facility.
- Efficiency first. Default to the smallest model that does the job before asking for a new megawatt.
- Treat water as shared. Where farms already compete for irrigation, weigh a data center’s water use against agriculture and drinking water, in public, before approval.
- Give communities a real say, with a vote before construction and fair compensation for health costs.
Blockchain already showed it can be done
Crypto went through this same fight first. Bitcoin’s proof of work burns energy by design, and the Cambridge Centre for Alternative Finance estimates mining still uses about 138 TWh a year, around 0.5% of global electricity. Under pressure, the industry did shift: the same 2025 survey found 52.4% of miners’ energy now comes from renewables and nuclear, up from 37.6% in 2022, and coal fell from 36.6% to 8.9%. That’s real progress, though it’s a survey of the miners willing to answer, and total consumption kept rising.
Ethereum went further and changed the design itself. In September 2022, the Merge replaced mining with proof of stake, and the Crypto Carbon Ratings Institute estimated it cut the network’s electricity use by more than 99.98%, from about 23 million MWh a year to roughly 2,600. (The report was commissioned by ConsenSys, an Ethereum company, but the order of magnitude isn’t in dispute.)
The lesson for AI is direct: cleaner power helps, but the biggest wins come from changing the architecture. For Ethereum it was proof of stake. For AI, it’s smaller, task-specific models instead of one giant model for everything.
The honest counterargument
The IEA says data center emissions are small relative to the whole energy sector, and could be offset by reductions AI enables. Agriculture is a plausible place for that, if better advice means less wasted fertilizer and water. A freeze in one country might also just push construction somewhere with weaker rules.
AI on the farm isn’t risk-free either. In Nature Machine Intelligence, Asaf Tzachor and colleagues warned of unreliable data, models that optimize yield at the expense of soil and ecosystems, and security problems at scale. They suggest involving anthropologists and ecologists in design, data cooperatives so farmers own their data, and sandbox testing before rollout. Small models don’t fix that on their own.
And cheaper AI doesn’t automatically mean less energy. When something gets cheaper, we use more of it. That’s why I think efficiency alone isn’t enough and some limits are needed. It’s a real tension, and I’d rather name it than hide it.
Wrapping up
LLMs are already helping industries most of tech ignores, and the best examples are modest, specific and cheap. Decades of research on agricultural advice tell us what works: local knowledge, trusted delivery, and measuring whether farmers actually end up better off. None of that needs a bigger data center. The race for ever larger models is a different project, paid for in water, air and health by people who don’t get a say, including the farmers who need that water most. We have the research and the cheap models. So here’s my question: shouldn’t we stop chasing bigger models and focus on making LLMs use less energy, then put them to work where people actually live, in health, agriculture, education and the places most of tech still ignores?
24 Jul 2026
GitLab’s 2026 AI Accountability Report found that 78% of developers say they’re writing and committing code faster with AI tools. It also found that overall software delivery hasn’t sped up to match. The gap is explained by one number: 85% of respondents say AI has shifted the bottleneck from writing code to reviewing and validating it. Everyone got a faster typist. Almost nobody got a faster team.
That’s the exact problem I’ve been building against with No Middleman, a Claude Code plugin for React Native that lets an agent loop on a feature or bug fix unattended, but only ever hands you a pull request that’s already been proven against a real emulator, not just asserted as done. I wrote about the general shape of agent control loops in a previous post. This one is about the part of that loop that actually matters once you let the agent run without you watching: verification.
Trusting the diff doesn’t scale
The default way most of us review AI-generated code right now is to read the diff and decide if it looks right. That works when the change is small and you already understand the surrounding code. It stops working the moment the agent is iterating on its own, because “looks right” is a judgment about static text, and the failure modes that matter, a race condition, a mock that silently changed behavior, a test that got loosened instead of the code getting fixed, don’t show up in a diff. They show up when the thing runs.
GitLab’s finding lines up with what you’d expect from that: reviewing and validating AI output is slower and harder than writing the prompt that generated it, so the bottleneck moved downstream instead of disappearing. Reading harder isn’t the fix. Verifying differently is.
Assess, act, verify
No Middleman’s loop is a typed LoopSpec run on XState v5: a trigger, an intake (a goal plus the file globs it’s allowed to touch), a composite verification chain ordered cheap to expensive, and a stopping rule with a hard budget. Nothing about “done” is left to the model’s judgment.
That single command is the thing the loop iterates against. It runs typecheck, lint, unit tests, and a build, in that order, fail-fast, before it ever touches an emulator. Only once those pass does it get to the expensive check. Cheap gates first means a broken import gets caught in seconds, not after a five-minute Detox run.
The headline gate is a Detox end-to-end flow, and the workflow deliberately puts a human at the point where the test is defined, not where it’s checked. You write the goal, a spec-author agent drafts the acceptance flow, and you approve it before anything starts. That red test is the contract. The agent never gets to negotiate what “done” means after the fact, because the definition was fixed before it wrote a line of code.
The dev client compiles once, cached by a hash of the native inputs, and every iteration after that just reloads JS. That’s what makes a real Detox run cheap enough to sit inside a loop instead of being a once-a-day CI job: the expensive part only happens when something native actually changed.
The checker can’t be the maker
The part I’d guess most people skip is the one that matters most: green isn’t the finish line. Once the suite passes, a separate Opus agent, one that never touched the implementation, reviews the diff specifically hunting for the ways a model games its own tests: weakened assertions, mocks that quietly make the test meaningless, timing masked instead of fixed, scope that crept outside what the goal asked for. It’s an adversarial checker by design, not an optimistic second opinion.
That split exists because letting an agent grade its own homework is exactly how you get a green checkmark on code that doesn’t actually work. If the same model that wrote the fix also decides whether the fix is good, its incentive is to reach green by whatever path is shortest, and loosening a test is a shorter path than fixing the underlying bug. Separating maker from checker removes that incentive.
Invariants, not intentions
The loop won’t even start if a spec violates one of eight hard rules: require-verifiable-stop, bounded-retries, maker-neq-checker, tests-only-strengthen, external-state-only, read-only-by-default, human-approves-acceptance, pr-not-merge. tests-only-strengthen is the one doing the most quiet work: a test can get stricter as the loop iterates, never looser. That closes off the single easiest way an unsupervised agent could cheat its way to a passing run.
pr-not-merge closes the other one. The loop’s output is always a draft pull request, whether the checker accepted the change or the iteration budget ran out first. Nothing merges itself. A hard cap on iterations, tokens, and wall-clock time, plus a reserve the loop never spends on iteration, means it always has enough left to write a clean handoff instead of dying mid-edit. And if something looks wrong while it’s running, touch .nm/KILL halts it between iterations and leaves a clean worktree behind.
The two ends you still own
The name is literal: the loop removes you from its interior, the part where you’d otherwise sit watching each edit-reload-verify cycle and nudging it back on track. It doesn’t remove you from the two ends. You write the acceptance test that defines what “done” means, and you review the PR that comes out. Autonomous interior, human bookends. That’s a different claim than “the agent tested itself,” and it’s the reason I trust the output more than I trust a diff someone asks me to skim.
What this means for reviewing AI code generally
The GitLab numbers describe a team where AI made the input to review faster without making review itself faster, which is a bottleneck relocation, not a productivity gain. The fix isn’t reading diffs more carefully. It’s building a verifier that runs the code and grades it against a test you wrote and a checker that has no stake in the outcome, so that by the time a human opens the PR, the question isn’t “does this look right,” it’s “do I approve of the test that already proved it.”
02 Jul 2026
Most of the interesting failures in an agentic system are not in the prompt. They are in the loop. Once an agent is planning, calling tools, checking its own output, and deciding whether to go again, the thing you are actually building is a control loop with an LLM sitting inside it. Loop engineering is the name that has stuck for the discipline of designing that structure on purpose, and it is worth understanding as its own layer, separate from prompt design.
Where the term comes from
The term got its clearest articulation in Addy Osmani’s Loop Engineering essay, which argues that the skill that actually separates reliable agents from flaky demos is not prompting, it’s the surrounding loop: how the agent decides what to do next, how it recovers from a bad step, and how it knows when to stop. That framing is why the term has since collected its own body of references rather than staying folded into general prompt engineering advice. The Loop Engineering Sources page and the Awesome Loop Engineering list on Hugging Face are both attempts to keep that growing literature in one place, and the Agentic AI Knowledge Base folds it into its broader documentation on agent harnesses, which is a fitting place for it: a loop is infrastructure, not a prompt technique.
The anatomy of an agent loop
Strip away the framework abstractions and most agent loops are doing the same four things on repeat:
- Observe — read the current state: user input, tool results, prior steps.
- Plan — decide the next action, which might be a tool call or a final answer.
- Act — execute the action.
- Check — decide whether to loop again, stop, or escalate.
The fourth step is the one frameworks tend to hide, and it is the one worth the most attention. If the model decides for itself when it is “done,” you need an explicit answer for what happens when it decides wrong, either stopping too early or never stopping at all.
Termination is the whole game
A model that is uncertain will often choose to gather more information rather than commit to an answer, and “gather more information” is an action the loop is perfectly happy to repeat indefinitely. So termination cannot be left to the model alone. In practice, a few overlapping guards catch almost every runaway loop:
MAX_ITERATIONS = 12
MAX_TOOL_CALLS_PER_TASK = 20
MAX_WALL_CLOCK_SECONDS = 300
while not done and iterations < MAX_ITERATIONS:
action = model.plan(state)
if is_repeat_of_last_n(action, history, n=3):
escalate("loop appears stuck, repeating the same action")
break
state = execute(action)
iterations += 1
None of these guards are clever, and that’s the point. A hard iteration cap, a repeated-action detector, and a wall clock timeout are cheap to reason about compared to trying to make the model smarter about knowing when it’s finished.
Stop hand-holding, start designing the loop
There’s a habit that shows up in a lot of early agent projects: a human sits next to the loop, watching each step, nudging it back on track whenever it drifts. That works for a demo. It does not scale, and it quietly hides the fact that the loop itself has no real recovery strategy. The paper Stop Hand-Holding Your Coding Agent pushes on exactly this: the fix for an agent that needs constant supervision is not more supervision, it’s giving the loop the guardrails, checkpoints, and escalation paths that let it run unattended in the first place. If your agent only works when someone is watching it, the loop design is the thing to fix, not the babysitting routine.
Loops vs. deterministic graphs
A freeform while loop where the model decides every next step is flexible, but flexibility and reliability trade off against each other as the task gets more complex. The paper From Agent Loops to Deterministic Graphs makes the case for pulling structure out of the model’s head and into an explicit graph: known transitions become edges, and the model is only asked to make a decision at the points where a decision genuinely needs judgment. This mirrors something that’s easy to miss when you’re deep in an unstructured loop: not every step needs an LLM call. The steps that are deterministic should be written as deterministic code, and the loop should reserve the model for the parts that actually require reasoning.
Robustness as a property of the loop, not a single run
A loop that works once is not the same as a loop that works reliably over weeks of unattended operation. The paper Engineering Robustness into Personal Agents with the AI Workflow Store looks at this from the angle of personal agents that run continuously in the background, and argues for treating recurring workflows as reusable, versioned artifacts rather than re-deriving the plan from scratch on every run. That’s a useful reframe: a lot of what looks like “agent reliability” is really “workflow reliability,” and workflows that have been run, checked, and refined once are a better foundation than a loop that starts from a blank plan every time.
Context is a loop problem
The other place loops fail quietly is context. Every iteration appends to the state the next iteration reads, so a loop that runs long enough eventually chokes on its own history. Two things matter here:
- Compaction, not just truncation. Summarizing the last several tool results into a paragraph keeps the signal and drops the noise. Dropping the oldest turns blindly tends to drop the reason the agent started the task in the first place.
- Cache-aware batching. If your provider caches prompt prefixes, an iteration that reads back its own history within a few minutes is cheap. One that reads it back an hour later pays full price, which changes how you should schedule retries or background steps in a long-running loop.
A lot of what gets labeled “agent reliability” is really “context management” wearing a different name. A loop that’s correct on iteration two, verbose by iteration six, and hallucinating a tool result on iteration ten usually isn’t a reasoning failure. It’s a context window that scrolled past the thing that mattered.
Fixed intervals vs. self-pacing
There’s a design choice that shows up in almost every long-running agent: does the loop wake up on a fixed schedule, or does it decide its own pace? Fixed intervals are simple and predictable, which is right when you’re polling something external that changes on its own clock, like a CI run or a data feed. Self-pacing fits better when the loop is waiting on its own work: it can reason about how long the next step will plausibly take and schedule accordingly, instead of burning cycles checking on something that has no reason to have changed yet. Defaulting to a short fixed interval for everything, on the theory that checking more often is safer, usually just makes the loop more expensive without making the task finish any faster.
Failure handling belongs in the loop, not the prompt
The instinct when a tool call fails is to describe the error to the model and ask it to recover. That works for the failures you anticipated. It does not work for the ones you didn’t, which is most of them once a system reaches production. What holds up better is treating failure classes as loop-level branches instead of prompt-level instructions:
try:
result = execute(action)
except TransientError:
retry_with_backoff(action, max_retries=2)
except SchemaError:
escalate_to_human(state, reason="tool contract violated")
except Exception:
escalate_to_human(state, reason="unhandled failure")
The model gets to be clever about the task. The loop stays boring and predictable about failure. That split is deliberate, and it’s why most of the interesting bugs in a mature agent trace back to a loop that had no opinion about failure until it was already in one.
The checklist
- Cap iterations, tool calls, and wall clock time explicitly. Don’t trust the model to know when it’s done.
- Detect repeated actions. A loop that calls the same tool with the same arguments twice in a row is stuck, not thorough.
- Push deterministic steps out of the model and into code. Reserve the LLM call for the points that actually require judgment.
- Compact context instead of truncating it. Summarize what happened, don’t just chop off the beginning.
- Match the wake-up interval to what you’re actually waiting for. External clock, fixed interval. Your own work, self-paced.
- Push failure handling into the loop, not the prompt. Classify errors, decide programmatically, escalate what you can’t classify.
- Treat recurring workflows as reusable artifacts, not something the agent re-derives from scratch every run.
None of this is exotic. It’s closer to the discipline you’d apply to a retry queue or a background job processor than anything specific to LLMs. That’s probably why it gets skipped: it doesn’t feel like AI work, so it doesn’t get the attention the prompt does. It should.
20 May 2026
Testing autonomous AI agents is the part of the stack that most teams underestimate. We have spent the last two years getting comfortable with prompt evaluation, golden datasets, and the occasional LLM judge. None of that is enough once the system starts planning, calling tools, and looping over its own decisions. Below is my synthesis of the best material I have read on agent evaluation recently, plus the approach that is actually working in production for Capitol Trades Tracker, the agentic AI app I run for tracking congressional stock trades.
The clearest framing comes from Comet’s piece on agent evaluation. Traditional testing assumes a single input maps to a single output. Agents do not behave that way. They branch, retry, recover, and sometimes solve the right problem the wrong way. A pass or fail on the final answer hides everything interesting about how the agent got there.
The agent evaluation deep dive makes the same point when it separates outcome evaluation from trajectory evaluation. Outcome tells you the agent finished. Trajectory tells you whether it should be trusted to finish again next time. Both matter, and they fail in different ways.
The four layers I care about
After reading through the agent evals guide, the Evaluating AI Agents manual, and the AI Evals Roadmap by Hamel Husain and friends, I keep coming back to four layers that need their own tests:
| Layer |
What it measures |
Why it matters |
| Final outcome |
Did the agent solve the task |
Easy to score, easy to game |
| Trajectory |
Which tools were called, in what order, with what arguments |
Where most real bugs live |
| Planning quality |
Is the plan coherent and well decomposed |
Catches reasoning failures before they ship |
| Runtime behavior |
Latency, cost, retries, hallucinated tool calls, silent failures |
Determines whether the agent is viable in production |
If you only test the first one, you ship an agent that passes your evals and quietly burns money in production.
Trajectory evaluation is the unlock
The single biggest shift for me was treating trajectories as the primary unit of evaluation. The agent evals guide describes this well, and the O11yBench benchmark takes it further by measuring agents on real observability workflows like log triage and incident response. The benchmark scores the path, not just the conclusion. That matches what I see when reviewing agent traces. A correct answer reached through six redundant tool calls is a failure waiting to happen at scale.
Practical version of this in code looks like trace based assertions. Capture the full execution, then write checks like:
assert trace.contains_tool_call("search_logs")
assert trace.tool_call_count("retry_query") <= 1
assert trace.total_tokens < 8000
This is closer to integration testing than unit testing. That is the point.
LLM judges are useful but not load bearing
The agent evals guide and the roadmap article both spend time on LLM as judge patterns. They work for grading open ended responses where a rubric is hard to encode. They are unreliable as the only signal. The pattern I trust is rubric scoring with a small, fixed rubric per task type, calibrated against human labels on a sample. Anything beyond that drifts.
The AlphaEval approach pushes this further by grounding evaluation in real business workflows across software engineering, finance, and operations. The lesson is that synthetic benchmarks tell you the agent can do tasks. Real workflow benchmarks tell you the agent can do your tasks.
Production is its own test environment
The Reinventing.ai piece on production testing argues that synthetic benchmarks systematically miss the failure modes that matter. I agree. Evaluation drift is real. The distribution of user requests in week six rarely matches the distribution you designed evals for in week one.
What I do in production:
- Sample a fixed percentage of live traces every day and score them with the same rubric used in CI.
- Alert on trajectory anomalies, not just error rates. A 30 percent jump in average tool calls per task is a bug, even if nothing crashes.
- Keep a small human-in-the-loop review queue for the lowest-confidence runs. The cost is low and the signal is the best you can get.
This is the same loop the Evaluating AI Agents manual recommends, and it matches what Husain calls operational evaluation in the roadmap article.
My assertive take
Most teams testing agents today are still doing prompt evals dressed up as agent evals. That is not enough. Here is what I think actually works, in order of impact:
- Trace everything from day one. If you cannot replay an agent run end to end, you cannot evaluate it. OpenTelemetry style instrumentation is non-negotiable.
- Score trajectories, not just outputs. Tool correctness, call order, retry behavior, and token budget belong in your test suite alongside final answers.
- Build a real-workflow eval set. Twenty hand-curated tasks from your actual product beat two thousand synthetic ones. AlphaEval and O11yBench are right about this.
- Run evals in CI and in production. The same rubric, the same scoring code, sampled live. Drift is the default state of any LLM system.
- Use LLM judges sparingly. Calibrate against humans, keep rubrics short, never let a judge be the only gate.
- Treat reliability as a product feature. Latency, cost, and consistency are part of correctness for an agent. A 90 percent accurate agent that costs four dollars per run is broken.
The teams shipping reliable agents are not the ones with the cleverest prompts. They are the ones who treat evaluation as engineering infrastructure, with the same seriousness they would give a database migration or a payments pipeline. That is the bar.
If you want a single starting point, read the agent evals guide for the conceptual frame, then go straight to the Evaluating AI Agents manual for the operational playbook. Everything else is variations on those two themes.