Back/Engineering/Claude/GitHub Copilot
IntermediateEngineering

How to Build a Custom AI Harness for Automated Sentry Bug Triage

Create a specialized AI agent to automatically investigate and triage bug reports from Sentry. This harness uses the Claude Agent SDK to gather evidence, identify root causes, and generate actionable engineering reports.

How to Build a Custom AI Harness for Automated Sentry Bug Triage

From 07:48 to 21:00, Claire demonstrates her Sentry triage harness, then walks through its runs, tasks, tools, artifacts, file layout, and investigation result. Clip range: 07:48 to 21:00.

Before you start

What you need

  • Claude Agent SDK project
  • Sentry API access token
  • Linear and GitHub API credentials
  • Artifact storage directory
  • Terminal UI environment using Ink or another CLI framework

What you’ll make

An investigation brief containing confirmed evidence, suspected causes, verification steps, and recommended next actions for a Sentry issue.

Tools used

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

6 steps

Step01

Define the Harness Architecture

Before coding, map out the system's architecture. Plan for a frontend like a Terminal UI using Ink, a core built on the Claude Agent SDK, specific tool adapters for APIs like Sentry and Linear, and a file-based artifact store for saving investigation results.

Step02

Scaffold the Harness with AI Assistance

Use an LLM like Claude or Codex to generate the initial code structure. Provide a specific prompt that details the desired SDK, like the Claude Agent SDK, and the intended workflow. The goal is to get a scaffold for an agentic system, not a simple, deterministic script.

Example prompt
Help me build a harness. I want to use the Claude Agent SDK to triage Sentry bugs. Here's the workflow I want it to follow.
Step03

Build Opinionated Tool Adapters

Instead of granting general API access, build small, focused modules that connect to tools like Sentry, Linear, and GitHub. These adapters should expose only the specific functions needed for bug triage, such as fetching a particular type of evidence. This constraint makes the agent's work faster and more reliable.

Step04

Craft a Custom System Prompt

Write a highly specific system prompt and encode it directly into the harness. This ensures the agent receives the same context on every run. The prompt should define the agent's role, the task's scope, which artifacts to use as a source of truth, and the exact format for the expected output.

Example prompt
you are working inside the chat purity engineering harness. It's chat, be specific. It's not an open-ended coding system we wanna use. These artifacts as a source of truth. And here's the plan to attack a very specific problem. And what I want you to return is X, Y, and Z.
Step05

Implement the User Interface

Build a simple interface for developers to run the harness. A command-line or terminal UI (TUI) is an effective option, which can be built with a library like Ink for Node.js. The interface should allow an operator to start an investigation by providing an input like a Sentry link.

Step06

Run an Investigation and Review Artifacts

Start an investigation by providing the harness with a Sentry bug report link. After the run completes, check the artifact store for its output. Review the 'investigation brief,' which should separate confirmed evidence from likely causes, describe how to verify the hypothesis, and state a next action.

What good looks like

  • Harness accepts a Sentry issue link as input
  • Tool adapters expose only approved triage operations
  • Artifacts are written to the configured storage directory
  • Investigation brief separates confirmed evidence from hypotheses

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

After the steps

Runbook notes

How to recover when the loop fails and where human judgment helps.

Recover

If it goes sideways

Agent retrieves unrelated incidents from Sentry
Restrict queries to the provided issue identifier and project scope
Artifact files overwrite previous investigations
Use timestamped directories or unique investigation IDs
Linear or GitHub adapters expose unsafe write actions
Limit adapters to read-only operations during triage

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready