AI Triage
AI Triage Guide
Section titled “AI Triage Guide”This guide covers using AI-powered triage for code review, conversation analysis, and task extraction using multiple AI providers.
Prerequisites
Section titled “Prerequisites”@jbcom/agenticinstalled- At least one AI provider SDK installed
- API key for your chosen provider
Installing AI Providers
Section titled “Installing AI Providers”# Anthropic (recommended)pnpm add @ai-sdk/anthropic
# OpenAIpnpm add @ai-sdk/openai
# Google AIpnpm add @ai-sdk/google
# Mistralpnpm add @ai-sdk/mistralCLI Usage
Section titled “CLI Usage”Quick Triage
Section titled “Quick Triage”Quickly analyze text for issues:
agentic triage quick "Error: Cannot read property 'map' of undefined at UserList.tsx:45"Code Review
Section titled “Code Review”Review changes between branches:
# Review current changesagentic triage review --base main --head HEAD
# Review a specific PRagentic triage review --base main --head feature/user-authAnalyze Agent Conversation
Section titled “Analyze Agent Conversation”Analyze a completed agent’s conversation:
# Generate a reportagentic triage analyze bc-xxx-xxx -o report.md
# Create GitHub issues from findingsagentic triage analyze bc-xxx-xxx --create-issues
# Use a specific modelagentic triage analyze bc-xxx-xxx --model claude-opus-4-20250514Programmatic Usage
Section titled “Programmatic Usage”Basic Analysis
Section titled “Basic Analysis”import { AIAnalyzer } from '@jbcom/agentic';
async function analyzeError() { const analyzer = new AIAnalyzer({ repo: 'my-org/my-repo', // Uses config from agentic.config.json by default });
const result = await analyzer.quickTriage( 'Error: ENOENT: no such file or directory, open "config.json"' );
console.log('Analysis:', result.data?.summary); console.log('Suggested fixes:', result.data?.suggestions);}With Specific Provider
Section titled “With Specific Provider”import { AIAnalyzer } from '@jbcom/agentic';
async function analyzeWithOpenAI() { const analyzer = new AIAnalyzer({ repo: 'my-org/my-repo', provider: 'openai', model: 'gpt-4o', apiKey: process.env.OPENAI_API_KEY, });
const result = await analyzer.quickTriage('Memory leak in production'); return result;}Analyze Agent Conversation
Section titled “Analyze Agent Conversation”import { Fleet, AIAnalyzer } from '@jbcom/agentic';
async function analyzeAgentWork(agentId: string) { const fleet = new Fleet(); const analyzer = new AIAnalyzer({ repo: 'my-org/my-repo' });
// Get the conversation const convResult = await fleet.conversation(agentId);
if (!convResult.success || !convResult.data) { throw new Error('Could not fetch conversation'); }
// Analyze it const analysis = await analyzer.analyzeConversation(convResult.data);
if (analysis.success && analysis.data) { console.log('Summary:', analysis.data.summary); console.log('Completed Tasks:', analysis.data.completedTasks); console.log('Outstanding:', analysis.data.outstandingTasks); console.log('Blockers:', analysis.data.blockers); }
return analysis;}Code Review
Section titled “Code Review”import { AIAnalyzer } from '@jbcom/agentic';
async function reviewPR() { const analyzer = new AIAnalyzer({ repo: 'my-org/my-repo' });
const review = await analyzer.reviewCode({ base: 'main', head: 'feature/auth-refactor', });
if (review.success && review.data) { console.log('Overall:', review.data.overallAssessment); console.log('Issues:', review.data.issues); console.log('Suggestions:', review.data.suggestions); console.log('Security concerns:', review.data.securityConcerns); }
return review;}Using @agentic/triage Directly
Section titled “Using @agentic/triage Directly”For more control, use the triage package directly with the Vercel AI SDK:
All Triage Tools
Section titled “All Triage Tools”import { getTriageTools } from '@jbcom/agentic';import { generateText } from 'ai';import { anthropic } from '@ai-sdk/anthropic';
async function triageAgent() { const result = await generateText({ model: anthropic('claude-sonnet-4-20250514'), tools: getTriageTools(), maxSteps: 10, prompt: 'List all open critical bugs and create a triage plan', });
console.log(result.text);}Selective Tools
Section titled “Selective Tools”Import only what you need:
import { listIssuesTool, createIssueTool, searchIssuesTool} from '@jbcom/agentic';import { generateText } from 'ai';import { anthropic } from '@ai-sdk/anthropic';
async function minimalTriageAgent() { const result = await generateText({ model: anthropic('claude-sonnet-4-20250514'), tools: { listIssues: listIssuesTool, createIssue: createIssueTool, searchIssues: searchIssuesTool, }, maxSteps: 5, prompt: 'List open issues and create a summary report', });
console.log(result.text);}Tool Categories
Section titled “Tool Categories”import { getIssueTools, // Issue CRUD, search, labels getReviewTools, // PR review, comments, approval getProjectTools, // Sprints, project management} from '@jbcom/agentic';
// Combine what you needconst myAgentTools = { ...getIssueTools(), ...getReviewTools(),};Provider Configuration
Section titled “Provider Configuration”In Config File
Section titled “In Config File”{ "triage": { "provider": "anthropic", "model": "claude-sonnet-4-20250514", "apiKeyEnvVar": "ANTHROPIC_API_KEY" }}Supported Providers
Section titled “Supported Providers”| Provider | Package | Models |
|---|---|---|
| Anthropic | @ai-sdk/anthropic | claude-sonnet-4-20250514, claude-opus-4-20250514 |
| OpenAI | @ai-sdk/openai | gpt-4o, gpt-4-turbo |
@ai-sdk/google | gemini-2.0-flash, gemini-pro | |
| Mistral | @ai-sdk/mistral | mistral-large, mistral-medium |
| Azure | @ai-sdk/azure | Deployed model names |
Analysis Output Format
Section titled “Analysis Output Format”Quick Triage Response
Section titled “Quick Triage Response”interface QuickTriageResult { summary: string; // Brief description of the issue severity: 'low' | 'medium' | 'high' | 'critical'; category: string; // bug, security, performance, etc. suggestions: string[]; // Suggested fixes relatedDocs?: string[]; // Links to relevant documentation}Conversation Analysis Response
Section titled “Conversation Analysis Response”interface ConversationAnalysis { summary: string; // What the agent did completedTasks: string[]; // Tasks that were finished outstandingTasks: string[]; // Tasks still pending blockers: string[]; // Issues preventing progress recommendations: string[]; // Suggested next steps codeChanges: { files: string[]; additions: number; deletions: number; };}Code Review Response
Section titled “Code Review Response”interface CodeReviewResult { overallAssessment: 'approve' | 'request-changes' | 'needs-discussion'; issues: Array<{ file: string; line: number; severity: 'error' | 'warning' | 'info'; message: string; }>; suggestions: string[]; securityConcerns: string[]; testCoverage: 'adequate' | 'needs-improvement' | 'missing';}Best Practices
Section titled “Best Practices”1. Use Appropriate Models
Section titled “1. Use Appropriate Models”// Quick analysis: Use faster, cheaper modelsconst quickAnalyzer = new AIAnalyzer({ model: 'claude-3-haiku-20240307', // Fast and cheap});
// Deep analysis: Use more capable modelsconst deepAnalyzer = new AIAnalyzer({ model: 'claude-opus-4-20250514', // Most capable});2. Batch Related Operations
Section titled “2. Batch Related Operations”// Instead of multiple quick triages, batch themconst issues = ['issue1', 'issue2', 'issue3'];const prompt = `Analyze these issues and prioritize:\n${issues.join('\n')}`;const result = await analyzer.quickTriage(prompt);3. Cache Results for Development
Section titled “3. Cache Results for Development”import { AIAnalyzer } from '@jbcom/agentic';
const analyzer = new AIAnalyzer({ repo: 'my-org/my-repo', cache: true, // Enable caching during development cacheDir: '.agentic-cache',});Next Steps
Section titled “Next Steps”- Sandbox Execution - Run AI in isolated environments
- Triage Tools API - Complete tool reference
- Vercel AI SDK Integration - Deep integration guide