<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Llm on vishctl</title><link>https://vishctl.dev/tags/llm/</link><description>Recent content in Llm on vishctl</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sun, 13 Sep 2026 02:45:00 +0800</lastBuildDate><atom:link href="https://vishctl.dev/tags/llm/index.xml" rel="self" type="application/rss+xml"/><item><title>What the heck is an AI Agent?</title><link>https://vishctl.dev/posts/ai-agent-basics/</link><pubDate>Sun, 13 Sep 2026 02:45:00 +0800</pubDate><guid>https://vishctl.dev/posts/ai-agent-basics/</guid><category>agentic-ai</category><category>llm</category><category>agent-harness</category><category>infra</category><description>A practical explanation of agentic AI, agent harnesses, tool loops, context growth, and why agents cost more to run.</description><content:encoded><![CDATA[<h2 id="not-a-chatbot-with-more-steps">Not a chatbot with more steps</h2>
<p>&ldquo;Agentic AI&rdquo; gets used for basically anything with a system prompt now. It isn&rsquo;t a chatbot that&rsquo;s more polite about calling tools. The actual difference is structural: an agent runs a loop, a chatbot answers a turn.</p>
<p>A chatbot takes input, produces output, done. State lives in the conversation history you paste back in. An agent runs its own loop: observe, decide, act, observe again, using its own outputs to decide what to do next, without a human in the middle of every step.</p>
<p><strong>Example.</strong> Ask a chatbot &ldquo;is my API returning 500s right now&rdquo; and it tells you it can&rsquo;t check. Ask an agent the same thing and it calls a monitoring tool, reads the response, decides the error rate looks elevated, calls a log-search tool to pull recent 500s, reads those, and comes back with &ldquo;yes, 12 in the last 10 minutes, all from the /checkout endpoint, here&rsquo;s the stack trace.&rdquo; Same model, same question. The difference is the loop in between.</p>
<p><img alt="A chatbot runs once from input through model to output, while an agent loops through observe, decide, act, and observe again." loading="lazy" src="https://vishctl.dev/images/posts/ai-agent-basics/01-chatbot-vs-agent.svg"></p>
<h2 id="the-model-doesnt-loop-the-harness-does">The model doesn&rsquo;t loop, the harness does</h2>
<p>This is the part most explanations skip. The LLM itself is stateless and single-shot, feed it tokens, get tokens back. It has no concept of &ldquo;keep going until the task is done.&rdquo; The loop, the tool execution, the deciding-when-to-stop, none of that lives in the model weights.</p>
<p>All of that lives in the <strong>agent harness</strong>, the code wrapped around the model that turns single-shot completions into a running agent. The harness is what:</p>
<ul>
<li>Sends the prompt to the model and gets a response back</li>
<li>Parses that response for a tool call</li>
<li>Actually executes the tool (runs the shell command, hits the API, reads the file)</li>
<li>Feeds the result back into context</li>
<li>Decides whether to call the model again or stop</li>
</ul>
<p>Swap the model and keep the harness, you get the same agent with different reasoning quality. Swap the harness and keep the model, you get a completely different agent, different tools available, different context management, different stopping conditions. The harness is doing more of the actual engineering work than people give it credit for, the model is just the decision-maker it calls into on each turn.</p>
<p>Strip the harness out entirely and there&rsquo;s no agent left, just a model that can produce a tool-call-shaped output with nothing to execute it, feed a result back, or call the model again. In RL terms, the model is the policy, the harness is the environment loop that runs the policy against the world and feeds observations back. A policy with no environment isn&rsquo;t an agent, it&rsquo;s a function you can call once.</p>
<p>This is also why &ldquo;build your own agent&rdquo; and &ldquo;build your own harness&rdquo; are the same task described two ways. There&rsquo;s no shortcut where you write an agent and skip the harness, hand-rolling one just means you&rsquo;re the one writing the loop: send the prompt, parse the response for a tool call, execute it, append the result, decide whether to call the model again. Do that in 40 lines of Python or reach for pi.dev or Claude Code&rsquo;s, it&rsquo;s the same role either way.</p>
<p><strong>Example.</strong> Two different harnesses wrapping the same underlying model can behave nothing alike. One harness might cap the loop at 5 iterations and summarize aggressively to save context. Another might allow 50 iterations, keep full history, and let the model spawn sub-agents. Same model, same weights, same API calls to it, wildly different agent because the harness around it is different.</p>
<p><img alt="The agent harness cycles from the LLM to tool execution, through context management, and back through a combined loop control and stop decision." loading="lazy" src="https://vishctl.dev/images/posts/ai-agent-basics/02-agent-harness.svg"></p>
<h2 id="the-four-things-a-harness-provides">The four things a harness provides</h2>
<p><strong>Calling the LLM as decision-maker.</strong> The harness sends the current state to the model and treats its output as a decision about what to do next, not just a completion to display.</p>
<p><strong>A tool/function-calling interface.</strong> The harness defines what tools exist, executes them when the model calls one, and returns results in a format the model can read.</p>
<p><strong>Memory/state across steps.</strong> The harness owns the context window, what goes in, what gets summarized or dropped, and any external memory store.</p>
<p><strong>Loop control.</strong> The harness decides when to call the model again and when to stop, whether that&rsquo;s a fixed iteration cap, a &ldquo;the model said it&rsquo;s done&rdquo; signal, or something more custom.</p>
<p><strong>Example, walking through one iteration.</strong> User asks the agent to find the total size of log files older than 30 days. Step 1, harness sends the request to the model, model decides it needs to list files, returns a tool call for <code>find /var/log -mtime +30</code>. Step 2, harness executes that command, gets a list of paths, appends the result to context. Step 3, harness calls the model again, model decides it needs sizes, returns a tool call for <code>du -ch</code> on those paths. Step 4, harness executes it, appends the total to context. Step 5, harness calls the model once more, model has enough info, returns a final answer with no further tool call, harness detects that and stops the loop. Five round trips through the harness, one user question, no human in between.</p>
<h2 id="why-the-loop-gets-expensive">Why the loop gets expensive</h2>
<p>Every loop iteration appends to context: the tool call, the tool result, the model&rsquo;s next reasoning step. None of that gets discarded between iterations, unless the harness explicitly manages it.</p>
<p>Tie this back to KV cache: cache grows with every token in context, and context in an agent loop grows every single step, not just per conversation turn. A single-shot inference request builds a cache once and discards it after. An agent loop keeps extending the same cache, iteration after iteration, and the cost compounds because every added token gets re-attended-to on every subsequent forward pass.</p>
<p><strong>Worked example.</strong> Say a tool call and its result add roughly 300 tokens to context per iteration. A 10-iteration loop adds 3,000 tokens on top of the original prompt, all of it sitting in KV cache. Run the log-file-size agent above against a directory tree with a lot of nested paths and that 300-token estimate climbs fast, since raw <code>find</code> and <code>du</code> output isn&rsquo;t exactly compact.</p>
<p>Practical implication: a long-running agent has to actively manage context, not just let it grow unbounded. This is a harness responsibility, not a model one, good harnesses summarize old steps, drop stale tool outputs, and truncate before the sequence gets unwieldy. That&rsquo;s not an optimization, it&rsquo;s what keeps a loop viable past a handful of iterations regardless of what it&rsquo;s running on.</p>
<p><img alt="Context tokens in the KV cache rise from roughly 500 to 3,500 over ten agent loop iterations." loading="lazy" src="https://vishctl.dev/images/posts/ai-agent-basics/03-context-growth.svg"></p>
<h2 id="single-shot-vs-loop-at-the-token-level">Single-shot vs loop, at the token level</h2>
<p>Single-shot: prompt in, tokens out, KV cache built once, discarded after.</p>
<p>Agent loop: prompt in, tokens out (including a tool call), harness executes the tool outside the model, tool result gets tokenized and appended by the harness, full sequence goes back through the model, cache either recomputed from scratch or extended depending on the serving setup. Repeat.</p>
<p>The cost isn&rsquo;t &ldquo;the model thinks harder.&rdquo; It&rsquo;s &ldquo;the model re-processes a longer sequence every iteration.&rdquo; That&rsquo;s the whole reason agent loops cost more to serve than a single chatbot request, and why serving techniques like continuous batching and prefix caching (vLLM does both) matter more for agents than for one-off completions.</p>
<p><img alt="At the token level, the prompt enters the model, produces a tool call, the harness executes it, and the tool result loops back to the model." loading="lazy" src="https://vishctl.dev/images/posts/ai-agent-basics/04-agent-token-loop.svg"></p>
<h2 id="some-harnesses-and-agents-youve-probably-heard-of">Some harnesses and agents you&rsquo;ve probably heard of</h2>
<p>Frameworks like <a href="https://www.crewai.com/">CrewAI</a> and <a href="https://www.langchain.com/langgraph">LangGraph</a> are toolkits for building your own harness, not already-built ones. Since the interesting question is which finished harnesses and agents are worth knowing, here&rsquo;s a rough split, open source and paid, as of when this was written:</p>
<p><strong>Open source / self-hostable harnesses</strong></p>
<ul>
<li><strong><a href="https://pi.dev/">Pi (pi.dev)</a></strong>, a minimal, aggressively extensible terminal coding-agent harness. Deliberately skips features like sub-agents, plan mode, and MCP support out of the box, the pitch is you build those in yourself with extensions rather than accept whatever the harness maker decided. It also makes the model-vs-harness split from earlier concrete: it supports 15+ model providers and lets you switch mid-session, the harness stays constant, the model underneath it doesn&rsquo;t have to.</li>
<li><strong><a href="https://hermes-agent.nousresearch.com/">Hermes Agent</a></strong>, an open-source agent from Nous Research that can run locally or on a server and build reusable skills from previous work.</li>
<li><strong><a href="https://www.openhands.dev/">OpenHands</a></strong> (formerly OpenDevin), an open-source autonomous software engineer harness, the open equivalent of Devin below.</li>
<li><strong><a href="https://openclaw.ai/">OpenClaw</a></strong>, a fast-growing self-hosted personal agent harness, notable for running locally with your own model of choice.</li>
<li><strong><a href="https://www.agpt.co/">AutoGPT</a></strong>, the original viral agent demo, now a maturer platform with a visual builder and self-hosting support. Still the reference point most people mean when they say &ldquo;autonomous agent.&rdquo;</li>
</ul>
<p><strong>Paid / proprietary harnesses and agents</strong></p>
<ul>
<li><strong><a href="https://docs.anthropic.com/en/docs/claude-code/getting-started">Claude Code</a></strong>, Anthropic&rsquo;s coding agent harness, runs in a terminal, reads and edits across a whole codebase, runs tests, commits changes.</li>
<li><strong><a href="https://cognition.com/blog/introducing-devin">Devin</a></strong>, a fully autonomous coding agent from Cognition, runs in its own sandboxed cloud environment rather than your terminal.</li>
<li><strong><a href="https://openai.com/codex/">OpenAI Codex</a> / <a href="https://help.openai.com/en/articles/11752874-chatgpt-agent">ChatGPT Agent</a></strong>, OpenAI&rsquo;s equivalents, spanning terminal, cloud, and chat surfaces.</li>
<li><strong><a href="https://www.perplexity.ai/comet">Perplexity Comet</a></strong>, a browsing agent that navigates and completes tasks inside the browser rather than a terminal.</li>
</ul>
<p>Coding is where agents and harnesses are most mature right now, since code execution gives the loop a fast, checkable signal of whether the last action actually worked. That&rsquo;s not a coincidence, it&rsquo;s the same reason the log-file-size example earlier in this post works cleanly: shell commands succeed or fail in an unambiguous way, which is exactly the kind of feedback a harness&rsquo;s loop needs to decide what to do next.</p>
<h2 id="up-next">Up next</h2>
<p>Next post in the local tools series is the practical version of this: standing up a Hermes-style agent, harness, tool calling, loop, the works, on the local setup already covered in this series. This post is the vocabulary you need before that one makes sense.</p>
]]></content:encoded></item></channel></rss>