Skip to content

AI Triage

This guide covers using AI-powered triage for code review, conversation analysis, and task extraction using multiple AI providers.

  • @jbcom/agentic installed
  • At least one AI provider SDK installed
  • API key for your chosen provider
Terminal window
# Anthropic (recommended)
pnpm add @ai-sdk/anthropic
# OpenAI
pnpm add @ai-sdk/openai
# Google AI
pnpm add @ai-sdk/google
# Mistral
pnpm add @ai-sdk/mistral

Quickly analyze text for issues:

Terminal window
agentic triage quick "Error: Cannot read property 'map' of undefined at UserList.tsx:45"

Review changes between branches:

Terminal window
# Review current changes
agentic triage review --base main --head HEAD
# Review a specific PR
agentic triage review --base main --head feature/user-auth

Analyze a completed agent’s conversation:

Terminal window
# Generate a report
agentic triage analyze bc-xxx-xxx -o report.md
# Create GitHub issues from findings
agentic triage analyze bc-xxx-xxx --create-issues
# Use a specific model
agentic triage analyze bc-xxx-xxx --model claude-opus-4-20250514
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);
}
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;
}
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;
}
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;
}

For more control, use the triage package directly with the Vercel AI SDK:

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);
}

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);
}
import {
getIssueTools, // Issue CRUD, search, labels
getReviewTools, // PR review, comments, approval
getProjectTools, // Sprints, project management
} from '@jbcom/agentic';
// Combine what you need
const myAgentTools = {
...getIssueTools(),
...getReviewTools(),
};
{
"triage": {
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"apiKeyEnvVar": "ANTHROPIC_API_KEY"
}
}
ProviderPackageModels
Anthropic@ai-sdk/anthropicclaude-sonnet-4-20250514, claude-opus-4-20250514
OpenAI@ai-sdk/openaigpt-4o, gpt-4-turbo
Google@ai-sdk/googlegemini-2.0-flash, gemini-pro
Mistral@ai-sdk/mistralmistral-large, mistral-medium
Azure@ai-sdk/azureDeployed model names
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
}
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;
};
}
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';
}
// Quick analysis: Use faster, cheaper models
const quickAnalyzer = new AIAnalyzer({
model: 'claude-3-haiku-20240307', // Fast and cheap
});
// Deep analysis: Use more capable models
const deepAnalyzer = new AIAnalyzer({
model: 'claude-opus-4-20250514', // Most capable
});
// Instead of multiple quick triages, batch them
const issues = ['issue1', 'issue2', 'issue3'];
const prompt = `Analyze these issues and prioritize:\n${issues.join('\n')}`;
const result = await analyzer.quickTriage(prompt);
import { AIAnalyzer } from '@jbcom/agentic';
const analyzer = new AIAnalyzer({
repo: 'my-org/my-repo',
cache: true, // Enable caching during development
cacheDir: '.agentic-cache',
});