<?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: skywayapsny</title>
    <description>The latest articles on DEV Community by skywayapsny (@skywayapsny).</description>
    <link>https://dev.to/skywayapsny</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%2F4260720%2F8713682c-d1a2-4b29-82b9-86612467851f.png</url>
      <title>DEV Community: skywayapsny</title>
      <link>https://dev.to/skywayapsny</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/skywayapsny"/>
    <language>en</language>
    <item>
      <title>Where did the tool call go? Debug your LLM app from the inside</title>
      <dc:creator>skywayapsny</dc:creator>
      <pubDate>Mon, 23 Nov 2026 13:37:01 +0000</pubDate>
      <link>https://dev.to/skywayapsny/debug-a-missing-llm-tool-call-with-a-controlled-response-3615</link>
      <guid>https://dev.to/skywayapsny/debug-a-missing-llm-tool-call-with-a-controlled-response-3615</guid>
      <description>&lt;p&gt;Your app should call &lt;code&gt;lookup_order&lt;/code&gt;. It prints a sentence instead. You can see the wrong output. You still need to find where the tool call went missing.&lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;AI Bridge&lt;/strong&gt; to stop at that exact point. Point your app’s Chat Completions client at a local endpoint and AI Bridge holds the next request. You or a coding agent can open the actual payload, inspect the tools, and send back the completion you want the app to handle.&lt;/p&gt;

&lt;p&gt;In this walkthrough we’ll return one known-good &lt;code&gt;lookup_order&lt;/code&gt; call and use it to locate the failure. The local demo runs without a provider API key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/skywayapsny/ai-bridge#try-it-locally" rel="noopener noreferrer"&gt;Source and quickstart on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The test:&lt;/strong&gt; inspect the outgoing request and send back one valid tool call. If the app still fails, you have a fixed response to trace through the parser and dispatcher.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  1. Start a local endpoint
&lt;/h2&gt;

&lt;p&gt;Use Python 3.10 or newer on a Unix-like system. Run this in the first terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/skywayapsny/ai-bridge.git
&lt;span class="nb"&gt;cd&lt;/span&gt; ai-bridge
python3 -m venv .venv
. .venv/bin/activate
python -m pip install .
&lt;span class="nv"&gt;AI_BRIDGE_MODELS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;debug ai-bridge --host 127.0.0.1 --port 8777
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Send one request with a tool schema
&lt;/h2&gt;

&lt;p&gt;This &lt;code&gt;curl&lt;/code&gt; call stands in for the app. It waits for you to answer from another terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sS http://127.0.0.1:8777/v1/chat/completions \
  -H &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; -d @- &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s1"&gt;'JSON'&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"model"&lt;/span&gt;: &lt;span class="s2"&gt;"debug"&lt;/span&gt;,
  &lt;span class="s2"&gt;"messages"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;: &lt;span class="s2"&gt;"user"&lt;/span&gt;, &lt;span class="s2"&gt;"content"&lt;/span&gt;: &lt;span class="s2"&gt;"Where is order A123?"&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;,
  &lt;span class="s2"&gt;"tools"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"type"&lt;/span&gt;: &lt;span class="s2"&gt;"function"&lt;/span&gt;,
    &lt;span class="s2"&gt;"function"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"name"&lt;/span&gt;: &lt;span class="s2"&gt;"lookup_order"&lt;/span&gt;,
      &lt;span class="s2"&gt;"parameters"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"type"&lt;/span&gt;: &lt;span class="s2"&gt;"object"&lt;/span&gt;,
        &lt;span class="s2"&gt;"properties"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"order_id"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;: &lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;,
        &lt;span class="s2"&gt;"required"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"order_id"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
      &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
JSON
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Inspect the request and answer it
&lt;/h2&gt;

&lt;p&gt;Open another terminal in the repository directory. Claim the request and read its &lt;code&gt;tools&lt;/code&gt; field. A claim includes a lease token, which the CLI can read from a claim file. The token ties the reply to the caller holding the lease.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;. .venv/bin/activate
&lt;span class="nv"&gt;claim_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;mktemp -d&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;trap&lt;/span&gt; &lt;span class="s1"&gt;'rm -f "$claim_dir/claim.json"; rmdir "$claim_dir"'&lt;/span&gt; EXIT
&lt;span class="nv"&gt;claim_file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$claim_dir/claim.json"&lt;/span&gt;

ai-bridge-agent --client-id local-debug claim \
  --model debug --wait 10 --out &lt;span class="s2"&gt;"$claim_file"&lt;/span&gt;

&lt;span class="nv"&gt;request_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;python -c &lt;span class="s1"&gt;'import json, sys; print(json.load(open(sys.argv[1]))["request"]["id"])'&lt;/span&gt; &lt;span class="s2"&gt;"$claim_file"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
python -c &lt;span class="s1"&gt;'import json, sys; print(json.dumps(json.load(open(sys.argv[1]))["request"]["tools"], indent=2))'&lt;/span&gt; &lt;span class="s2"&gt;"$claim_file"&lt;/span&gt;

ai-bridge-agent respond &lt;span class="s2"&gt;"$request_id"&lt;/span&gt; --claim-file &lt;span class="s2"&gt;"$claim_file"&lt;/span&gt; \
  --tool lookup_order --args &lt;span class="s1"&gt;'{"order_id":"A123"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for these fields in &lt;code&gt;choices[0]&lt;/code&gt; of the response.&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="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"finish_reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"tool_calls"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"tool_calls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"function"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"lookup_order"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"arguments"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{\"order_id\":\"A123\"}"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The caller parses &lt;code&gt;function.arguments&lt;/code&gt; as JSON before it dispatches the tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Find the layer that failed
&lt;/h2&gt;

&lt;p&gt;Point a development instance of your app at &lt;code&gt;http://127.0.0.1:8777/v1&lt;/code&gt; and set its model to &lt;code&gt;debug&lt;/code&gt;. Run the failing workflow, claim the real request, and check three points.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Observation&lt;/th&gt;
&lt;th&gt;Next place to inspect&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;lookup_order&lt;/code&gt; is absent from the claimed request&lt;/td&gt;
&lt;td&gt;Tool registration and the code that builds the model request&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The controlled tool call reaches the client, but the application never sees a parsed call&lt;/td&gt;
&lt;td&gt;SDK response handling or the app’s response parser&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The parsed call is present, but the order lookup never runs&lt;/td&gt;
&lt;td&gt;Tool routing, argument validation, and dispatcher logs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If this run succeeds, you have a response shape that the app handles. Compare it with the failing response from the upstream model. Look at the tool name, arguments and any differences between the app’s streaming and non-streaming paths before changing the prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give the same reproduction to your coding agent
&lt;/h2&gt;

&lt;p&gt;Give the agent the bridge URL, the &lt;code&gt;debug&lt;/code&gt; model tag and access to the relevant workspace. Ask it to claim the live request, return the fixed reply and show the first place where the call disappears. That gives it a specific request to trace through your app’s code and logs. &lt;a href="https://github.com/skywayapsny/ai-bridge/blob/main/docs/agent.md" rel="noopener noreferrer"&gt;Agent protocol&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you try this on your app, start with one failing request and one tool. Save the response that reproduces the issue as a test fixture once you find the bug.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I’m the author of AI Bridge. An AI agent drafted this article and generated the cover.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>tutorial</category>
      <category>python</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
