<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Craig Tracey</title>
    <description>The latest articles on DEV Community by Craig Tracey (@craigtracey).</description>
    <link>https://dev.to/craigtracey</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3817570%2F9a4d722d-9d46-4da2-a2e5-6eba1cfaa00c.jpeg</url>
      <title>DEV Community: Craig Tracey</title>
      <link>https://dev.to/craigtracey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/craigtracey"/>
    <language>en</language>
    <item>
      <title>Building AI Agents: The Fundamentals</title>
      <dc:creator>Craig Tracey</dc:creator>
      <pubDate>Sun, 29 Mar 2026 17:31:46 +0000</pubDate>
      <link>https://dev.to/craigtracey/building-ai-agents-the-fundamentals-260h</link>
      <guid>https://dev.to/craigtracey/building-ai-agents-the-fundamentals-260h</guid>
      <description>&lt;p&gt;Everyone's building agents. Most are building them wrong. Not because they lack skill, but because they lack the right mental models. Before you write a line of code, you need to understand what agents actually are and how they differ from everything else you've built.&lt;/p&gt;

&lt;p&gt;Here are twelve rules that will save you from the mistakes we made.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Understand the Loop
&lt;/h2&gt;

&lt;p&gt;An agent is not a chatbot with tools. It's not RAG with extra steps. It's a system that perceives, reasons, and acts in a loop until a goal is achieved.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Flow&lt;/th&gt;
&lt;th&gt;Outcome&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Chatbot&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Question &amp;gt; Response&lt;/td&gt;
&lt;td&gt;Single answer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;RAG&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Question &amp;gt; Retrieve &amp;gt; Response&lt;/td&gt;
&lt;td&gt;Answer with context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Agent&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Goal &amp;gt; Reason &amp;gt; Act &amp;gt; Observe &amp;gt; Repeat&lt;/td&gt;
&lt;td&gt;Task accomplished&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The difference is autonomy. A chatbot answers. An agent accomplishes.&lt;/p&gt;

&lt;p&gt;Years ago, our first "agent" was basically a chatbot with a for-loop. It would answer, we'd manually feed the answer back in, repeat. It took us three weeks to realize we'd reinvented the agentic loop badly.&lt;/p&gt;

&lt;p&gt;This loop has a name: the &lt;strong&gt;agentic loop&lt;/strong&gt;. Every agent framework implements some version of it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;done&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;observation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;perceive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;thought&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;goal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;decide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;thought&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;available_tools&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;done&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;goal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The LLM is the reasoning engine. Everything else (tools, memory, evaluation) is scaffolding you build around it.&lt;/p&gt;

&lt;p&gt;Here's what most tutorials miss: &lt;strong&gt;agents can spawn other agents&lt;/strong&gt;. A complex task decomposes into subtasks, each with its own loop. The outer agent orchestrates while inner agents execute. This is how you build systems that tackle problems too large for a single context window. The orchestrator maintains high-level state while delegating details to specialists that run, complete, and return results.&lt;/p&gt;

&lt;p&gt;Common orchestration patterns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hierarchical:&lt;/strong&gt; A supervisor routes tasks to specialized sub-agents&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sequential:&lt;/strong&gt; Agents hand off to each other in a pipeline&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parallel:&lt;/strong&gt; Multiple agents work simultaneously, results are merged&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hub-and-spoke:&lt;/strong&gt; A central coordinator fans out and collects results&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key insight: inner agents should be narrow and specialized. The orchestrator handles routing and state. Poor orchestration causes cascading failures (especially in hierarchical setups where routing decisions compound errors downstream). One confused sub-agent can poison the entire task.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Context Is Working Memory
&lt;/h2&gt;

&lt;p&gt;LLMs have a context window. Most modern models offer 1M+ tokens. Sounds like a lot. It isn't.&lt;/p&gt;

&lt;p&gt;Every turn of the agentic loop adds to context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The user's original goal&lt;/li&gt;
&lt;li&gt;Every tool call and its result&lt;/li&gt;
&lt;li&gt;Every reasoning step&lt;/li&gt;
&lt;li&gt;Every error and retry&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A complex task might take 20 tool calls. Each tool result might be 500 tokens. That's 10K tokens just in tool results. Add system prompts, conversation history, and reasoning traces and you're at 50K tokens before you've done anything interesting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context is not free storage.&lt;/strong&gt; It's working memory. The more you stuff in, the worse the LLM reasons. Studies show performance degrades well before you hit the limit due to the "lost in the middle" effect, where models increasingly ignore information in the middle of long contexts. Even 1M+ token windows don't solve this. Bigger windows don't fix reasoning quality without better context engineering.&lt;/p&gt;

&lt;p&gt;This means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Summarize tool results aggressively&lt;/li&gt;
&lt;li&gt;Don't keep full history, keep relevant history&lt;/li&gt;
&lt;li&gt;Design tools that return focused data, not everything&lt;/li&gt;
&lt;li&gt;Use external stores (vector databases, knowledge graphs) for long-term facts&lt;/li&gt;
&lt;li&gt;Consider summarization chains for very long tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The best agents use the least context to accomplish the goal.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Tools Are Your Interface
&lt;/h2&gt;

&lt;p&gt;An LLM can only think. It can't do. Tools bridge that gap.&lt;/p&gt;

&lt;p&gt;A tool is a function the LLM can call. It has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;name&lt;/strong&gt; the LLM uses to invoke it&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;description&lt;/strong&gt; that tells the LLM when to use it&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;schema&lt;/strong&gt; that defines what parameters it accepts&lt;/li&gt;
&lt;li&gt;An &lt;strong&gt;implementation&lt;/strong&gt; that actually does the work
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"search_services"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Search for services by name, owner, or tag. Use this when you need to find services matching certain criteria."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"parameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"object"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"properties"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Search term to match against service names and descriptions"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"owner"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Filter by team that owns the service"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"required"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tools are how you expose capabilities to the agent. Get them wrong, and the agent can't do its job no matter how good the model is. Get them right, and even a weaker model can accomplish complex tasks.&lt;/p&gt;

&lt;p&gt;The temptation is to give agents every tool they might need. Access to GitHub? Add the GitHub tools. AWS? Load those too. Slack, Jira, databases... pile them on. This is a mistake. Every tool is a decision point. Every decision point is a chance for the LLM to choose wrong. We've seen noticeable degradation often starting around 10-25 tools, with severe hallucination issues at 100+. Not because the tools were bad, but because the model couldn't reason over that many options. Start minimal. Add tools only when you hit a wall.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security matters from day one.&lt;/strong&gt; Tools are capabilities, and capabilities can be abused. Start with minimal permissions (least-privilege). Use scoped tokens rather than broad API keys. Consider policy gates that require approval for high-risk actions. Standards like Model Context Protocol (MCP) are emerging to provide safer, standardized tool and data access.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Tool Descriptions Are Prompts
&lt;/h2&gt;

&lt;p&gt;The description matters more than you think. The LLM decides which tool to use based on the description. A vague description leads to wrong tool choices. A precise description leads to correct ones.&lt;/p&gt;

&lt;p&gt;Bad: &lt;code&gt;"description": "Gets service information"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Good: &lt;code&gt;"description": "Search for services by name, owner, or tag. Returns a list of matching services with their IDs, names, and basic metadata. Use this when you need to find services. Do not use this to get detailed information about a specific service you already know."&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The description is a prompt. Write it like one.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Agents Thrive with Structure
&lt;/h2&gt;

&lt;p&gt;LLMs generate text. Agents need structured data. Bridging this gap eliminates many common failures.&lt;/p&gt;

&lt;p&gt;When an LLM calls a tool, it must output valid JSON matching the schema. When it reasons, you often want that reasoning in a parseable format. When it decides it's done, you need to know what it concluded.&lt;/p&gt;

&lt;p&gt;Two approaches:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Constrained Decoding:&lt;/strong&gt; Force the LLM to output valid JSON at the token level. OpenAI and Anthropic both support this. The LLM literally cannot generate invalid JSON because the sampling is constrained to valid tokens only.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Schema Validation with Retry:&lt;/strong&gt; Let the LLM generate freely, validate the output, retry if invalid. Works but wastes tokens and time.&lt;/p&gt;

&lt;p&gt;Use constrained decoding when available. It's not just more reliable, it's faster because you never retry.&lt;/p&gt;

&lt;p&gt;Tool calls are already constrained by the API. But if you're parsing custom output (reasoning traces, final answers, intermediate state), enforce structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Plan for Hallucination
&lt;/h2&gt;

&lt;p&gt;Hallucination isn't a bug you can fix. It's a property of how LLMs work. They predict likely tokens. Sometimes likely tokens are wrong.&lt;/p&gt;

&lt;p&gt;In agent systems, hallucination shows up as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Invented tool names:&lt;/strong&gt; The LLM calls a tool that doesn't exist&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fabricated parameters:&lt;/strong&gt; The LLM passes an ID it made up&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;False confidence:&lt;/strong&gt; The LLM claims to have done something it didn't&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Imagined results:&lt;/strong&gt; The LLM describes tool output that didn't happen&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We had a case where our prompt included an example UUID with the explicit instruction: "THIS IS AN EXAMPLE UUID. DO NOT USE THIS VALUE." The agent used it anyway. Repeatedly. Prompts don't override pattern matching.&lt;/p&gt;

&lt;p&gt;You can't prompt your way out of this. You engineer around it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Validate everything.&lt;/strong&gt; Don't trust tool parameters. Check that IDs exist before using them. Don't trust completion claims. Verify the goal was actually achieved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fail gracefully.&lt;/strong&gt; When hallucination happens (it will), the system should recover. Return clear errors. Allow retries. Log what happened.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reduce opportunity.&lt;/strong&gt; The fewer choices an LLM has, the less it hallucinates. Fewer tools. Shorter context. More specific prompts. Every reduction in complexity is a reduction in hallucination surface.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Add reflection.&lt;/strong&gt; Have the agent critique its own outputs before acting. A self-check step catches many errors before they cause harm.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Escalate when stakes are high.&lt;/strong&gt; For irreversible actions like deleting data, sending emails, or deploying code, require human confirmation. The agent proposes; the human approves.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use verification agents.&lt;/strong&gt; For critical tasks, a separate agent can validate outputs before execution. Two models are less likely to make the same mistake.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Prompts Are Code
&lt;/h2&gt;

&lt;p&gt;The system prompt is the most important code you write. It's also the least tested.&lt;/p&gt;

&lt;p&gt;A system prompt for an agent typically includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Identity:&lt;/strong&gt; Who the agent is and what it does&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Constraints:&lt;/strong&gt; What it must never do&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instructions:&lt;/strong&gt; How it should approach tasks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool guidance:&lt;/strong&gt; When to use which tools&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output format:&lt;/strong&gt; How to structure responses
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are an infrastructure assistant that helps engineers understand and operate their systems.

CONSTRAINTS:
- Never modify production systems without explicit confirmation
- Never expose secrets, tokens, or credentials in responses
- If uncertain, ask for clarification rather than guessing

APPROACH:
- Start by understanding what the user is trying to accomplish
- Search for relevant context before taking action
- Explain what you're doing and why
- If a tool call fails, explain the error and suggest alternatives

TOOL USAGE:
- Use search_services to find services before operating on them
- Always use entity IDs from search results, never construct IDs yourself
- Use get_service_details only after you have a valid service ID from search
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Treat this like code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Version control it alongside your tools and schemas&lt;/li&gt;
&lt;li&gt;Review changes with the same rigor as code review&lt;/li&gt;
&lt;li&gt;Test prompts in isolation before integrating into the full loop&lt;/li&gt;
&lt;li&gt;Run regression tests when you change anything&lt;/li&gt;
&lt;li&gt;Iterate based on failures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Prompt engineering isn't magic. It's specifying behavior in natural language. The same engineering rigor applies. A prompt change can break your agent just as easily as a code change.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Curate Memory
&lt;/h2&gt;

&lt;p&gt;Chat history is a log of what was said. Memory is what the agent knows and can use.&lt;/p&gt;

&lt;p&gt;These are different. Chat history grows linearly with conversation length. It includes irrelevant small talk, failed attempts, and superseded information. Memory should be curated to include only what's useful for future reasoning.&lt;/p&gt;

&lt;p&gt;Agent memory typically has layers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Working memory:&lt;/strong&gt; The current context. What's happening now. Tool results from this task. Usually just the context window.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Episodic memory:&lt;/strong&gt; What happened before. Previous tasks, their outcomes, what worked. Stored externally, retrieved when relevant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Semantic memory:&lt;/strong&gt; What's true about the world. Facts about the system, relationships between entities, organizational knowledge. This is your knowledge graph.&lt;/p&gt;

&lt;p&gt;Most agents only implement working memory (the context window). That's fine for simple tasks. Complex agents need episodic memory to learn from experience and semantic memory to reason about relationships. In multi-agent setups, ensure the orchestrator maintains high-level state while delegating memory needs to specialists or shared stores.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Evaluate Continuously
&lt;/h2&gt;

&lt;p&gt;You built an agent. Does it work? How would you know?&lt;/p&gt;

&lt;p&gt;"It seems to work" is not evaluation. Agents are probabilistic. They might work 80% of the time. You need to know that number.&lt;/p&gt;

&lt;p&gt;Evaluation requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A test set:&lt;/strong&gt; Real tasks with known correct outcomes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A metric:&lt;/strong&gt; How you measure success (task completion, accuracy, efficiency)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A baseline:&lt;/strong&gt; What you're comparing against&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For simple agents, manual evaluation works. Run 50 tasks, count successes. But this doesn't scale, and humans are inconsistent.&lt;/p&gt;

&lt;p&gt;LLM-as-judge is the emerging pattern: use an LLM to evaluate whether the agent accomplished the goal. This scales, but has biases. The judge tends to favor verbose responses and can miss subtle errors. Combine it with objective metrics: task completion rate, cost per task, latency, human override rate, and average steps-to-completion. In production, track cost-per-successful-task as your north-star metric.&lt;/p&gt;

&lt;p&gt;Evaluate trajectories, not just final outputs. An agent might reach the right answer through a terrible path with 47 tool calls when 3 would do. The path matters for cost and reliability.&lt;/p&gt;

&lt;p&gt;The critical insight: evaluation isn't something you do once. It's continuous. Every prompt change, every tool change, every model upgrade requires re-evaluation. Agents are systems with many interacting parts. Change one, and you might break another.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Design for Security
&lt;/h2&gt;

&lt;p&gt;Agents that can act in the real world amplify risks. Prompt injection, unauthorized tool use, data leakage, "vibe hacking" (manipulating the agent via clever inputs)... these aren't theoretical. They happen.&lt;/p&gt;

&lt;p&gt;Treat every agent as potentially adversarial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Least-privilege everything.&lt;/strong&gt; Tools should have minimal permissions. Scoped tokens, not admin keys.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate outputs.&lt;/strong&gt; Sanitize before any external action. Never let raw LLM output hit a database or API without checking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gate high-risk actions.&lt;/strong&gt; A policy layer or separate approval agent should review destructive operations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log everything.&lt;/strong&gt; Every decision, tool call, and rationale. You'll need this for debugging and compliance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never handle secrets directly.&lt;/strong&gt; Agents shouldn't see credentials. Use service accounts and secure vaults.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Robust observability (Rule 11) is your best friend here. Comprehensive logs of thoughts, actions, and rationales make post-incident analysis and compliance far easier.&lt;/p&gt;

&lt;p&gt;Over-privileged agents are the top reason enterprise pilots fail. Security isn't an afterthought. It's core architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  11. Instrument for Observability
&lt;/h2&gt;

&lt;p&gt;Agents are black boxes by nature. Without traces, you can't diagnose why a loop failed, which tool choice was wrong, or where hallucinations compounded.&lt;/p&gt;

&lt;p&gt;Implement from day one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Full trajectory logging:&lt;/strong&gt; Every observation, thought, action, and result&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Structured traces:&lt;/strong&gt; Timestamps, token usage, error context, parent-child relationships for sub-agents&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Metrics dashboards:&lt;/strong&gt; Success rate, average steps, cost per task, latency distributions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replay capabilities:&lt;/strong&gt; Re-run failed traces against your eval set&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This turns "it sometimes works" into actionable insights. Change a prompt? Re-run your test trajectories. Many frameworks support this out of the box, but you must enable and use it.&lt;/p&gt;

&lt;h2&gt;
  
  
  12. Optimize for Cost and Latency
&lt;/h2&gt;

&lt;p&gt;Agents are inherently slower and more expensive than scripts or single LLM calls. They multiply inferences. In production, these factors often determine viability.&lt;/p&gt;

&lt;p&gt;We &lt;a href="https://sixdegree.ai/blog/mcp-tool-overload" rel="noopener noreferrer"&gt;benchmarked agent performance&lt;/a&gt; across models and tasks. The results were stark: a "smarter" model that costs 10x more per token often isn't 10x better at the task. Sometimes it's worse because it overthinks. I watched one run where token usage grew to double what we expected while simultaneously producing worse results. The model was second-guessing itself into failure.&lt;/p&gt;

&lt;p&gt;Best practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use cheaper models for simple steps.&lt;/strong&gt; Routing, summarization, and validation don't need frontier models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reserve expensive models for complex reasoning.&lt;/strong&gt; Know which steps actually benefit from capability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implement early stopping.&lt;/strong&gt; If the agent is looping, cut it off.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache aggressively.&lt;/strong&gt; Common sub-tasks, tool results, embeddings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parallelize where possible.&lt;/strong&gt; Independent tool calls should run concurrently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set budgets.&lt;/strong&gt; Token limits per task. Kill runaway agents.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Track efficiency metrics alongside accuracy. A slightly less "smart" but 5x cheaper agent often wins in real deployments.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Break the Rules
&lt;/h2&gt;

&lt;p&gt;Agents are not always the answer. They're slow (multiple LLM calls). They're expensive (tokens add up fast). They're unpredictable (hallucination, wrong tool choices).&lt;/p&gt;

&lt;p&gt;Use an agent when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The task requires multiple steps that depend on each other&lt;/li&gt;
&lt;li&gt;The path to the goal isn't known in advance&lt;/li&gt;
&lt;li&gt;Human-like reasoning adds value&lt;/li&gt;
&lt;li&gt;Exploration and adaptation matter more than speed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don't use an agent when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A deterministic script would work&lt;/li&gt;
&lt;li&gt;The task is a single question-answer&lt;/li&gt;
&lt;li&gt;Latency is critical (sub-second responses)&lt;/li&gt;
&lt;li&gt;Cost must stay low (agents compound expense quickly)&lt;/li&gt;
&lt;li&gt;The cost of failure is high and you can't verify correctness&lt;/li&gt;
&lt;li&gt;You need guaranteed reproducibility&lt;/li&gt;
&lt;li&gt;You lack foundational observability, governance, and security controls (build those first)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A well-designed API call beats an agent for predictable tasks. A simple chain (LLM &amp;gt; tool &amp;gt; LLM) beats a full agent when the path is mostly known. An agent beats both when you genuinely don't know what you need until you start exploring.&lt;/p&gt;




&lt;p&gt;These twelve rules aren't exciting. They're not the cool demos you see on Twitter. But they're what separates agents that work from agents that almost work.&lt;/p&gt;

&lt;p&gt;Master the loop. Respect context. Secure your tools. Plan for hallucination. Treat prompts as code. Curate memory. Evaluate continuously. Instrument everything. Watch your costs.&lt;/p&gt;

&lt;p&gt;Start simple, instrument everything, and iterate ruthlessly. The agents that deliver real value are the ones built with engineering discipline, not just clever prompts.&lt;/p&gt;




&lt;p&gt;Building agents? We're working with teams bringing AI agents into their infrastructure. Let's talk about how to &lt;a href="https://sixdegree.ai" rel="noopener noreferrer"&gt;bring them real-time, structured, and reliable context.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>platformengineering</category>
    </item>
    <item>
      <title>We Gave LLMs 150 Tools: Here's What Broke.</title>
      <dc:creator>Craig Tracey</dc:creator>
      <pubDate>Thu, 26 Mar 2026 16:43:58 +0000</pubDate>
      <link>https://dev.to/craigtracey/we-gave-llms-150-tools-heres-what-broke-2jaj</link>
      <guid>https://dev.to/craigtracey/we-gave-llms-150-tools-heres-what-broke-2jaj</guid>
      <description>&lt;p&gt;There's a hypothesis that most people building AI agents have encountered but few have measured: &lt;strong&gt;the more tools you give an LLM, the worse it gets at picking the right one.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's intuitive. Connect a few MCP servers to your agent, and suddenly it's choosing from 60, 80, 100+ tools. GitHub tools, GitLab tools, Kubernetes, Slack, Jira, PagerDuty, Terraform, Grafana, all loaded into the context window, all the time. The model has to read every tool definition, understand the distinctions between them, and pick the right one. That's a lot of signal to sift through.&lt;/p&gt;

&lt;p&gt;But intuition isn't data. So we built &lt;a href="https://sixdegree.ai/labs/boundary" rel="noopener noreferrer"&gt;Boundary&lt;/a&gt;, an open-source framework for finding where LLM context breaks, and ran the numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;We assembled 150 tool definitions based on real schemas from production agent systems across 16 services: GitHub, GitLab, Jira, Confluence, Kubernetes, AWS, Datadog, Slack, PagerDuty, Okta, Snyk, Grafana, Terraform Cloud, Docker, Linear, and Notion. The tools are synthetic (no-op for benchmarking) but the schemas, parameter structures, and descriptions mirror what you'd find in a production MCP environment.&lt;/p&gt;

&lt;p&gt;We tested six models across three providers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude Sonnet 4.6&lt;/strong&gt; and &lt;strong&gt;Claude Haiku 4.5&lt;/strong&gt; (Anthropic)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-4o&lt;/strong&gt; and &lt;strong&gt;GPT-5.4 Mini&lt;/strong&gt; (OpenAI)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4&lt;/strong&gt; and &lt;strong&gt;Grok 4.1 Fast Reasoning&lt;/strong&gt; (xAI)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each model received 60 prompts (both direct requests and ambiguous ones) at five toolset sizes: 25, 50, 75, 100, and 150 tools. At each size, the available tools were randomly selected but always included the correct one. The question: does the model pick the right tool?&lt;/p&gt;

&lt;h2&gt;
  
  
  The results
&lt;/h2&gt;

&lt;p&gt;Every model that completed the test degraded. Two didn't finish at all.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;25 tools&lt;/th&gt;
&lt;th&gt;50 tools&lt;/th&gt;
&lt;th&gt;75 tools&lt;/th&gt;
&lt;th&gt;100 tools&lt;/th&gt;
&lt;th&gt;150 tools&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4.1 Fast&lt;/td&gt;
&lt;td&gt;86.7%&lt;/td&gt;
&lt;td&gt;83.3%&lt;/td&gt;
&lt;td&gt;80.0%&lt;/td&gt;
&lt;td&gt;83.3%&lt;/td&gt;
&lt;td&gt;76.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.4 Mini&lt;/td&gt;
&lt;td&gt;85.0%&lt;/td&gt;
&lt;td&gt;85.0%&lt;/td&gt;
&lt;td&gt;80.0%&lt;/td&gt;
&lt;td&gt;83.3%&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;failed&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-4o&lt;/td&gt;
&lt;td&gt;81.7%&lt;/td&gt;
&lt;td&gt;78.3%&lt;/td&gt;
&lt;td&gt;73.3%&lt;/td&gt;
&lt;td&gt;76.7%&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;failed&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;81.7%&lt;/td&gt;
&lt;td&gt;80.0%&lt;/td&gt;
&lt;td&gt;78.3%&lt;/td&gt;
&lt;td&gt;80.0%&lt;/td&gt;
&lt;td&gt;76.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4&lt;/td&gt;
&lt;td&gt;80.0%&lt;/td&gt;
&lt;td&gt;78.3%&lt;/td&gt;
&lt;td&gt;80.0%&lt;/td&gt;
&lt;td&gt;71.7%&lt;/td&gt;
&lt;td&gt;80.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;78.3%&lt;/td&gt;
&lt;td&gt;73.3%&lt;/td&gt;
&lt;td&gt;73.3%&lt;/td&gt;
&lt;td&gt;76.7%&lt;/td&gt;
&lt;td&gt;75.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F138v8b8ggq7lr0f8lklo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F138v8b8ggq7lr0f8lklo.png" alt="Accuracy vs toolset size across 6 LLMs" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GPT-5.4 Mini was the most surprising result.&lt;/strong&gt; At 85% accuracy through 50 tools, 92% on ambiguous prompts, sub-1-second latency, and $0.002 per call, it was arguably the best overall performer for small-to-medium toolsets. Then it hit the same 128-tool wall as GPT-4o and failed completely at 150.&lt;/p&gt;

&lt;p&gt;Grok 4.1 Fast Reasoning was the only model that combined top-tier accuracy with the ability to handle 150 tools. It degraded steadily from 86.7% to 76.7%, but it never broke.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Both OpenAI models failed at 150 tools.&lt;/strong&gt; OpenAI's API has a hard limit of 128 tools per request. This isn't a degradation curve. It's a wall. If your agent connects enough MCP servers to exceed 128 tools, no OpenAI model works.&lt;/p&gt;

&lt;p&gt;Claude Sonnet 4.6, the most expensive model in the test ($0.028/call), was the least accurate at 25 tools and never recovered. Claude Haiku outperformed it at every size while costing 3x less.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cross-service confusion scales with tools
&lt;/h2&gt;

&lt;p&gt;Cross-service confusion, where a model picks a tool from the wrong service entirely, was the most dangerous failure mode.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;25 tools&lt;/th&gt;
&lt;th&gt;50 tools&lt;/th&gt;
&lt;th&gt;75 tools&lt;/th&gt;
&lt;th&gt;100 tools&lt;/th&gt;
&lt;th&gt;150 tools&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4.1 Fast&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-4o&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.4 Mini&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Grok 4 had cross-service errors even at 25 tools. Claude Haiku was clean until 75 tools but escalated to 4 errors at 150, the worst of any model at that size.&lt;/p&gt;

&lt;p&gt;The most common cross-service confusions across all models:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Datadog vs Grafana&lt;/strong&gt;: "Check the monitoring alerts" consistently routed to the wrong observability platform&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Notion vs Confluence&lt;/strong&gt;: "Search for documentation" split between the two&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linear vs Jira&lt;/strong&gt;: "Add a comment to the tracking issue" picked the wrong project tracker&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub vs GitLab&lt;/strong&gt;: "Show me the open issues" confused the two at higher tool counts&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Direct vs. ambiguous prompts
&lt;/h2&gt;

&lt;p&gt;A "direct" prompt names the service: &lt;em&gt;"List all Terraform Cloud workspaces."&lt;/em&gt; An "ambiguous" prompt doesn't: &lt;em&gt;"Add a comment saying 'Resolved' to the tracking issue."&lt;/em&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;25t (ambig)&lt;/th&gt;
&lt;th&gt;50t (ambig)&lt;/th&gt;
&lt;th&gt;75t (ambig)&lt;/th&gt;
&lt;th&gt;100t (ambig)&lt;/th&gt;
&lt;th&gt;150t (ambig)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.4 Mini&lt;/td&gt;
&lt;td&gt;92%&lt;/td&gt;
&lt;td&gt;92%&lt;/td&gt;
&lt;td&gt;67%&lt;/td&gt;
&lt;td&gt;92%&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4.1 Fast&lt;/td&gt;
&lt;td&gt;83%&lt;/td&gt;
&lt;td&gt;83%&lt;/td&gt;
&lt;td&gt;83%&lt;/td&gt;
&lt;td&gt;75%&lt;/td&gt;
&lt;td&gt;67%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;83%&lt;/td&gt;
&lt;td&gt;75%&lt;/td&gt;
&lt;td&gt;75%&lt;/td&gt;
&lt;td&gt;83%&lt;/td&gt;
&lt;td&gt;75%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-4o&lt;/td&gt;
&lt;td&gt;83%&lt;/td&gt;
&lt;td&gt;83%&lt;/td&gt;
&lt;td&gt;67%&lt;/td&gt;
&lt;td&gt;58%&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;75%&lt;/td&gt;
&lt;td&gt;75%&lt;/td&gt;
&lt;td&gt;83%&lt;/td&gt;
&lt;td&gt;67%&lt;/td&gt;
&lt;td&gt;67%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4&lt;/td&gt;
&lt;td&gt;67%&lt;/td&gt;
&lt;td&gt;75%&lt;/td&gt;
&lt;td&gt;67%&lt;/td&gt;
&lt;td&gt;50%&lt;/td&gt;
&lt;td&gt;67%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;GPT-5.4 Mini dominated ambiguous prompts at 92% through 100 tools. It handled disambiguation better than any other model by a wide margin. GPT-4o collapsed to 58% at the same size. Grok 4 hit 50%, a coin flip.&lt;/p&gt;

&lt;p&gt;Claude Sonnet was the most stable, staying between 75% and 83% regardless of toolset size. Consistent, but never great.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where models get confused
&lt;/h2&gt;

&lt;p&gt;The errors tell a story. Some patterns appeared across all six models:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Terraform is hard.&lt;/strong&gt; All models consistently confused &lt;code&gt;terraform_create_run&lt;/code&gt; with &lt;code&gt;terraform_list_workspaces&lt;/code&gt;, and &lt;code&gt;terraform_lock_workspace&lt;/code&gt; with &lt;code&gt;terraform_get_workspace&lt;/code&gt;. The tool names are semantically close, and the models default to "list" or "get" operations when the toolset is crowded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Snyk is a trap.&lt;/strong&gt; &lt;code&gt;snyk_get_remediation&lt;/code&gt;, &lt;code&gt;snyk_list_container_projects&lt;/code&gt;, and &lt;code&gt;snyk_list_projects&lt;/code&gt; all got misrouted to &lt;code&gt;snyk_list_organizations&lt;/code&gt;. When Snyk tools are buried among 100+ others, the models default to the most generic-sounding option.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Confluence updates fail.&lt;/strong&gt; All models picked &lt;code&gt;confluence_search&lt;/code&gt; when asked to update a page. The prompt said &lt;em&gt;"Update the runbook page"&lt;/em&gt;, but with 75+ tools in context, the model reached for search instead of the update operation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monitoring platform confusion.&lt;/strong&gt; Datadog and Grafana both have alerting, dashboards, and metrics tools. The prompt &lt;em&gt;"Check the monitoring alerts for the API server"&lt;/em&gt; got routed to Grafana instead of Datadog by every model at some toolset size. Adding two similar services to the toolset creates permanent ambiguity.&lt;/p&gt;

&lt;h2&gt;
  
  
  The latency story
&lt;/h2&gt;

&lt;p&gt;Accuracy isn't the only cost.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;25 tools&lt;/th&gt;
&lt;th&gt;50 tools&lt;/th&gt;
&lt;th&gt;75 tools&lt;/th&gt;
&lt;th&gt;100 tools&lt;/th&gt;
&lt;th&gt;150 tools&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.4 Mini&lt;/td&gt;
&lt;td&gt;739ms&lt;/td&gt;
&lt;td&gt;754ms&lt;/td&gt;
&lt;td&gt;849ms&lt;/td&gt;
&lt;td&gt;976ms&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-4o&lt;/td&gt;
&lt;td&gt;1,170ms&lt;/td&gt;
&lt;td&gt;4,035ms&lt;/td&gt;
&lt;td&gt;6,213ms&lt;/td&gt;
&lt;td&gt;7,657ms&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;2,463ms&lt;/td&gt;
&lt;td&gt;6,157ms&lt;/td&gt;
&lt;td&gt;8,765ms&lt;/td&gt;
&lt;td&gt;11,473ms&lt;/td&gt;
&lt;td&gt;16,749ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;4,728ms&lt;/td&gt;
&lt;td&gt;10,308ms&lt;/td&gt;
&lt;td&gt;14,579ms&lt;/td&gt;
&lt;td&gt;19,120ms&lt;/td&gt;
&lt;td&gt;27,935ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4.1 Fast&lt;/td&gt;
&lt;td&gt;6,448ms&lt;/td&gt;
&lt;td&gt;7,042ms&lt;/td&gt;
&lt;td&gt;6,930ms&lt;/td&gt;
&lt;td&gt;7,349ms&lt;/td&gt;
&lt;td&gt;7,533ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4&lt;/td&gt;
&lt;td&gt;7,706ms&lt;/td&gt;
&lt;td&gt;7,945ms&lt;/td&gt;
&lt;td&gt;8,133ms&lt;/td&gt;
&lt;td&gt;8,418ms&lt;/td&gt;
&lt;td&gt;9,552ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvh24ktfpsvldwtmirco9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvh24ktfpsvldwtmirco9.png" alt="Latency vs toolset size" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GPT-5.4 Mini was the latency champion: sub-1-second at every toolset size it completed. The Anthropic models scaled linearly, with Sonnet reaching 28 seconds at 150 tools. The xAI models barely changed, staying in the 6-10 second range regardless of tool count.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this means
&lt;/h2&gt;

&lt;p&gt;The pattern is consistent across six models from three providers: &lt;strong&gt;more tools means worse accuracy&lt;/strong&gt;, and the degradation starts between 25 and 50 tools.&lt;/p&gt;

&lt;p&gt;The implications for anyone building agents with MCP:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Don't load everything.&lt;/strong&gt; If your agent has access to 10+ services, that's easily 80-150 tools. Loading them all upfront is a measurable tax on accuracy, starting at 25 tools.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OpenAI has a hard wall at 128 tools.&lt;/strong&gt; Both GPT-4o and GPT-5.4 Mini failed at 150. This isn't a model quality issue. It's a platform constraint. If your agent might exceed 128 tools, OpenAI models are not an option.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ambiguous prompts are the danger zone.&lt;/strong&gt; Grok 4 hit 50% accuracy on ambiguous prompts at 100 tools. GPT-4o dropped to 58%. When users don't name the service explicitly, the model has to disambiguate, and more tools makes that exponentially harder.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Similar services compound the problem.&lt;/strong&gt; Datadog and Grafana. Notion and Confluence. Linear and Jira. GitHub and GitLab. Every pair of similar services in the toolset creates a permanent source of confusion that scales with tool count.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Latency compounds.&lt;/strong&gt; Even if accuracy were flat, the latency cost matters. Claude Sonnet at 28 seconds per call is unusable for interactive workloads. GPT-5.4 Mini at sub-1-second is a different product entirely.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Price does not predict performance.&lt;/strong&gt; Claude Sonnet 4.6 costs 28x more per call than Grok 4.1 Fast and is less accurate. Claude Haiku outperforms Claude Sonnet at 3x lower cost. The most expensive model lost.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The cost equation
&lt;/h2&gt;

&lt;p&gt;What you pay per call versus what you get in accuracy.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Total cost&lt;/th&gt;
&lt;th&gt;Calls&lt;/th&gt;
&lt;th&gt;Cost/call&lt;/th&gt;
&lt;th&gt;Best accuracy&lt;/th&gt;
&lt;th&gt;Worst accuracy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4.1 Fast&lt;/td&gt;
&lt;td&gt;$0.31&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;$0.0010&lt;/td&gt;
&lt;td&gt;86.7% (25t)&lt;/td&gt;
&lt;td&gt;76.7% (150t)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.4 Mini&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;td&gt;240*&lt;/td&gt;
&lt;td&gt;$0.0021&lt;/td&gt;
&lt;td&gt;85.0% (25t)&lt;/td&gt;
&lt;td&gt;failed (150t)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-4o&lt;/td&gt;
&lt;td&gt;$1.57&lt;/td&gt;
&lt;td&gt;240*&lt;/td&gt;
&lt;td&gt;$0.0065&lt;/td&gt;
&lt;td&gt;81.7% (25t)&lt;/td&gt;
&lt;td&gt;failed (150t)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;$2.83&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;$0.0094&lt;/td&gt;
&lt;td&gt;81.7% (25t)&lt;/td&gt;
&lt;td&gt;76.7% (150t)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grok 4&lt;/td&gt;
&lt;td&gt;$3.85&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;$0.013&lt;/td&gt;
&lt;td&gt;80.0% (25t)&lt;/td&gt;
&lt;td&gt;71.7% (100t)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;$8.51&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;$0.028&lt;/td&gt;
&lt;td&gt;78.3% (25t)&lt;/td&gt;
&lt;td&gt;73.3% (50t)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;*OpenAI models completed 240 of 300 calls. All calls at 150 tools failed due to the 128-tool API limit.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb06v67y5kz75f4a5lp84.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb06v67y5kz75f4a5lp84.png" alt="Cost vs accuracy tradeoff" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The two cheapest models (Grok 4.1 Fast at $0.001/call and GPT-5.4 Mini at $0.002/call) were also the two most accurate. The most expensive model (Claude Sonnet at $0.028/call) was the least accurate. The correlation between price and tool-calling performance is not just weak. It's inverted.&lt;/p&gt;

&lt;p&gt;This is exactly the kind of tradeoff Boundary is designed to surface. Without benchmark data, you'd likely pick Claude Sonnet or GPT-4o. The data says they're among the worst choices for tool-calling workloads. A team running fewer than 128 tools should seriously consider GPT-5.4 Mini for its combination of accuracy, speed, and cost. A team that might exceed 128 needs Grok 4.1 Fast or an Anthropic model.&lt;/p&gt;

&lt;p&gt;Running these benchmarks costs almost nothing. This entire run across six models cost $17. That's less than a single hour of engineer time debugging a misrouted tool call in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  How this shaped our architecture
&lt;/h2&gt;

&lt;p&gt;This data isn't theoretical for us. It directly informed how we built &lt;a href="https://sixdegree.ai/blog/progressive-disclosure" rel="noopener noreferrer"&gt;progressive disclosure&lt;/a&gt; in SixDegree.&lt;/p&gt;

&lt;p&gt;The core insight: if accuracy degrades between 25 and 50 tools, then the goal isn't to find a smarter model. It's to never present more than 25 tools in the first place. Not by hardcoding a curated list, but by letting the agent's context determine which tools are relevant at each step.&lt;/p&gt;

&lt;p&gt;In SixDegree, when an agent queries the ontology and discovers a GitHub repository, only the GitHub tools become available. When a Kubernetes deployment surfaces through a relationship, the Kubernetes tools appear. The agent never sees all 150 tools at once because it never needs to. The toolset at any given turn is scoped to the entities the agent has actually encountered.&lt;/p&gt;

&lt;p&gt;The Boundary data validates this approach quantitatively. At 25 tools (roughly the size of two or three services' worth of tools), accuracy is in the mid-to-high 80s. That's the operating range progressive disclosure keeps you in, regardless of how many total services are connected. You can have 16 integrations and 150 tools installed, and the agent still only sees the 10-20 that matter for the current conversation.&lt;/p&gt;

&lt;p&gt;The alternative, loading everything and hoping the model figures it out, costs you 5-10 percentage points of accuracy, up to 28x the latency, and for OpenAI models, a hard failure at 128 tools. Progressive disclosure isn't a nice-to-have. It's a requirement for agents that work at scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limitations and what we'd like to improve
&lt;/h2&gt;

&lt;p&gt;This benchmark is a starting point, not a definitive answer. There are real limitations to what it measures and how:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Single-turn only.&lt;/strong&gt; Each prompt gets one shot at picking a tool. Real agents chain tool calls, use results from previous calls to inform the next one, and recover from mistakes. A model that picks the wrong tool on the first try might self-correct on a second turn. This benchmark doesn't capture that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Random tool subsets.&lt;/strong&gt; At each toolset size, the available tools are randomly selected (with the correct one always included). In production, the tools in context aren't random. They're usually grouped by service or use case. Random selection may overstate or understate confusion depending on which tools end up adjacent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No parameter validation.&lt;/strong&gt; We check whether the model picked the right tool, but not whether it filled in the parameters correctly. A model that picks &lt;code&gt;github_create_issue&lt;/code&gt; but hallucinates the owner field is still counted as correct. Parameter accuracy is a whole separate dimension.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt quality varies.&lt;/strong&gt; Some of the ambiguous prompts have arguably debatable expected answers. "Check the monitoring alerts" could reasonably map to either Datadog or Grafana depending on the organization. We picked one, but reasonable people would disagree.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Single trial.&lt;/strong&gt; Each prompt runs once per toolset size. With 60 prompts per size, the results are directional but individual percentage points could shift with more trials.&lt;/p&gt;

&lt;p&gt;We'd like to add multi-turn evaluation, parameter accuracy checking, configurable prompt difficulty levels, and more models. If you have ideas for how to make this benchmark better, if you disagree with our methodology, or if you've run Boundary against a model we haven't tested yet, &lt;a href="https://github.com/sixdegree-ai/boundary/issues" rel="noopener noreferrer"&gt;open an issue&lt;/a&gt; or submit a PR. This is an open source project and we want the community to help shape it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://sixdegree.ai/labs/boundary/results/index.html" rel="noopener noreferrer"&gt;full interactive results&lt;/a&gt; from this run are available on our site. The framework is open source. &lt;a href="https://github.com/sixdegree-ai/boundary" rel="noopener noreferrer"&gt;Run it yourself&lt;/a&gt; and see how your preferred models handle tool overload.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;&lt;a href="https://sixdegree.ai/labs/boundary" rel="noopener noreferrer"&gt;Boundary&lt;/a&gt; is an open-source framework for finding where LLM context breaks. &lt;a href="https://sixdegree.ai/platform" rel="noopener noreferrer"&gt;See how SixDegree solves tool overload&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>benchmarks</category>
      <category>discuss</category>
      <category>ai</category>
    </item>
    <item>
      <title>First Principles of AI Context</title>
      <dc:creator>Craig Tracey</dc:creator>
      <pubDate>Sun, 15 Mar 2026 01:49:01 +0000</pubDate>
      <link>https://dev.to/craigtracey/first-principles-of-ai-context-4cmn</link>
      <guid>https://dev.to/craigtracey/first-principles-of-ai-context-4cmn</guid>
      <description>&lt;p&gt;Every few weeks someone publishes a benchmark showing that the latest model is smarter, faster, more capable. Context windows are getting massive. A million tokens, two million, more on the horizon. And that’s genuinely impressive.&lt;/p&gt;

&lt;p&gt;But it raises a question nobody seems to be asking: what are we filling those windows with?&lt;/p&gt;

&lt;p&gt;Right now, the answer is mostly everything. Dump in the docs. Stuff in the chat history. Append the tool definitions. Hope the model figures out what matters.&lt;/p&gt;

&lt;p&gt;Bigger windows don’t solve the context problem. They just give you more room to be wrong. A million tokens of unfocused, unstructured context isn’t better than ten thousand tokens of the right context. It’s worse, because the model has to work harder to find the signal in the noise, and you’re paying for every token of that noise.&lt;/p&gt;

&lt;p&gt;I’ve spent the last year building agent infrastructure, and I keep landing on the same conclusion: the bottleneck isn’t the model and it isn’t the window size. It’s the quality and structure of what goes into the window. Until we treat context as an engineering problem, not just a capacity problem, we’re going to keep building impressive demos that fall apart in production.&lt;/p&gt;

&lt;p&gt;Here are the first principles I keep coming back to.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;The Context Exists. The Relations Don't.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There’s a reason AI coding tools are so far ahead of everything else. Code has explicit structure: dependencies, type systems, call graphs. The model can follow the relationships. It can reason about how things connect.&lt;/p&gt;

&lt;p&gt;Now think about everything else we’re trying to point AI at. Your operations. Your organization. Your business processes. There’s no relationship graph. No map connecting a customer complaint to the team responsible to the system that caused it.&lt;/p&gt;

&lt;p&gt;Without structure, the model guesses. A bigger window just means it has more room to guess in.&lt;/p&gt;

&lt;p&gt;The structure already exists inside your systems. Before you can get real value from AI, you need to connect it.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Semantics are probability, not truth.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This is the thing that’s easy to forget when a model gives you a confident, well-formatted answer: it doesn’t &lt;em&gt;know&lt;/em&gt; anything. It’s predicting the most likely next token. When you ask it to interpret your data, it’s giving you the most probable interpretation, not necessarily the correct one.&lt;/p&gt;

&lt;p&gt;That distinction doesn’t matter much when you’re generating a summary or drafting an email. It matters enormously when an agent is deciding which team to page at 3am, or which customer account is affected by an outage, or whether a support ticket is related to a known incident.&lt;/p&gt;

&lt;p&gt;You can see this play out in real time with tool calls. An agent without enough context doesn’t just pick the wrong tool. It tries one, fails, tries another, fails again, and loops. It’s not being stupid. It’s doing exactly what you’d expect from a system that’s navigating by probability without a map. It doesn’t have the connective tissue to know that &lt;em&gt;this&lt;/em&gt; entity means &lt;em&gt;that&lt;/em&gt; tool, so it guesses, checks the result, and guesses again. It’s brute-forcing a path through a graph it can’t see.&lt;/p&gt;

&lt;p&gt;Probability is useful. But decisions need ground truth. And ground truth comes from structure: explicit relationships that say &lt;em&gt;this&lt;/em&gt; is connected to &lt;em&gt;that&lt;/em&gt;, defined by rules, not inferred by a model.&lt;/p&gt;

&lt;p&gt;The more we rely on agents to take real action, the less we can afford to let them operate on vibes.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Facts without relationships are a dead end.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;RAG was supposed to solve the context problem. Ground the model in your data. Retrieve relevant chunks. It works for question answering.&lt;/p&gt;

&lt;p&gt;And even that takes a surprising amount of effort. Chunking strategies, embedding model selection, reranking, relevance tuning, keeping the index fresh as your data changes. RAG pipelines are deceptively expensive to build well and even harder to maintain. That’s a lot of investment for a system that tops out at retrieval.&lt;/p&gt;

&lt;p&gt;And when teams hit the ceiling of what vanilla RAG could do, where did they turn to improve it? You guessed it. Graphs. GraphRAG exists because people kept running into the same wall: retrieval without relationships isn’t enough.&lt;/p&gt;

&lt;p&gt;But the moment you want an agent to &lt;em&gt;do&lt;/em&gt; something, retrieval isn’t enough. Knowing “there was an incident last Tuesday” is a fact. Knowing that the incident affected three customers, was caused by a change made by a specific team, and is related to two open support tickets? That’s a graph. That’s the difference between an agent that can answer questions and one that can actually reason about what to do next.&lt;/p&gt;

&lt;p&gt;We keep trying to solve a graph problem with a search engine. Vector similarity tells you what’s textually related. It can’t tell you what’s causally connected, what depends on what, or what breaks if something changes. And because similarity is probabilistic, it’ll happily surface content that &lt;em&gt;looks&lt;/em&gt; related but isn’t, with no way to tell the difference.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Context has to discover itself.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Here’s where it gets hard. You can’t manually build and maintain a map of how everything in your world connects. But look at what we’re doing today to try.&lt;/p&gt;

&lt;p&gt;We write longer prompts. We craft system instructions. We maintain AGENTS.md and CLAUDE.md files. We build onboarding documents that try to explain our world to the model in prose. We hand-author tool descriptions and few-shot examples. We create elaborate prompt chains that try to steer the model toward the right context at the right time.&lt;/p&gt;

&lt;p&gt;All of these are manual. All of them go stale. And all of them are fundamentally trying to solve the same problem: teaching the model what it should already be able to see.&lt;/p&gt;

&lt;p&gt;And here’s the kicker. What are we writing all of this context in? Natural language. Prose. The very thing we just established is interpreted probabilistically, not precisely. We’re using semantics to provide context to a system that processes semantics as probability. We’re bootstrapping truth from a medium that doesn’t guarantee it.&lt;/p&gt;

&lt;p&gt;It works at small scale. When you have five tools and one domain, you can write enough context by hand to get by. But it breaks the moment your environment grows. More tools, more systems, more relationships, more change. The rate of change is faster than any human process can keep up with.&lt;/p&gt;

&lt;p&gt;The only context that stays accurate is context that builds itself, continuously, from the systems that are already running. The relationships already exist inside your tools and platforms. They’re just not structured in a way that AI can use.&lt;/p&gt;

&lt;p&gt;The job isn’t data entry. The job is discovery.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Structure needs rules, not just data.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This one took me a while to internalize. You can ingest every piece of data from every system you touch and still have nothing useful. Data without interpretation is noise, and a model will happily interpret that noise for you. Confidently, probabilistically, and sometimes wrong.&lt;/p&gt;

&lt;p&gt;Structure emerges from rules. A project &lt;em&gt;is owned by&lt;/em&gt; a team. A customer &lt;em&gt;is served by&lt;/em&gt; a product. An alert &lt;em&gt;relates to&lt;/em&gt; an incident. These aren’t things you discover statistically. They’re things you define. And once defined, they make relationships queryable, composable, and trustworthy. Not probable. True.&lt;/p&gt;

&lt;p&gt;Without rules, you have data. With rules, you have structure an agent can trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Agents need context before tools.&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;MCP gave agents a standard way to call tools. That was a genuine breakthrough. But tools without context are blind.&lt;/p&gt;

&lt;p&gt;Think about how an agent actually decides which tool to call. It reads the tool’s name and description and picks the one that seems most relevant. Semantics again. The entire tool selection process is probabilistic. The agent isn’t matching against a schema or following a rule. It’s making its best guess.&lt;/p&gt;

&lt;p&gt;Give an agent access to hundreds of tools and watch what happens. It picks the wrong ones. It hallucinates capabilities. It takes action without understanding what it’s acting on. And every one of those irrelevant tool definitions is eating up your context window, crowding out the information the agent actually needs. Each failed tool call burns tokens, adds latency, and pushes useful context further out of reach.&lt;/p&gt;

&lt;p&gt;The fix isn’t better prompting. The fix is context first, tools second. The agent needs to understand what’s relevant to the current task before it gets access to the tools that apply.&lt;/p&gt;

&lt;p&gt;This is the order of operations that most agent architectures get backwards.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Why this matters now&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We’re about to get 10 million token context windows. The temptation will be to treat that as a solution. Just throw everything in and let the model sort it out.&lt;/p&gt;

&lt;p&gt;That won’t work. It’ll just be expensive, slow, and probabilistically wrong in ways that are hard to debug. The context problem isn’t about capacity. It’s about knowing what matters, how things connect, and what’s relevant right now. With certainty, not just likelihood.&lt;/p&gt;

&lt;p&gt;MCP is taking off. Agent frameworks are proliferating. Everyone is building tool integrations. But almost nobody is building the context layer underneath: the thing that decides what goes into the window and why.&lt;/p&gt;

&lt;p&gt;That’s the gap. And it’s the gap that will determine whether AI agents become genuinely useful or remain expensive toys that work great in demos.&lt;/p&gt;

&lt;p&gt;I started this newsletter because I think the people building in this space need a place to think through these problems together. Not hype. Not product announcements. Just the hard, specific questions that come with making AI systems work for real.&lt;/p&gt;




&lt;p&gt;This is the problem I'm building toward solving with &lt;a href="https://sixdegree.ai" rel="noopener noreferrer"&gt;sixdegree.ai&lt;/a&gt;. More on that soon - and more on the specific patterns that actually work in production.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>llm</category>
      <category>rag</category>
    </item>
  </channel>
</rss>
