<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Akarsh Jain  on Medium]]></title>
        <description><![CDATA[Stories by Akarsh Jain  on Medium]]></description>
        <link>https://medium.com/@akarsh.jain.790?source=rss-d8c84a2c6015------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7Hg_MQFSCLXh1JBK</url>
            <title>Stories by Akarsh Jain  on Medium</title>
            <link>https://medium.com/@akarsh.jain.790?source=rss-d8c84a2c6015------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 20:08:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akarsh.jain.790/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Our AI Agents Lied to Us: Catching Silent Failures with SigNoz]]></title>
            <link>https://medium.com/@akarsh.jain.790/our-ai-agents-lied-to-us-catching-silent-failures-with-signoz-f828a5159d4e?source=rss-d8c84a2c6015------2</link>
            <guid isPermaLink="false">https://medium.com/p/f828a5159d4e</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[whodunnit]]></category>
            <category><![CDATA[opentelemetry]]></category>
            <category><![CDATA[mast]]></category>
            <category><![CDATA[signoz]]></category>
            <dc:creator><![CDATA[Akarsh Jain ]]></dc:creator>
            <pubDate>Sun, 26 Jul 2026 16:46:08 GMT</pubDate>
            <atom:updated>2026-10-21T06:25:56.307Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How We Built Whodunnit: Tracing and Fixing Multi-Agent Systems</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YsTd3VxzAmveb8PcqUC37g.png" /><figcaption>Bridging the multi-agent observability gap: tracing, judging, and fixing silent AI failures.</figcaption></figure><p>Our multi-agent app told us it succeeded. The answer was wrong.</p><p>There was no error, no stack trace, no red anywhere in the dashboard. Just a confident, well-written, incomplete response that looked exactly like a good one.</p><p>That is the whole problem with multi-agent LLM systems, and it is why the two of us spent a hackathon building <strong>Whodunnit</strong>: a detective for our AI agents. It watches them through SigNoz, catches whichever agent messed up, and holds off on shipping fixes until a real person signs off. This is the honest story of how we made it, including the moment the tool we built turned around and pointed at a hole in our own code.</p><p>We built the multi-agent app, but we did not want to invent our own definition of “failure” to grade it against. So we grounded the whole thing in <strong>MAST</strong>, the Multi-Agent System failure Taxonomy from <a href="https://arxiv.org/pdf/2503.13657">Cemri et al., 2025</a>, a UC Berkeley paper that catalogues 14 concrete failure modes across three categories. Our judge is our own, but the vocabulary it uses is theirs.</p><p>The stack: LangGraph agents, OpenTelemetry, SigNoz Cloud, and an LLM judge grounded in that taxonomy. Everything below ran against SigNoz v0.134.0-cloud.2 in region in2. Your paths and schemas may differ, and we will say so where it matters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IWmPVUKxksXHNNvT4BhkSQ.png" /><figcaption>The agent app in action, each run as their own step, and every turn is exported as an OpenTelemetry trace.</figcaption></figure><h3>The problem, concretely</h3><p>Traditional observability answers two questions: was it slow, and did it throw. For an agent pipeline, both can be green while the output is quietly broken.</p><p>A planner writes a three-step plan, the researcher only does step one, the writer confidently summarizes work that never happened, and the trace closes as a clean 200. Latency: fine. Errors: zero. Correctness: nobody checked.</p><p>So the interesting <strong>failures are invisible</strong> to the metrics we usually reach for. We wanted to make them visible, then diagnosed, then fixed with a human in the loop.</p><h3>Instrumenting the agents</h3><p>The app is a small LangGraph pipeline: planner -&gt; researcher -&gt; writer. The one decision that made everything else possible was making each agent turn its own span, tagged with enough context to rebuild the conversation later.</p><pre># backend/app/agent_app/graph.py (live-UI _notify() calls trimmed for brevity)<br>def _call(agent: str, system: str, user: str) -&gt; str:<br>    with tracer.start_as_current_span(f&quot;agent.{agent}&quot;) as span:<br>        span.set_attribute(&quot;agent.name&quot;, agent)<br>        span.set_attribute(&quot;agent.system_prompt&quot;, system)<br>        span.set_attribute(&quot;agent.input&quot;, user)<br>        resp = _client.messages.create(<br>            model=_MODEL,<br>            max_tokens=512,<br>            system=system,<br>            messages=[{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: user}],<br>        )<br>        text = text_of(resp)<br>        span.set_attribute(&quot;agent.output&quot;, text)<br>        span.set_attribute(&quot;llm.usage.input_tokens&quot;, resp.usage.input_tokens)<br>        span.set_attribute(&quot;llm.usage.output_tokens&quot;, resp.usage.output_tokens)<br>        return text</pre><p>The agent.output attribute is the whole trick. Later we can pull every span for a trace, sort by start time, and reconstruct the exact transcript the agents produced without storing anything separately. The trace <em>is</em> the conversation log.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HpogW6HEnY8tU7Lot1Wtw.png" /><figcaption>One run in SigNoz. Each agent turn is its own span under agent.run, tagged with its input, output, and token count, so the trace is the conversation log.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2JwappTv8WvEOSXl4zFtIA.png" /></figure><h3>The parts that fought back</h3><p>The architecture above sounds tidy. Getting there was a sequence of small, specific fights. These are the ones worth writing down, because each cost us real time and none of them were in the docs we were reading.</p><p><strong>gRPC works locally, then Cloud wants HTTP.</strong> Our first exporter used gRPC with insecure=True, which is fine for a local collector. SigNoz Cloud wants OTLP over HTTP with TLS and an ingestion-key header. The fix, checked against the <a href="https://opentelemetry.io/docs/languages/python/exporters/">OpenTelemetry Python exporter docs</a>:</p><pre># backend/app/agent_app/telemetry.py (endpoint/headers factored into utils/otlp.py)<br>from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter<br><br>exporter = OTLPSpanExporter(<br>    endpoint=&quot;https://ingest.in2.signoz.cloud:443/v1/traces&quot;,<br>    headers={&quot;signoz-ingestion-key&quot;: KEY},<br>)</pre><p>Two things bit us here. The /v1/traces suffix is not appended for you when you pass endpoint= directly, you add it yourself. The same is true for metrics with /v1/metrics. The docs do say this, but we learned it the slow way, by watching spans silently fail to arrive with no error to grep for.</p><p><strong>A valid API key that could not read anything.</strong> To read traces back out we created a SigNoz API key. It authenticated fine against /api/v1/version and returned 200, so we assumed it worked. Then every query returned: 403 {&quot;code&quot;:&quot;authz_forbidden&quot;,&quot;message&quot;:&quot;only viewers/editors/admins can access this resource&quot;}</p><p>The key existed but had no usable role attached. A working /version call proves nothing, because that endpoint is effectively public. Recreating the key with an explicit role fixed it immediately. And worth saying out loud because it confused us at the start: the ingestion key and the API key are two different things. One sends data in, one reads it back.</p><p><strong>The endpoint that returned HTML instead of JSON.</strong> We wrote our trace-detail fetch against /api/v2/traces/{id} and got: JSONDecodeError: Expecting value: line 1 column 1 (char 0)</p><p>The endpoint was returning 200 with the HTML shell of the single-page app, not data. After curling the variants, the one that returns real JSON on our instance is /api/v1/traces/{id}. Trace listing is POST /api/v4/query_range. The takeaway is dull but true: SigNoz API paths vary by version, so probe them against your own instance before trusting any blog post, including this one.</p><p>When JSON did come back, it was columnar, not a list of span objects: a columns array naming the fields, and an events array of rows, with tags as two parallel arrays you zip back together.</p><pre># backend/app/classifier/signoz_client.py (get_trace_spans)<br>block = data[0]<br>cols = block.get(&quot;columns&quot;, [])<br>for row in block.get(&quot;events&quot;, []):<br>    rec  = dict(zip(cols, row))<br>    tags = dict(zip(rec.get(&quot;TagsKeys&quot;) or [], rec.get(&quot;TagsValues&quot;) or []))<br>    spans.append({<br>        &quot;name&quot;:  rec.get(&quot;Name&quot;, &quot;&quot;),<br>        &quot;start&quot;: rec.get(&quot;__time&quot;, 0),<br>        &quot;tags&quot;:  tags, # agent.name / agent.input / agent.output live here<br>    })</pre><p>We figured this out by dumping the raw response to a file and staring at it, because none of the field names matched what we expected. TagsKeys and TagsValues as separate parallel arrays is not a shape we would have guessed.</p><p><strong>Two config bugs that were secretly one bug.</strong> At one point we had two unrelated-looking failures at once. The Anthropic client threw TypeError: Could not resolve authentication method, and OpenTelemetry was quietly falling back to localhost:4318 and spewing connection-refused retries. Two symptoms, one cause: the module created the Anthropic client at import time, before load_dotenv() ran in main(). The env vars simply were not there yet. Moving load_dotenv() up into the package __init__.py fixed both at once. The tell we will remember: two config failures firing together usually means one env-loading problem, not two bugs.</p><p><strong>The bug our own UI caught.</strong> resp.content[0].text crashed with ’ThinkingBlock’ object has no attribute ‘text’. The first content block from the model is not always text. We only caught it because the chat UI surfaced the error inline, right where a normal answer should have been, instead of swallowing it in a log. Fixed by iterating for the first block whose type == &quot;text&quot;.</p><h3>The judge, and the uncomfortable part</h3><p>As we said up top, we did not want to invent our own definition of “failure”. We grounded the judge in MAST’s 14 failure modes, using the paper’s own definitions.txt and examples.txt so the categories are theirs, not our paraphrase of them. The judge itself is ours: our own LLM-as-a-judge prompt that reads a reconstructed transcript and assigns a MAST failure mode with a rationale. The classifier reconstructs the transcript from spans, runs it through the judge, and writes the verdict back into SigNoz as a mast.verdict metric tagged with the originating trace_id.</p><p>Then the twist. When we ran the judge over our own pipeline, it flagged nearly every run as failing. The most common verdicts were FM-3.2 (No or incorrect verification) and FM-3.1 (Premature termination). Our first reaction was “the judge is broken.”</p><p>It was not. Our pipeline had no verification step at all. There was no agent whose job was to check the work before the writer shipped it. The taxonomy was describing a real architectural hole we had designed in from the start, and it looked fine only because the outputs were plausible. We had built the observability to <em>find</em> failures before we built the thing that would have <em>prevented</em> the most common one.</p><p>That was a slightly deflating moment, and also the moment the project justified itself. A latency graph would never have told us this. A content-level judge did, on the first honest look.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V8MrO13-BsTBQRkRlmjK4A.png" /><figcaption>The MAST failure modes the judge found across runs.</figcaption></figure><h3>Closing the loop with SigNoz</h3><p>Once verdicts were flowing as metrics, the rest of SigNoz earned its place.</p><p><strong>Reproducible install (Foundry).</strong> Our live runs went to SigNoz Cloud, but we also wanted a judge to be able to stand the whole thing up from scratch, so the deployment is defined as code. casting.yaml plus its generated casting.yaml.lock describe a Foundry deployment that brings up SigNoz <em>and</em> its MCP server in one step:</p><pre>curl -fsSL https://signoz.io/foundry.sh | bash<br>foundryctl cast -f casting.yaml</pre><p>Enabling the MCP server is a single block in the spec:</p><pre>spec:<br>  mcp:<br>    spec:<br>      enabled: true</pre><p>Ask the failures in plain English (MCP). Foundry doesn’t stop at the database and dashboards, it also brings up <strong>SigNoz’s MCP server</strong>, which is where this gets fun. Point Claude Code at it:</p><pre>claude mcp add - transport http signoz http://localhost:8000</pre><p>Now the coding agent can query the telemetry the way you’d ask a teammate, no dashboard clicking required: “which traces got an FM-3.2 verdict in the last hour?” or “pull the transcript for trace X and explain the failure.” The verdicts we pushed back as mast.verdict are right there to filter on. It closes the loop between spotting a failure and fixing it, from the same window where we write the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iF9grygXpIF3oC0CciPP5Q.png" /><figcaption>Asking Claude Code which runs failed, answered straight from SigNoz over MCP.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNEyg1x7rCNw9Gwdp2Cavw.png" /><figcaption>Asking Claude Code which runs failed, answered straight from SigNoz over MCP.</figcaption></figure><p><strong>Dashboard.</strong> We built it via the API (POST /api/v1/dashboards) rather than clicking, so it is reproducible, with panels for failure modes by primary_mode, verdicts over time, and token spend. Live data confirmed it: mast.verdict came back as three series, FM-1.1 x6, FM-3.1 x2, FM-3.2 x2.</p><p><strong>Alerts.</strong> This one fought us. POST /api/v1/rules kept returning a bare 400 {&quot;error&quot;:&quot;alert rule is not valid&quot;} with no field-level detail. Probing variants got us nowhere. What finally worked was cloning the SigNoz source and reading PostableRule.Validate() in pkg/types/ruletypes/api_params.go. Two requirements the error never mentioned: &quot;version&quot;: &quot;v5&quot; is mandatory, and condition.compositeQuery.queries must be a list of {type, spec} objects in the v5 query-builder shape, not the older builderQueries dict that the dashboard panels still use. So the dashboard API and the alert API expect different query shapes on the same version. The next error was at least honest: &quot;at least one channel is required&quot;. SigNoz will not save an alert with nowhere to send it, so we pointed it at the hackathon email channel. The lesson: when a self-hostable tool gives you a vague validation error, the source is faster than guessing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EPWDU-oMOixRn35lOnw2Vw.png" /><figcaption>Signoz alertd when MAST failures spike</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_qboHiJk3eDKPouMa7Cxgg.png" /><figcaption>An alert fires when MAST failures spike</figcaption></figure><p><strong>A bug in our own script.</strong> Our demo helper wrote verdicts to SQLite via store.upsert() but never called emit_verdict(), so nothing reached SigNoz as a metric. The metric <em>name</em> still showed up in the metrics list from earlier runs, which made it look wired up while the panels rendered empty. “The metric exists” is not “the metric has data.” Add the emit-and-flush, and the panels filled in.</p><p>One more piece of friction worth naming: after a run, SigNoz takes roughly 30 to 60 seconds to index the traces before they are queryable. During a demo that is an eternity, so we keep a classify_now.py that judges on demand instead of waiting for the poll loop.</p><h3>The human-in-the-loop fix</h3><p>The judge does not just diagnose. For a failing agent it drafts an improved system prompt and shows it to us as a diff. Nothing ships automatically. We approve, the override goes live in prompt_overrides.json, and an approved fix can open a GitHub PR. We built the propose step and the approve step as separate actions specifically so we could verify that proposing does not silently apply anything. It does not.</p><p>That gate is deliberate. We are trusting one LLM to grade another, and we have not yet measured how good that judge is on our own data. Until we have, a human reads every rewrite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DhK-uI-U7F1L2-MC57yAPQ.png" /><figcaption>Every fix is a diff you approve before it ships.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q5dI2EYLjVqGgV0ubOCEOQ.png" /><figcaption>Human approves, Whodunnit opens the PR: the diff goes through normal code review.</figcaption></figure><h3>What we would do differently</h3><ul><li><strong>Build the verifier agent first.</strong> The most common failure the judge found was the one our architecture guaranteed. We documented the finding but did not add the verifier during the hackathon, which is exactly backwards. If we started again, a verification step goes in before we instrument anything.</li><li><strong>Probe the API surface before writing the client.</strong> Ten minutes of curl up front would have saved the HTML-not-JSON detour entirely.</li><li><strong>Load config at the package boundary.</strong> Creating API clients at import time, before load_dotenv() ran, produced two unrelated-looking failures from one root cause. That belongs in __init__.py on day one.</li><li><strong>What we still do not know.</strong> We never measured this judge’s agreement with our own labels on our own traces. The paper reports 94% accuracy and 0.77 Cohen’s kappa on <em>their</em> dataset. We are inheriting that claim, not reproducing it. Hand-labelling a batch of our own runs is the first thing we would measure next.</li></ul><h3>Conclusion</h3><p>Observability for agents is not really about latency graphs. It is about catching the runs that pass while being wrong, and about being honest when the tool you build points back at you.</p><p>If you run multi-agent systems, instrument every agent turn as its own span, tag the outputs, and judge the reconstructed transcript against something rigorous. You might, like us, find the bug was never in the framework. It was in the design.</p><p><em>Repo: </em><a href="https://github.com/akarsh-jain-790/whodunnit">github.com/akarsh-jain-790/whodunnit</a><em><br>MAST paper: </em><a href="https://arxiv.org/pdf/2503.13657"><em>arXiv:2503.13657</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f828a5159d4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>