Skip to content

Add Competitive Research Agent for Market Intelligence#7

Open
Abblanchette wants to merge 6 commits intocodyde:mainfrom
Abblanchette:feat/competitive-research-agent
Open

Add Competitive Research Agent for Market Intelligence#7
Abblanchette wants to merge 6 commits intocodyde:mainfrom
Abblanchette:feat/competitive-research-agent

Conversation

@Abblanchette
Copy link

Summary

This PR adds a new AI-powered Competitive Research agent to help analyze Sentry's market position and compare it with competitors.

Key Features

  • Specialized System Prompt: Focuses on competitive intelligence for error tracking and APM platforms (Datadog, New Relic, Rollbar, Bugsnag, LogRocket, etc.)
  • Quick Query Suggestions: Pre-built queries for common research tasks like pricing comparisons, feature analysis, and market positioning
  • Streaming UI: Real-time responses with tool activity indicators (Web Search, etc.)
  • Full Sentry Observability: Integrated structured logging and custom metrics for monitoring agent usage

Changes

  1. API Route (src/app/api/competitive-research/route.ts)

    • Implements Claude Agent SDK with competitive research system prompt
    • Supports up to 15 turns for deep research tasks
    • Includes comprehensive Sentry metrics and logging
  2. React Component (src/components/desktop/apps/CompetitiveResearch.tsx)

    • Chat interface with quick query buttons
    • Markdown rendering with syntax highlighting
    • Real-time tool status indicators
    • Specialized branding with Target/TrendingUp icons
  3. Desktop Registration (src/components/desktop/Desktop.tsx)

    • Added CompetitiveResearch to Agents folder
    • Accessible via double-click in desktop UI

Test Plan

  • Build successful (npm run build)
  • Open the Agents folder on the desktop
  • Double-click "Competitive Research" to launch the agent
  • Try quick queries like "Compare Sentry vs Datadog for error tracking"
  • Verify web search tool is invoked for current market data
  • Check Sentry dashboard for metrics (competitive_research.*)

🤖 Generated with Claude Code

Alex Blanchette and others added 5 commits February 11, 2026 11:45
Install 11 Sentry agent skills including setup, monitoring, and code review capabilities.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Install @sentry/nextjs and configure Sentry for client, server, and edge runtimes. Add instrumentation hooks and example environment variables.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Move deprecated options to webpack config structure to avoid Turbopack warnings.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…stom metrics

This commit introduces comprehensive observability throughout the SentryOS application
using Sentry's structured logging (Sentry.logger) and custom metrics (Sentry.metrics).

Key Features:
- Structured logging for tracking key application events and errors
- Custom metrics for monitoring performance and user behavior
- Console log capture (warn/error levels) in client-side code

Instrumentation Coverage:

1. Sentry Configuration
   - Enabled logging in all configs (client, server, edge)
   - Added console logging integration to client config
   - Configured to capture warn/error console logs

2. Chat API Route (/api/chat/route.ts)
   - Request/response logging with context
   - Metrics: request count, validation errors, conversation length
   - Performance tracking: API duration, stream duration, tool usage
   - Error tracking with detailed context
   - Tool invocation logging and counting

3. Window Manager (WindowManager.tsx)
   - Window lifecycle logging (open, close, minimize, maximize, focus)
   - Metrics: window operations, window size tracking
   - Provides insights into user window management behavior

4. Chat Component (Chat.tsx)
   - User message logging with conversation context
   - Message length tracking for both user and assistant
   - Response duration and error tracking
   - Tool execution tracking in UI
   - Client-side error handling with metrics

5. Desktop Component (Desktop.tsx)
   - Session start tracking
   - Desktop icon interaction logging
   - Active window count monitoring
   - User engagement metrics

Metrics Tracked:
- chat.api.request - Total API requests
- chat.api.duration - Request processing time
- chat.conversation.message_count - Messages per conversation
- chat.tool.invoked - Claude tools used
- chat.message.sent - User messages sent
- chat.response.duration - Response generation time
- desktop.window.* - Window management operations
- desktop.icon.opened - Desktop icon interactions
- desktop.windows.active - Active window count
- desktop.session.started - Desktop session tracking

All logging uses structured format with relevant context attributes,
making it easy to search, filter, and analyze in Sentry.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Created API route at /api/competitive-research with specialized system prompt
  for analyzing Sentry vs competitors (Datadog, New Relic, Rollbar, etc.)
- Built React component with quick query suggestions and streaming UI
- Registered agent in Agents folder on desktop
- Integrated full Sentry observability (structured logging, custom metrics)
- Agent supports feature comparisons, pricing analysis, and market research

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Installed recharts library for data visualization
- Added ChartRenderer component supporting line and bar charts
- Updated markdown renderer to detect chart-line and chart-bar code blocks
- Enhanced system prompt with chart generation instructions and examples
- Added chart-focused quick queries for easier discovery
- Charts use consistent dark theme matching the app design

Charts display:
- Line charts for trends over time (market share, growth, etc.)
- Bar charts for comparisons (pricing, features, metrics)
- Automatic parsing of JSON data in code blocks
- Responsive design with themed colors

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comment on lines +312 to +322
const errorMessage: Message = {
id: crypto.randomUUID(),
role: 'assistant',
content: 'Sorry, I encountered an error. Please check your Claude credentials are configured correctly.',
timestamp: new Date()
}
setMessages(prev => [...prev, errorMessage])
} finally {
setIsLoading(false)
setCurrentTool(null)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: If a stream fails, the empty placeholder message isn't removed, resulting in both an empty message and an error message appearing in the UI.
Severity: MEDIUM

Suggested Fix

Move the logic that removes the placeholder message to a finally block to ensure it always runs, or add logic to the catch block to remove the placeholder before adding the new error message.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/components/desktop/apps/CompetitiveResearch.tsx#L304-L322

Potential issue: When an exception occurs during the streaming of a response, such as
from a network error, the control flow jumps directly to the `catch` block. The cleanup
logic, which is responsible for removing the temporary empty placeholder message, is
located within the `try` block after the streaming loop. This cleanup code is skipped
when an exception is thrown, causing the empty placeholder message to remain in the chat
history. Subsequently, the `catch` block adds an error message, resulting in both an
empty message and an error message being displayed to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant