DEV Community

Aman Maurya
Aman Maurya

Posted on AI-assisted

DeskBreak: The AI Agent That Wants You to Stop Looking at It (with Sentry Agent Tracing)

Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass Submission 🌿

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass competing in the **Best Use of Sentry Agent Tracing* prize category.*


🌿 What I Built: The Anti-Screen Agent

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.

You tell yourself: "I need to step outside for 5 minutes and get some fresh air."

And what is the first thing you do? You reach for your phone or open a browser tab.

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.

The problem with modern "wellness" tech is that it demands more screen time to solve a crisis caused by excessive screen time.

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

How It Works & Gets You Outside:

  1. One-Click Duration: Choose how much time you have right now: 5 Min (The 300-Pace Reset), 10 Min (The Canopy Stroll), or 15 Min (The Horizon Immersion).
  2. Sub-350ms Dispatch: 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).
  3. The Screen Lockout: The instant the mission is dispatched, the UI drops into a calm, dark Offline Screen Lock Card with a countdown timer. No feeds, no settings, no endless scrolling—your screen is useless until your outdoor break is finished.

🚀 Demo

  • 🌐 Live Interactive Web App (GitHub Pages): 👉 amanmaurya92.github.io/deskbreak
  • ⚡ Zero Setup Required: Test it immediately on your desktop or phone browser—no terminal, Docker, or Python virtual environments needed!
  • 🔍 Interactive Sentry Flame Graph: Experience the live OpenTelemetry trace waterfall rendered in real time directly inside the UI.

💻 Code & Deployment

The complete codebase is 100% open-source under the MIT license on GitHub:
👉 github.com/amanmaurya92/deskbreak

  • Hosting & Runtime: Static deployment hosted on GitHub Pages (github.io) with zero server overhead.
  • Frontend Stack: Clean vanilla web architecture (HTML5 semantic layout, custom CSS glassmorphism, modern typography via Google Fonts Outfit & Inter).
  • Inference Layer: Open-weight compatible client agent loop designed for deterministic sub-350ms dispatch.
  • Observability: Sentry Agent Tracing via @sentry/browser tracking OpenTelemetry AI span conventions.

🏗️ How I Built It: Architecture & Tracing Hierarchy

DeskBreak is built as an autonomous, multi-step pipeline that maps directly into Sentry's OpenTelemetry AI hierarchical span model:

flowchart TD
    A[User Selects Break Duration] --> B["ai.pipeline: deskbreak.prescribe_break"]
    B --> C["ai.tool_call: checkSunlightAndWeather"]
    C --> D["ai.tool_call: craftSensoryMission"]
    D --> E["ai.chat_completions.create: gemma-2-2b-instruct"]
    E --> F[Offline Screen Lock Card with Live Countdown]

Sentry Trace Hierarchy:

  • ai.pipeline: The root transaction measuring end-to-end user dispatch latency.
  • ai.tool_call: Child spans measuring individual tool executions (checkSunlightAndWeather, craftSensoryMission).
  • ai.chat_completions.create: Child inference span recording prompt tokens, completion tokens, temperature, and cost ($0.00).

Setting Up Sentry Agent Tracing in the Browser:

import * as Sentry from "@sentry/browser";

Sentry.init({
  dsn: userDsn || process.env.SENTRY_DSN,
  tracesSampleRate: 1.0,
  sendDefaultPii: true, // Captures mission context and prompt inputs in Sentry's AI dashboard
  release: "deskbreak@1.0.0",
  initialScope: {
    tags: {
      "agent.type": "touch-grass-optimizer",
      "challenge.week": "week-1-touch-grass",
    }
  }
});
Enter fullscreen mode Exit fullscreen mode

Wrapping Custom Tool Calls:

recordToolSpan(toolName, inputData, outputData, durationMs) {
  const span = {
    op: "ai.tool_call",
    description: `tool:${toolName}`,
    durationMs,
    input: inputData,
    output: outputData
  };

  if (window.Sentry) {
    window.Sentry.addBreadcrumb({
      category: "ai.tool_call",
      message: `Executed tool: ${toolName}`,\n      data: { toolName, durationMs, outputData }\n    });\n  }\n  return span;\n}\n```

\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 & 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 & 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 `gen_ai.usage.prompt_tokens` 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 `craftSensoryMission` 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** | `4,200 ms` | `320 ms` | **-92.3% faster** | `ai.pipeline` |\n| **Total Token Footprint** | `2,800 tokens` | `520 tokens` | **-81.4% fewer tokens** | `ai.chat_completions.create` |\n| **Tracing Spans Recorded** | `12 spans` | `4 spans` | **Clean & concise** | `distributed_trace` |\n| **Inference Cost** | `$0.00` | `$0.00` | **$0.00 (Open-Weights)** | `gen_ai.cost` |\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 & 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 `ai.pipeline` bar in emerald green.\n- Child `ai.tool_call` bars in electric cyan.\n- Child `ai.chat_completions.create` 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> *\"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
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
harsh_vardhanpandey_08fc profile image
Harsh Vardhan Pandey •

Great Build!

Collapse
 
women_health_c766b6a74ff9 profile image
Women health •

Nice work