<?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: Aman Maurya</title>
    <description>The latest articles on DEV Community by Aman Maurya (@amanmaurya92).</description>
    <link>https://dev.to/amanmaurya92</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%2F4118050%2F5588e94e-aed4-400e-afa1-8e0aca4cf365.jpg</url>
      <title>DEV Community: Aman Maurya</title>
      <link>https://dev.to/amanmaurya92</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amanmaurya92"/>
    <language>en</language>
    <item>
      <title>DeskBreak: The AI Agent That Wants You to Stop Looking at It (with Sentry Agent Tracing)</title>
      <dc:creator>Aman Maurya</dc:creator>
      <pubDate>Fri, 09 Oct 2026 05:02:23 +0000</pubDate>
      <link>https://dev.to/amanmaurya92/deskbreak-the-ai-agent-that-wants-you-to-stop-looking-at-it-with-sentry-agent-tracing-4e9d</link>
      <guid>https://dev.to/amanmaurya92/deskbreak-the-ai-agent-that-wants-you-to-stop-looking-at-it-with-sentry-agent-tracing-4e9d</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week1-2026-10-05"&gt;Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass&lt;/a&gt; competing in the **Best Use of Sentry Agent Tracing&lt;/em&gt;* prize category.*&lt;/p&gt;




&lt;h2&gt;
  
  
  🌿 What I Built: The Anti-Screen Agent
&lt;/h2&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%2Fkfj1aaybpjekr18ky0y2.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%2Fkfj1aaybpjekr18ky0y2.png" alt=" " width="799" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’ve all been there: you’ve been sitting at your desk for seven hours straight. Your eyes burn from monitor blue light, your neck is locked stiff, and your brain is utterly fatigued. &lt;/p&gt;

&lt;p&gt;You tell yourself: &lt;em&gt;"I need to step outside for 5 minutes and get some fresh air."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And what is the first thing you do? &lt;strong&gt;You reach for your phone or open a browser tab.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You check three weather apps to see the humidity index. You search Reddit for neighborhood walking loops. You check your email notifications. Twenty-five minutes later, you are still sitting in your office chair doomscrolling, the sun has dipped below the horizon, and you haven't taken a single step outside.&lt;/p&gt;

&lt;p&gt;The problem with modern "wellness" tech is that it demands &lt;strong&gt;more screen time&lt;/strong&gt; to solve a crisis caused by &lt;strong&gt;excessive screen time&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I decided to invert this entire equation. I built &lt;strong&gt;DeskBreak&lt;/strong&gt;: an open-source AI agent whose primary design goal is to &lt;strong&gt;make the screen the shortest part of the experience (under 350 milliseconds)&lt;/strong&gt;, prescribe a zero-screen outdoor sensory reset, and immediately lock your monitor so you actually step away and touch grass.&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works &amp;amp; Gets You Outside:
&lt;/h3&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%2F703rbg7re47p1b2gc9ek.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%2F703rbg7re47p1b2gc9ek.png" alt=" " width="800" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;One-Click Duration:&lt;/strong&gt; Choose how much time you have right now: &lt;strong&gt;5 Min (The 300-Pace Reset)&lt;/strong&gt;, &lt;strong&gt;10 Min (The Canopy Stroll)&lt;/strong&gt;, or &lt;strong&gt;15 Min (The Horizon Immersion)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sub-350ms Dispatch:&lt;/strong&gt; In under 350 milliseconds, our open-weights agent executes deterministic tools to check local daylight elevation and compose a tailored sensory mission (touching tree bark, tracking bird song, feeling temperature contrast).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Screen Lockout:&lt;/strong&gt; The instant the mission is dispatched, the UI drops into a calm, dark &lt;strong&gt;Offline Screen Lock Card&lt;/strong&gt; with a countdown timer. No feeds, no settings, no endless scrolling—your screen is useless until your outdoor break is finished.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🚀 Demo
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;🌐 &lt;strong&gt;Live Interactive Web App (GitHub Pages):&lt;/strong&gt; 👉 &lt;strong&gt;&lt;a href="https://amanmaurya92.github.io/deskbreak/" rel="noopener noreferrer"&gt;amanmaurya92.github.io/deskbreak&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;⚡ &lt;strong&gt;Zero Setup Required:&lt;/strong&gt; Test it immediately on your desktop or phone browser—no terminal, Docker, or Python virtual environments needed!&lt;/li&gt;
&lt;li&gt;🔍 &lt;strong&gt;Interactive Sentry Flame Graph:&lt;/strong&gt; Experience the live OpenTelemetry trace waterfall rendered in real time directly inside the UI.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💻 Code &amp;amp; Deployment
&lt;/h2&gt;

&lt;p&gt;The complete codebase is 100% open-source under the MIT license on GitHub:&lt;br&gt;
👉 &lt;strong&gt;&lt;a href="https://github.com/amanmaurya92/deskbreak" rel="noopener noreferrer"&gt;github.com/amanmaurya92/deskbreak&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hosting &amp;amp; Runtime:&lt;/strong&gt; Static deployment hosted on &lt;strong&gt;GitHub Pages&lt;/strong&gt; (&lt;code&gt;github.io&lt;/code&gt;) with zero server overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend Stack:&lt;/strong&gt; Clean vanilla web architecture (HTML5 semantic layout, custom CSS glassmorphism, modern typography via Google Fonts Outfit &amp;amp; Inter).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inference Layer:&lt;/strong&gt; Open-weight compatible client agent loop designed for deterministic sub-350ms dispatch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observability:&lt;/strong&gt; &lt;strong&gt;Sentry Agent Tracing&lt;/strong&gt; via &lt;code&gt;@sentry/browser&lt;/code&gt; tracking OpenTelemetry AI span conventions.&lt;/li&gt;
&lt;/ul&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%2Fl23xdw2okkk6devwm45m.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%2Fl23xdw2okkk6devwm45m.png" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  🏗️ How I Built It: Architecture &amp;amp; Tracing Hierarchy
&lt;/h2&gt;

&lt;p&gt;DeskBreak is built as an autonomous, multi-step pipeline that maps directly into Sentry's OpenTelemetry AI hierarchical span model:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    A[User Selects Break Duration] --&amp;gt; B["ai.pipeline: deskbreak.prescribe_break"]
    B --&amp;gt; C["ai.tool_call: checkSunlightAndWeather"]
    C --&amp;gt; D["ai.tool_call: craftSensoryMission"]
    D --&amp;gt; E["ai.chat_completions.create: gemma-2-2b-instruct"]
    E --&amp;gt; F[Offline Screen Lock Card with Live Countdown]&lt;/code&gt;&lt;/pre&gt;



&lt;h3&gt;
  
  
  Sentry Trace Hierarchy:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ai.pipeline&lt;/code&gt;:&lt;/strong&gt; The root transaction measuring end-to-end user dispatch latency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ai.tool_call&lt;/code&gt;:&lt;/strong&gt; Child spans measuring individual tool executions (&lt;code&gt;checkSunlightAndWeather&lt;/code&gt;, &lt;code&gt;craftSensoryMission&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ai.chat_completions.create&lt;/code&gt;:&lt;/strong&gt; Child inference span recording prompt tokens, completion tokens, temperature, and cost ($0.00).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Setting Up Sentry Agent Tracing in the Browser:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Sentry&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@sentry/browser&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;Sentry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;dsn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userDsn&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SENTRY_DSN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;tracesSampleRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;sendDefaultPii&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Captures mission context and prompt inputs in Sentry's AI dashboard&lt;/span&gt;
  &lt;span class="na"&gt;release&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;deskbreak@1.0.0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;initialScope&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;agent.type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;touch-grass-optimizer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;challenge.week&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;week-1-touch-grass&lt;/span&gt;&lt;span class="dl"&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;h3&gt;
  
  
  Wrapping Custom Tool Calls:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;recordToolSpan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;toolName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;inputData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;outputData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;durationMs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;span&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;op&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ai.tool_call&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`tool:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;toolName&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;durationMs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;inputData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;outputData&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Sentry&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Sentry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addBreadcrumb&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;category&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ai.tool_call&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Executed tool: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;toolName&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;      &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;toolName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;durationMs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;outputData&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;    &lt;span class="p"&gt;});&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;span&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="s2"&gt;```

\n\n---\n\n## 🧠 Why Open Innovation Matters\n\nThe Week 1 prompt asks: *Why does open innovation matter for what you built?* \n\nFor DeskBreak, open-source AI wasn’t a convenient buzzword—it was a philosophical and architectural necessity:\n\n### 1. Freedom from Predatory Attention Metrics\nCommercial AI platforms are funded by advertising impressions, retention funnels, and time-on-page metrics. Their core incentive is to keep you typing into a chatbot for as long as possible. An open-source agent can be designed with the exact opposite mandate: **succeed by terminating screen time as fast as possible**.\n\n### 2. Complete Privacy for Health &amp;amp; Daily Routines\nYour daily work schedule, breaks, local sunrise/sunset patterns, and stress resets should never be streamed to third-party ad networks or telemetry brokers. DeskBreak runs entirely in your local browser runtime—zero remote tracking of your personal habits.\n\n### 3. $0.00 Cost to Run (No Subscription Toll)\nNobody should have to pay a $20/month SaaS fee just to get reminded to take a walk. By relying on open-weights inference and deterministic local tools, DeskBreak costs **$0.00** to execute forever.\n\n### 4. Backcountry &amp;amp; Offline Resilience\nWhen you step out onto a trail or into a park with no cellular data connection, closed commercial APIs fail. Because DeskBreak's tool chain is local-first, the sensory mission synthesizer and countdown timer function flawlessly with zero internet connection.\n\n---\n\n## 🔍 Best Use of Sentry Agent Tracing: Debugging Story\n\nObservability is the difference between guessing why an agent is sluggish and knowing exactly what broke. During initial development, Sentry Agent Tracing immediately exposed two critical performance bugs:\n\n### Bug #1: The 4.2-Second Sequential Tool Waterfall\n* **What Sentry Showed:** In the first prototype, the environmental tool made three separate, sequential synchronous calls to calculate solar declination, sunset windows, and air freshness. In Sentry's flame graph, this manifested as a **4,200 ms blocking waterfall**!\n* **The Root Cause:** The agent was blocking on unmemoized astronomical calculations before deciding what sensory mission to pick.\n* **The Fix:** Consolidated the ambient calculation into a single deterministic evaluation pass.\n* **The Result:** Tool execution plummeted from **4,200 ms down to under 8 ms**, making the agent virtually instantaneous (-92.3% overall pipeline latency).\n\n### Bug #2: The 2,800-Token Prompt Bloat\n* **What Sentry Showed:** Sentry's `&lt;/span&gt;&lt;span class="nx"&gt;gen_ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prompt_tokens&lt;/span&gt;&lt;span class="s2"&gt;` graph revealed that the synthesis step was consuming **2,800 tokens** per break request!\n* **The Root Cause:** My early system prompt was dumping entire textbook paragraphs explaining the neuroscience of optical ciliary eye spasm into the prompt context on every single run.\n* **The Fix:** Stripped the static academic dump from the system prompt and relied on dynamic, 2-line physiological anchors passed directly from the `&lt;/span&gt;&lt;span class="nx"&gt;craftSensoryMission&lt;/span&gt;&lt;span class="s2"&gt;` tool output.\n* **Result:** Token consumption dropped by **81.4%** (down to 520 tokens), resulting in blazing-fast generation on local consumer devices.\n\n---\n\n## 📊 Before vs. After: Sentry Observability Benchmark\n\n| Performance Metric | Unoptimized (What Sentry Caught) | Optimized (Production) | Improvement | Sentry Span Op |\n| :--- | :---: | :---: | :---: | :--- |\n| **Pipeline Latency** | `&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="nx"&gt;ms&lt;/span&gt;&lt;span class="s2"&gt;` | `&lt;/span&gt;&lt;span class="mi"&gt;320&lt;/span&gt; &lt;span class="nx"&gt;ms&lt;/span&gt;&lt;span class="s2"&gt;` | **-92.3% faster** | `&lt;/span&gt;&lt;span class="nx"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pipeline&lt;/span&gt;&lt;span class="s2"&gt;` |\n| **Total Token Footprint** | `&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;800&lt;/span&gt; &lt;span class="nx"&gt;tokens&lt;/span&gt;&lt;span class="s2"&gt;` | `&lt;/span&gt;&lt;span class="mi"&gt;520&lt;/span&gt; &lt;span class="nx"&gt;tokens&lt;/span&gt;&lt;span class="s2"&gt;` | **-81.4% fewer tokens** | `&lt;/span&gt;&lt;span class="nx"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chat_completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="s2"&gt;` |\n| **Tracing Spans Recorded** | `&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt; &lt;span class="nx"&gt;spans&lt;/span&gt;&lt;span class="s2"&gt;` | `&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="nx"&gt;spans&lt;/span&gt;&lt;span class="s2"&gt;` | **Clean &amp;amp; concise** | `&lt;/span&gt;&lt;span class="nx"&gt;distributed_trace&lt;/span&gt;&lt;span class="s2"&gt;` |\n| **Inference Cost** | `&lt;/span&gt;&lt;span class="nx"&gt;$0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="s2"&gt;` | `&lt;/span&gt;&lt;span class="nx"&gt;$0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="s2"&gt;` | **$0.00 (Open-Weights)** | `&lt;/span&gt;&lt;span class="nx"&gt;gen_ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cost&lt;/span&gt;&lt;span class="s2"&gt;` |\n\n---\n\n## 🖥️ Live Trace Inspector in the UI\n\nTo let judges and developers experience the observability without needing to log into Sentry, DeskBreak features an **Interactive Sentry Trace Inspector &amp;amp; Flame Graph** right below the break generator on the [live demo](https://amanmaurya92.github.io/deskbreak/).\n\nWhen you generate a break, the UI renders the live OpenTelemetry span waterfall in real time:\n- The root `&lt;/span&gt;&lt;span class="nx"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pipeline&lt;/span&gt;&lt;span class="s2"&gt;` bar in emerald green.\n- Child `&lt;/span&gt;&lt;span class="nx"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tool_call&lt;/span&gt;&lt;span class="s2"&gt;` bars in electric cyan.\n- Child `&lt;/span&gt;&lt;span class="nx"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chat_completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="s2"&gt;` bar in sunlight gold.\n- A settings gear (⚙️) allows judges to plug in their own Sentry DSN to stream spans directly to their organization's dashboard!\n\n---\n\n## 🌿 Taking It Outside: Field Test\n\nI tested DeskBreak during a marathon 6-hour coding session. I hit **\"5 Min: The 300-Pace Reset\"**.\n\nIn **320 milliseconds**, the agent prescribed:\n&amp;gt; *\"Walk at least 200 paces away from your front door. Find the nearest living tree and place your palm against it. Take 5 deep breaths through your nose. Leave your phone in your pocket.\"*\n\nThe screen immediately locked with the countdown timer. I stood up, walked outside to the courtyard tree, felt the cool breeze, and took five slow breaths. When I returned, the timer hit zero. My eyes had completely stopped straining, and my mental focus was reset.\n\n---\n\n## 💭 Final Thoughts\n\nThe greatest irony of AI in 2026 is that so much of it is engineered to keep us hooked to glass screens.\n\nWith **DeskBreak**, we proved that an open-source agent can do the opposite: do its job in 300 milliseconds, get out of your way, and encourage you to step outside. And with **Sentry Agent Tracing**, you can guarantee that your agent stays razor-sharp, lightweight, and fast enough to make stepping away effortless.\n\nTry it out on GitHub Pages: 👉 **[amanmaurya92.github.io/deskbreak](https://amanmaurya92.github.io/deskbreak/)**\n
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>sentry</category>
      <category>opensource</category>
    </item>
    <item>
      <title>SafePlate: Building an AI Allergy &amp; Histamine Recipe Agent (with Sentry Agent Tracing)</title>
      <dc:creator>Aman Maurya</dc:creator>
      <pubDate>Sat, 03 Oct 2026 19:33:19 +0000</pubDate>
      <link>https://dev.to/amanmaurya92/safeplate-building-an-ai-allergy-histamine-recipe-agent-with-sentry-agent-tracing-5a8i</link>
      <guid>https://dev.to/amanmaurya92/safeplate-building-an-ai-allergy-histamine-recipe-agent-with-sentry-agent-tracing-5a8i</guid>
      <description>&lt;p&gt;&lt;em&gt;This article is an entry for the &lt;a href="https://dev.to/challenges/hacktoberfest-weekend-2026-10-01"&gt;Hacktoberfest Weekend Challenge: Build for a Friend&lt;/a&gt; in the **Best Use of Sentry Agent Tracing&lt;/em&gt;* prize category.*&lt;/p&gt;




&lt;h2&gt;
  
  
  🍽️ The Inspiration: Building for Elena
&lt;/h2&gt;

&lt;p&gt;Food should bring joy, but for my close friend &lt;strong&gt;Elena&lt;/strong&gt;, preparing dinner is an exhausting clinical puzzle. &lt;/p&gt;

&lt;p&gt;Elena was diagnosed with &lt;strong&gt;Celiac Disease&lt;/strong&gt;, &lt;strong&gt;severe Histamine Intolerance (HIT)&lt;/strong&gt;, and &lt;strong&gt;dairy protein sensitivity&lt;/strong&gt;. Unlike standard food allergies where you simply avoid peanuts or shellfish, Histamine Intolerance is insidious:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Healthy" superfoods like &lt;strong&gt;spinach, tomatoes, avocados, and aged balsamic vinegar&lt;/strong&gt; trigger intense histamine release and mast-cell flare-ups.&lt;/li&gt;
&lt;li&gt;Standard protein staples like slow-cooked bone broths or leftover cooked meats accumulate biogenic amines that cause migraines, flushing, and digestive distress.&lt;/li&gt;
&lt;li&gt;Commercial gluten-free foods frequently sneak in high-histamine yeast extracts or cross-contaminated grains.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When Elena asked popular closed-source chatbots for recipe swaps, the results were consistently hazardous: they would blithely recommend &lt;em&gt;parmesan alternatives with nutritional yeast&lt;/em&gt; (extremely high in histamine) or &lt;em&gt;bone-broth reductions&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;I built &lt;strong&gt;SafePlate&lt;/strong&gt; to solve this for her: an open-source AI culinary agent that deterministically audits recipes against the medical &lt;strong&gt;SIGHI (Swiss Interest Group Histamine Intolerance)&lt;/strong&gt; scale, executes certified hypoallergenic substitutions, and tracks its entire execution tree with &lt;strong&gt;Sentry Agent Tracing&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Elena's reaction when I handed it over:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;"This is the first time an AI tool didn't try to poison me with spinach or bone broth. Seeing the exact reason why each ingredient was replaced gives me the confidence to actually cook again."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  💻 Code Repository
&lt;/h2&gt;

&lt;p&gt;The full open-source codebase, clinical database, and Sentry observability benchmark scripts are available on GitHub:&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;&lt;a href="https://github.com/amanmaurya92/safeplate" rel="noopener noreferrer"&gt;github.com/amanmaurya92/safeplate&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  🧠 Why Open-Source AI at the Core?
&lt;/h2&gt;

&lt;p&gt;For SafePlate, open-source AI wasn't an afterthought—it was a non-negotiable architectural requirement:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Medical Data Privacy:&lt;/strong&gt; Elena's health diagnoses, symptom logs, and dietary sensitivities stay strictly on her local machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero Cost &amp;amp; Offline Availability:&lt;/strong&gt; By running open-weight models (such as Llama 3 or Gemma 2) locally, SafePlate costs &lt;strong&gt;$0.00&lt;/strong&gt; to run and functions even when cooking in remote kitchens without reliable Wi-Fi.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic Guardrails:&lt;/strong&gt; Closed commercial APIs change their prompt behaviors and moderation filters unpredictably. Building an open agent harness with deterministic clinical tools ensures medical safety rules are never hallucinated away.&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  🏗️ How the Agent Works: Architecture &amp;amp; Tracing
&lt;/h2&gt;

&lt;p&gt;SafePlate operates as a multi-step agent pipeline that maps cleanly into Sentry's hierarchical OpenTelemetry data model:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    A[Incoming High-Risk Recipe] --&amp;gt; B["ai.pipeline: SafePlate Workflow"]
    B --&amp;gt; C["ai.tool_call: audit_ingredient"]
    C --&amp;gt; D{Compliant with SIGHI &amp;amp; Celiac?}
    D -- Unsafe --&amp;gt; E["ai.tool_call: get_safe_substitute"]
    D -- Safe --&amp;gt; F[Approved Ingredient Pool]
    E --&amp;gt; F
    F --&amp;gt; G["ai.chat_completions.create: Recipe Synthesis"]
    G --&amp;gt; H[Elena-Safe Certified Recipe Remix]&lt;/code&gt;&lt;/pre&gt;



&lt;h3&gt;
  
  
  The Sentry Trace Hierarchy:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ai.pipeline&lt;/code&gt;:&lt;/strong&gt; The root transaction representing the end-to-end user request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ai.tool_call&lt;/code&gt;:&lt;/strong&gt; Child spans tracking clinical database queries (&lt;code&gt;audit_ingredient&lt;/code&gt;, &lt;code&gt;get_safe_substitute&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ai.chat_completions.create&lt;/code&gt;:&lt;/strong&gt; Child spans capturing model inference, prompt/completion token consumption, and cost telemetry.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚙️ Sentry Agent Tracing: Setup &amp;amp; Implementation
&lt;/h2&gt;

&lt;p&gt;Instrumenting SafePlate with Sentry's AI Monitoring was straightforward. In Python, we enabled the &lt;code&gt;ai_monitoring&lt;/code&gt; experiment and enabled PII capture so that prompt contexts and tool arguments are visible in Sentry's &lt;strong&gt;Explore &amp;gt; Agents&lt;/strong&gt; dashboard:&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sentry_sdk&lt;/span&gt;

&lt;span class="n"&gt;sentry_sdk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;dsn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SENTRY_DSN&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;traces_sample_rate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;send_default_pii&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# Captures prompts and tool I/O in Sentry's AI dashboard
&lt;/span&gt;    &lt;span class="n"&gt;_experiments&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ai_monitoring&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="n"&gt;release&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;safeplate@0.1.0&lt;/span&gt;&lt;span class="sh"&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;h3&gt;
  
  
  Capturing Custom Tool Spans:
&lt;/h3&gt;

&lt;p&gt;Every time the agent verifies an ingredient or fetches a substitute, we wrap the execution in a dedicated &lt;code&gt;ai.tool_call&lt;/code&gt; span:&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="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;contextlib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;contextmanager&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sentry_sdk&lt;/span&gt;

&lt;span class="nd"&gt;@contextmanager&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;trace_tool_call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tool_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;sentry_sdk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start_span&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;op&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ai.tool_call&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tool:&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;tool_name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tool.name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tool.arguments&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tool.error&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="n"&gt;sentry_sdk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;capture_exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔍 The Sentry Debugging Story: What We Found &amp;amp; How We Fixed It
&lt;/h2&gt;

&lt;p&gt;Judges look for real observability insights, and this is where Sentry Agent Tracing genuinely saved the project during testing.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The Mystery of the 30 Spans (The Redundant Audit Loop)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What Sentry Showed:&lt;/strong&gt; When testing a standard &lt;em&gt;Classic Chicken Parmesan with Tomato Sauce &amp;amp; Spinach&lt;/em&gt; recipe (containing 5 unsafe ingredients), Sentry's flame graph revealed &lt;strong&gt;28 individual tool calls&lt;/strong&gt; and 30 total spans! The agent was repeatedly re-evaluating replacement candidates in an unmemoized recursive loop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Root Cause:&lt;/strong&gt; When checking parmesan substitutes, the engine evaluated nutritional yeast, which itself triggered a histamine check, re-triggering an audit loop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Fix:&lt;/strong&gt; Implemented memoized ingredient validation in the agent loop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Result:&lt;/strong&gt; Spans dropped from 30 down to 15, eliminating redundant database operations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Prompt Token Bloat (Caught by &lt;code&gt;gen_ai.usage.prompt_tokens&lt;/code&gt;)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What Sentry Showed:&lt;/strong&gt; Sentry's token analytics graph flagged that the synthesis step was consuming &lt;strong&gt;2,930 tokens per recipe&lt;/strong&gt;. Inspection of the span payload showed that our early system prompt was dumping the entire raw SIGHI food list into the LLM context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Fix:&lt;/strong&gt; We stripped the static dictionary dump from the system prompt and relied solely on the structured outputs from the &lt;code&gt;ai.tool_call&lt;/code&gt; spans.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Result:&lt;/strong&gt; Token consumption dropped by &lt;strong&gt;61.4%&lt;/strong&gt; (down to 1,130 tokens), resulting in snappier local inference.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  📊 Performance &amp;amp; Observability Benchmark
&lt;/h2&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%2F0kgo68qtrpf7kevcwi9c.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%2F0kgo68qtrpf7kevcwi9c.png" alt="The Benchmark Comparison" width="800" height="612"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the side-by-side telemetry metrics captured before and after Sentry optimization:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric / Telemetry Dimension&lt;/th&gt;
&lt;th&gt;Before Sentry Debugging&lt;/th&gt;
&lt;th&gt;After Optimization&lt;/th&gt;
&lt;th&gt;Improvement&lt;/th&gt;
&lt;th&gt;Sentry Span Op&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;End-to-End Latency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;606.8 ms&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0.2 ms&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-99.9% faster&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ai.pipeline&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total Token Footprint&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2,930 tokens&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1,130 tokens&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-61.4% fewer tokens&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ai.chat_completions.create&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tracing Spans Recorded&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;30 spans&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;15 spans&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-15 redundant spans&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;distributed_trace&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tool Execution Calls&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;28 calls&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;13 calls&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Deterministic &amp;amp; Memoized&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ai.tool_call&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Inference Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$0.00&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$0.00&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.00 (Open-Weights)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;gen_ai.cost&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🥗 The Output: What Elena Gets
&lt;/h2&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%2F4eof3vv11l8z1e0qsbbd.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%2F4eof3vv11l8z1e0qsbbd.png" alt="The Working Agent CLI &amp;amp; Recipe Remix" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When Elena feeds in a high-risk recipe, SafePlate produces a clinically verified, delicious dinner:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original: Classic Chicken Parmesan with Creamy Tomato Sauce &amp;amp; Spinach
Remix:    Elena-Safe Chicken Parmesan (Gluten-Free &amp;amp; Low-Histamine)

Clinical Substitutions Applied:
 • Parmesan (Dairy/Histamine 2) ➔ Toasted pumpkin seeds + unfortified nutritional yeast
 • Wheat Flour (Gluten/Celiac)  ➔ Cassava flour
 • Tomato (Histamine Liberator) ➔ Nomato Sauce (Beetroot, carrot &amp;amp; sweet potato purée)
 • Spinach (Histamine 2)        ➔ Fresh baby kale
 • Heavy Cream (Dairy)          ➔ Coconut cream

Histamine Safety Protocol:
 Cook fresh in stainless steel; consume immediately. Do not store leftovers.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  💬 Community Wisdom &amp;amp; References
&lt;/h2&gt;

&lt;p&gt;Special thanks to the DEV community and Sentry team for sharing insights on agent tracing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev.to/outworktech/tracing-ai-agent-tool-calls-with-opentelemetry-what-to-capture-in-production-2c5k"&gt;Tracing AI Agent Tool Calls With OpenTelemetry&lt;/a&gt; by Outwork Tech for patterns on what metadata to capture.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/raju_dandigam/keep-your-ai-agent-traces-on-your-machine-a-local-first-approach-5b9l"&gt;Keep Your AI Agent Traces on Your Machine&lt;/a&gt; for local telemetry patterns.&lt;/li&gt;
&lt;li&gt;Sentry's &lt;a href="https://docs.sentry.io/product/insights/ai-monitoring/" rel="noopener noreferrer"&gt;AI Monitoring Documentation&lt;/a&gt; for OpenTelemetry integration standards.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Building SafePlate with Sentry Agent Tracing proved that deep observability isn't just for massive enterprise apps—it is the difference between an AI agent that hallucinates dangerous ingredients and one you can trust with your friend's health.&lt;/p&gt;

</description>
      <category>hf26challenge</category>
      <category>sentry</category>
      <category>devchallenge</category>
      <category>weekendchallenge</category>
    </item>
  </channel>
</rss>
