<?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: Harshit Satyaseel</title>
    <description>The latest articles on DEV Community by Harshit Satyaseel (@meharshit).</description>
    <link>https://dev.to/meharshit</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4120351%2F027fcca2-4052-4753-8cd3-8093c2606e76.png</url>
      <title>DEV Community: Harshit Satyaseel</title>
      <link>https://dev.to/meharshit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/meharshit"/>
    <language>en</language>
    <item>
      <title>AI Agents Don't Read Your API Docs Like Developers Do</title>
      <dc:creator>Harshit Satyaseel</dc:creator>
      <pubDate>Sat, 12 Sep 2026 06:20:59 +0000</pubDate>
      <link>https://dev.to/meharshit/ai-agents-dont-read-your-api-docs-like-developers-do-3n8j</link>
      <guid>https://dev.to/meharshit/ai-agents-dont-read-your-api-docs-like-developers-do-3n8j</guid>
      <description>&lt;p&gt;I have spent a lot of my time writing API documentation, and I used to think that I understood what makes an OpenAPI specification good until AI came into the picture.&lt;/p&gt;

&lt;p&gt;Good API docs are pretty straightforward: you define paths correctly, write the right types for parameters, and explicitly mark required fields, etc.&lt;/p&gt;

&lt;p&gt;These are still important. But it starts to feel incomplete when a large share of your docs traffic comes from AI agents; good suddenly needs to mean something more. Look at my Mintlify dashboard. More than 50% of the traffic to my documentation site now comes from AI agents, and that changes the way I write the documentation.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7ua85wv7mic63x2c64s2.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7ua85wv7mic63x2c64s2.png" alt="Dashboard" width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you give an API to an AI agent, you will notice different kinds of problems that did not exist before.&lt;/p&gt;

&lt;p&gt;It needs to decide things like which operation matches a user's request, figure out what arguments are needed, understand relationships between operations, and sometimes recover when the API rejects its request.&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Another problem is that an AI cannot build a mental model the way human developers do. Most AI has a tool definition and a context window. That difference changes how I think about OpenAPI now.&lt;/p&gt;

&lt;p&gt;I'm not saying that an OpenAPI document magically becomes an LLM's system prompt. It doesn't. Depending on the stack, the specification may be transformed into function definitions, JSON Schema, MCP tools, or another representation before the model sees it.&lt;br&gt;
The important part is what happens in between. The information in your API contract can become part of the information the model uses to decide what to do.&lt;/p&gt;

&lt;p&gt;Once you look at it that way, a few things that seemed like minor documentation details start looking more like API design decisions.&lt;/p&gt;

&lt;p&gt;The endpoint can be technically correct and still be bad for&amp;nbsp;agents. Consider this example as a normal endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;
&lt;span class="na"&gt;post&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;summary&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Create encounter&lt;/span&gt;
  &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Creates an encounter.&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is nothing wrong with this OpenAPI. A developer who already knows the product might understand exactly what it means. But imagine an agent has access to several operations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

POST /encounters
GET  /encounters/&lt;span class="o"&gt;{&lt;/span&gt;encounter_id&lt;span class="o"&gt;}&lt;/span&gt;
GET  /encounters/&lt;span class="o"&gt;{&lt;/span&gt;encounter_id&lt;span class="o"&gt;}&lt;/span&gt;/sessions
GET  /encounters/&lt;span class="o"&gt;{&lt;/span&gt;encounter_id&lt;span class="o"&gt;}&lt;/span&gt;/artifacts
POST /encounters/&lt;span class="o"&gt;{&lt;/span&gt;encounter_id&lt;span class="o"&gt;}&lt;/span&gt;/complete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the user says: "Start a new visit for this patient."&lt;/p&gt;

&lt;p&gt;The agent has to work hard to figure out that &lt;code&gt;POST /encounters&lt;/code&gt; is the right operation.&lt;/p&gt;

&lt;p&gt;The summary &lt;code&gt;"Create encounter"&lt;/code&gt; gives it very little help. It doesn't tell the LLM that this is the operation it needs to use when starting a new visit. It also doesn't say what an encounter represents in this particular API. A more useful description would be something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;
&lt;span class="na"&gt;post&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;summary&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Start a new patient visit&lt;/span&gt;
  &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="s"&gt;Creates a new encounter for a patient visit.&lt;/span&gt;
    &lt;span class="s"&gt;Use this endpoint when starting a new visit. The returned&lt;/span&gt;
    &lt;span class="s"&gt;encounter_id identifies the visit and is required by the&lt;/span&gt;
    &lt;span class="s"&gt;endpoints used to retrieve the visit session and complete&lt;/span&gt;
    &lt;span class="s"&gt;the encounter. Do not use this endpoint to retrieve an existing encounter.&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above API description is not prompt engineering but better API documentation written for LLMs. The difference is that it contains information about &lt;strong&gt;intent&lt;/strong&gt; and &lt;strong&gt;boundaries&lt;/strong&gt;, not just implementation.&lt;/p&gt;

&lt;p&gt;That distinction becomes important when an LLM has to read and choose between several operations that make the same sense.&lt;/p&gt;

&lt;h2&gt;
  
  
  APIs have always had workflows, but we didn't always put them in the&amp;nbsp;contract
&lt;/h2&gt;

&lt;p&gt;What I mean when I say this, well, let's figure it out. Look at a simplified clinical workflow as an example from my documentation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Create encounter
       ↓
Start session
       ↓
Send audio
       ↓
Complete session
       ↓
Generate note

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A developer working through the integration will usually discover the steps pretty quickly. The quick start probably shows it. The API reference explains the individual endpoints. There may be a tutorial that ties everything together. But AI does not necessarily get that same experience.&lt;/p&gt;

&lt;p&gt;It may see five separate tools. Now suppose the model tries to send audio before a session has been created. The API returns an error. AI has to figure out what happened and what operation should come next.&lt;/p&gt;

&lt;p&gt;As humans, we can make this easier by putting the relationship where it matters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="s"&gt;Uploads audio for an existing visit session.&lt;/span&gt;
  &lt;span class="s"&gt;The session must already exist and must be active.&lt;/span&gt;
  &lt;span class="s"&gt;Use the session_id returned when creating the session.&lt;/span&gt;
  &lt;span class="s"&gt;Do not call this endpoint before a session has been created&lt;/span&gt;
  &lt;span class="s"&gt;or after the session has been completed.&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Traditional API documentation often focuses on the happy path, like here's what this endpoint does. &lt;/p&gt;

&lt;p&gt;Agent-facing documentation has another job: here's when this operation is valid, and here's when it isn't.&lt;/p&gt;

&lt;p&gt;These are not the same thing.&lt;/p&gt;

&lt;p&gt;The string problem is bigger than it&amp;nbsp;looks. There is another pattern I see frequently in OpenAPI specifications:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;
&lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;string&lt;/span&gt;
&lt;span class="s"&gt;This is technically valid, but it can throw away information that the API already knows.&lt;/span&gt;
&lt;span class="na"&gt;If the only valid values are&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="s"&gt;active&lt;/span&gt;
&lt;span class="s"&gt;completed&lt;/span&gt;
&lt;span class="s"&gt;cancelled&lt;/span&gt;
&lt;span class="na"&gt;then the specification should say that&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;string&lt;/span&gt;
  &lt;span class="na"&gt;enum&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;active&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;completed&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;cancelled&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The reason is obvious for request validation, SDK generation, and documentation. It also matters when an agent is constructing the request. If the schema says string, the model has to determine what string belongs there. It may have seen the allowed values elsewhere, but there is no reason to make it guess when the API already has a finite set of valid values.&lt;/p&gt;

&lt;p&gt;The same applies to dates, identifiers, numeric ranges, and other constrained values.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If something is a date, use a date format.&lt;/li&gt;
&lt;li&gt;If there is a known pattern, express the pattern.&lt;/li&gt;
&lt;li&gt;If certain values are accepted, use an enum.&lt;/li&gt;
&lt;li&gt;Required fields must be marked as required.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This sounds almost too basic to be worth writing about, but there is an important principle behind it:&lt;/p&gt;

&lt;p&gt;Every rule that exists only in prose is another rule the model may have to infer. That does not mean every possible business rule should be added to JSON Schema. Some rules are too dynamic or too complex for that. But when a constraint can be represented accurately in the schema, there is little benefit in leaving it implicit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Descriptions should answer the question the model is actually trying to&amp;nbsp;solve
&lt;/h2&gt;

&lt;p&gt;One of the biggest changes I would make to API descriptions is to stop thinking of summary and description as places where we simply repeat the endpoint name.&lt;/p&gt;

&lt;p&gt;For a human reader, this might be enough to start navigating.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;
&lt;span class="na"&gt;summary&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Get patient&lt;/span&gt;
&lt;span class="s"&gt;For a model choosing between tools, it is much less useful.&lt;/span&gt;
&lt;span class="na"&gt;Imagine an API has&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="s"&gt;GET /patients/{id}&lt;/span&gt;
&lt;span class="s"&gt;GET /patients/{id}/encounters&lt;/span&gt;
&lt;span class="s"&gt;GET /patients/{id}/notes&lt;/span&gt;
&lt;span class="s"&gt;GET /patients/{id}/medications&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A user asks: &lt;strong&gt;"What happened during the patient's last visit?"&lt;/strong&gt; Which one should the model call?&lt;/p&gt;

&lt;p&gt;The answer is probably not obvious from the endpoint names alone. The API reference might have hundreds of pages explaining the system, but the model's immediate problem is much smaller:&lt;/p&gt;

&lt;p&gt;Which tool is relevant to this intent?&lt;/p&gt;

&lt;p&gt;So write descriptions that explain not just what an operation returns, but &lt;strong&gt;what kind of request should lead&lt;/strong&gt; to that operation.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;
&lt;span class="na"&gt;summary&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Get encounters for a patient&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="s"&gt;Returns the clinical encounters associated with a patient.&lt;/span&gt;
  &lt;span class="s"&gt;Use this endpoint when you need to identify a patient's visits&lt;/span&gt;
  &lt;span class="s"&gt;or determine which encounter to use for a follow-up operation.&lt;/span&gt;
  &lt;span class="s"&gt;Use GET /patients/{id}/notes instead when the user is asking&lt;/span&gt;
  &lt;span class="s"&gt;specifically for clinical notes.&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It tells the reader not only what the endpoint does, but how it differs from a nearby capability. That is extremely useful when a tool set contains many operations with overlapping concepts.&lt;/p&gt;

&lt;p&gt;There is a limit, though: don't turn OpenAPI into a&amp;nbsp;prompt&amp;nbsp;&lt;br&gt;
Once you realise descriptions influence tool selection, there is a natural tendency to write big descriptions.&lt;/p&gt;

&lt;p&gt;Something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="s"&gt;You are an expert healthcare API agent. Carefully analyse the&lt;/span&gt;
  &lt;span class="s"&gt;user's request before using this tool. Think step by step about&lt;/span&gt;
  &lt;span class="s"&gt;whether this tool is appropriate. If the user is asking about...&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, the API contract is carrying instructions that really belong in the agent layer. This is where tools like &lt;a href="https://www.mintlify.com/" rel="noopener noreferrer"&gt;Mintlify&lt;/a&gt; are handy. It features a &lt;strong&gt;' For agents ' tag&lt;/strong&gt;, allowing technical writers to include agent-specific instructions that remain hidden from human readers.&lt;/p&gt;

&lt;p&gt;Also, maintaining such descriptions is a headache. As soon as the API changes, the description becomes stale, and suddenly your "prompt" is giving the model instructions that are no longer true.&lt;/p&gt;

&lt;p&gt;I prefer a simpler rule:&lt;/p&gt;

&lt;p&gt;Put &lt;strong&gt;facts&lt;/strong&gt; and &lt;strong&gt;constraints&lt;/strong&gt; in the API contract, whereas put general reasoning behaviour in the agent.&lt;/p&gt;

&lt;p&gt;The API description should tell the truth about the operation. It should explain when it applies, what it requires, what it returns, and what can make it fail. The agent should decide how to reason over that information. That separation makes the system much easier to maintain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your error response is part of the conversation now
&lt;/h2&gt;

&lt;p&gt;This is probably the part of agent-oriented API design that I find most interesting. For a traditional integration, an error response is often treated as the end of a failed request. For an agent, it can become the input to the next decision. Suppose the agent calls:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
POST /sessions/123/audio
and receives:
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"error"&lt;/span&gt;: &lt;span class="s2"&gt;"Invalid request"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is not much context for the agent to act on that. It might think:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Should it retry or change the session ID&lt;/li&gt;
&lt;li&gt;Ask the user&lt;/li&gt;
&lt;li&gt;Check the session&lt;/li&gt;
&lt;li&gt;Call another endpoint&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now imagine the API returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&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;"error"&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;"code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SESSION_NOT_ACTIVE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Audio can only be uploaded while the session is active."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"field"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"session_id"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"current_status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"completed"&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;That response gives the agent useful state. It knows the request failed because of the session state and understands which field is involved. Most importantly, it understands that simply retrying the same request is not going to help and that is why I think &lt;strong&gt;error design&lt;/strong&gt; deserves more attention when APIs are exposed to LLMs.&lt;/p&gt;

&lt;p&gt;A vague error like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&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;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bad request"&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="err"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;not&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;only&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;frustrating&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;developer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;but&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;also&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;dead&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;end&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;an&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;agent.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;A&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;structured&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;error&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;such&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;as:&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;"code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SESSION_NOT_ACTIVE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Audio can only be uploaded while the session is active."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"field"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"session_id"&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;gives the agent context to reason about. While it doesn't guarantee the model won't make mistakes, it provides actionable information instead of forcing it to guess. &lt;/p&gt;

&lt;h2&gt;
  
  
  The other problem nobody talks about: too many&amp;nbsp;tools
&lt;/h2&gt;

&lt;p&gt;There is one more lesson that becomes obvious when you write a lot APIs. Making every endpoint available to an agent is not necessarily a good idea. Imagine a mature API with 300 operations. A human developer might appreciate having all of them documented. They can search the reference, jump between resources, and use the API according to their needs.&lt;/p&gt;

&lt;p&gt;An agent does not necessarily benefit from seeing all 300 operations at once.&lt;/p&gt;

&lt;p&gt;Suppose the user asks: "Get the note for this encounter."&lt;/p&gt;

&lt;p&gt;If the model has five tools related to notes, three related to encounters, and several generic document operations, tool selection becomes harder before the actual API call even happens.&lt;/p&gt;

&lt;p&gt;So, we need to separate two ideas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your API surface is not necessarily your agent tool surface.&lt;/li&gt;
&lt;li&gt;Your full OpenAPI specification can remain the source of truth for the API.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But the set of operations you expose to an agent can be deliberately selected.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmumb2qokw3cis3e0li49.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmumb2qokw3cis3e0li49.png" alt="Example" width="799" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is also where OpenAPI and MCP start to overlap in interesting ways. Modern documentation and API tooling can selectively expose operations as tools instead of treating the entire API as one giant agent interface. Mintlify, for example, supports selecting OpenAPI operations for MCP exposure. The underlying idea is broader than any one documentation platform&lt;/p&gt;

&lt;h2&gt;
  
  
  Good agent design is partly about deciding what not to expose
&lt;/h2&gt;

&lt;p&gt;What changed for me when writing API documentation? The reason I find this topic interesting is that none of these ideas is really new.&lt;br&gt;
Strong API documentation has always needed clear descriptions, accurate schemas, good examples, sensible errors, and understandable workflows. What changed is the audience reading it.&lt;/p&gt;

&lt;p&gt;When I used to write API documentation primarily for developers, I could assume that the reader would connect information across the documentation. A developer can read an endpoint reference, notice an unfamiliar field, search for it, open the related guide, and come back.&lt;/p&gt;

&lt;p&gt;When an agent is choosing a tool, the cost of missing context is different. The model may never &lt;strong&gt;discover&lt;/strong&gt; the missing page. It may simply choose the wrong operation. And that changes what I consider a good description now.&lt;/p&gt;

&lt;p&gt;I no longer want an endpoint description to answer only:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What does this endpoint do?&lt;/li&gt;
&lt;li&gt;I also want it to answer:&lt;/li&gt;
&lt;li&gt;When should I use it?&lt;/li&gt;
&lt;li&gt;What needs to be true before I use it?&lt;/li&gt;
&lt;li&gt;What should I use instead when this is not the right operation?&lt;/li&gt;
&lt;li&gt;What information do I get back that I will need later?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;A checklist you should keep in&amp;nbsp;mind&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If I were reviewing an OpenAPI specification and knew it would be consumed by an agent, I would take a different approach. Here is a checklist you can follow.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can I tell why this operation exists from its description? If the answer is just &lt;code&gt;creates X&lt;/code&gt; or &lt;code&gt;gets X&lt;/code&gt;, there may not be enough context for tool selection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can I distinguish this endpoint from similar endpoints? If several operations deal with the same resource, say what makes each one different.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Are the constraints represented in the schema? Don't leave an enum, date format, numeric range, or required field as tribal knowledge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Are workflow dependencies visible? If one operation requires a resource or state created by another operation, document that relationship.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can an error tell the caller what went wrong? A status code is useful, but a structured error can provide the information needed for recovery.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Does the agent really need every operation? A complete API is useful for developers. A focused tool set is often better for agents.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;OpenAPI did not change, but its audience&amp;nbsp;did. I don't think we need  to change a lot in how we used to write OpenAPI docs. But when it comes to AI, the approach needs a little tweak. Developers still benefit from tutorials and cross-page context, but agents rely on the immediate, machine-readable facts in your documentation. &lt;/p&gt;

&lt;p&gt;You should aim to make intent, constraints, workflows, and errors clear. Try this, and your API will be easier for both humans and LLMs to use.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>writing</category>
      <category>documentation</category>
      <category>api</category>
    </item>
    <item>
      <title>I Stopped Sending the Whole Conversation to My RAG System</title>
      <dc:creator>Harshit Satyaseel</dc:creator>
      <pubDate>Fri, 11 Sep 2026 06:46:40 +0000</pubDate>
      <link>https://dev.to/meharshit/i-stopped-sending-the-whole-conversation-to-my-rag-system-nkk</link>
      <guid>https://dev.to/meharshit/i-stopped-sending-the-whole-conversation-to-my-rag-system-nkk</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4ljylv8879u8irqlmw4p.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4ljylv8879u8irqlmw4p.png" alt="RAG in AI documentation" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re building technical docs assistants using RAG pipelines, stop dumping the entire chat transcript into every prompt.&lt;/p&gt;

&lt;p&gt;If you are currently appending full history, your pipeline is suffering from context bleed, where the LLM gets confused and mixes up parameters across completely different API endpoints. Plus, you are paying to resend 10,000 historical tokens to answer a 20-word follow-up.&lt;/p&gt;

&lt;p&gt;Here is what I did to fix this in my RAG pipeline: I built a Scope-Adaptive Context Gate (SADCG).&lt;/p&gt;

&lt;p&gt;Instead of stuffing the prompt, it classifies user intent and filters conversation history by topic scope before RAG retrieval even runs.&lt;/p&gt;

&lt;p&gt;What happened after implementing this: &lt;br&gt;
• 21% reduction in total per-chat credit cost &lt;br&gt;
• Up to 40% lower peak context size &lt;br&gt;
• Zero cross-topic hallucination in generated code and API answers&lt;/p&gt;

&lt;p&gt;If you are building with RAG pipelines and struggling with context bloat, I wrote a full breakdown of the scope gate architecture, 5 classification modes, and implementation lessons.&lt;/p&gt;

&lt;p&gt;Read the full story on&lt;a href="https://medium.com/@hsatyaseel/i-stopped-sending-the-whole-conversation-to-my-rag-system-785474642d6d" rel="noopener noreferrer"&gt; Medium&lt;/a&gt; &lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>technical</category>
    </item>
  </channel>
</rss>
