Skip to content

Triage Tools API

The triage tools package provides AI-compatible tool definitions for issue management, code review, PR analysis, visual testing, and intelligent routing. All tools are built with the Vercel AI SDK tool() function and use Zod schemas for input validation.

Terminal window
npm install @jbcom/agentic-triage
import {
// Tool collections
getTriageTools,
triageTools,
// Issue tools
listIssuesTool,
getIssueTool,
createIssueTool,
updateIssueTool,
closeIssueTool,
searchIssuesTool,
addLabelsTool,
removeLabelsTool,
triageIssueTool,
// Review tools
submitReviewTool,
// PR tools
analyzePRTool,
// Sage (AI advisor)
sageTool,
// Visual review
visualReviewTool,
} from '@jbcom/agentic-triage';

Returns the complete set of all available triage tools as a single object.

import { getTriageTools } from '@jbcom/agentic-triage';
const tools = getTriageTools();
// Returns object with all 13 tools

The same collection exported as a named constant:

import { triageTools } from '@jbcom/agentic-triage';
// triageTools.listIssues
// triageTools.getIssue
// triageTools.createIssue
// triageTools.updateIssue
// triageTools.closeIssue
// triageTools.searchIssues
// triageTools.addLabels
// triageTools.removeLabels
// triageTools.triageIssue
// triageTools.submitReview
// triageTools.analyzePR
// triageTools.sage
// triageTools.visualReview

All tools work directly with generateText and streamText:

import { generateText } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { getTriageTools } from '@jbcom/agentic-triage';
const result = await generateText({
model: anthropic('claude-sonnet-4-20250514'),
tools: getTriageTools(),
prompt: 'List all open bugs and triage the most critical one.',
maxSteps: 10,
});
console.log(result.text);

For streaming:

import { streamText } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { triageTools } from '@jbcom/agentic-triage';
const result = streamText({
model: anthropic('claude-sonnet-4-20250514'),
tools: triageTools,
prompt: 'Review PR #42 and provide feedback.',
maxSteps: 5,
});
for await (const chunk of result.textStream) {
process.stdout.write(chunk);
}

List issues from the configured issue tracker with optional filters.

Input Schema:

ParameterTypeRequiredDescription
status'open' | 'in_progress' | 'blocked' | 'closed'NoFilter by issue status
priority'critical' | 'high' | 'medium' | 'low' | 'backlog'NoFilter by priority
type'bug' | 'feature' | 'task' | 'epic' | 'chore' | 'docs'NoFilter by issue type
labelsstring[]NoFilter by labels
limitnumberNoMaximum number of results
assigneestringNoFilter by assignee username

Returns: Array of issue objects.

import { generateText } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { listIssuesTool } from '@jbcom/agentic-triage';
const result = await generateText({
model: anthropic('claude-sonnet-4-20250514'),
tools: { listIssues: listIssuesTool },
prompt: 'Show me all open bugs with critical priority',
});

Get detailed information about a specific issue by ID.

Input Schema:

ParameterTypeRequiredDescription
idstringYesThe issue ID

Returns: Complete issue object with title, description, labels, assignees, and metadata.


Create a new issue in the configured issue tracker.

Input Schema:

ParameterTypeRequiredDefaultDescription
titlestringYesIssue title
descriptionstringNoIssue body/description
type'bug' | 'feature' | 'task' | 'epic' | 'chore' | 'docs'No'task'Issue type
priority'critical' | 'high' | 'medium' | 'low' | 'backlog'No'medium'Priority level
labelsstring[]NoLabels to apply
assigneestringNoUsername to assign

Returns: The created issue object.

import { createIssueTool } from '@jbcom/agentic-triage';
// Used by AI:
// "Create a bug report for the login page timeout issue"
// -> Calls createIssueTool with { title: "Login page timeout", type: "bug", priority: "high" }

Update fields on an existing issue.

Input Schema:

ParameterTypeRequiredDescription
idstringYesThe issue ID to update
updates.titlestringNoNew title
updates.descriptionstringNoNew description
updates.status'open' | 'in_progress' | 'blocked' | 'closed'NoNew status
updates.priority'critical' | 'high' | 'medium' | 'low' | 'backlog'NoNew priority
updates.type'bug' | 'feature' | 'task' | 'epic' | 'chore' | 'docs'NoNew type
updates.assigneestringNoNew assignee

Returns: The updated issue object.


Apply structured triage analysis to an issue. This tool applies a comprehensive analysis including title optimization, priority assessment, type categorization, label recommendations, and action items.

Input Schema:

ParameterTypeRequiredDescription
idstringYesThe issue ID to triage
analysis.titlestringYesCleaned up / optimized title
analysis.summarystringYesConcise summary of the issue
analysis.typeIssueTypeYesCategorized issue type
analysis.priorityIssuePriorityYesDetermined priority based on impact and urgency
analysis.labelsstring[]YesRecommended labels
analysis.estimatenumberNoOptional story point estimate
analysis.actionItemsstring[]YesConcrete next steps discovered from the description

The IssueTriageSchema validates the analysis object:

import { z } from 'zod';
const IssueTriageSchema = z.object({
title: z.string(),
summary: z.string(),
type: z.enum(['bug', 'feature', 'task', 'epic', 'chore', 'docs']),
priority: z.enum(['critical', 'high', 'medium', 'low', 'backlog']),
labels: z.array(z.string()),
estimate: z.number().optional(),
actionItems: z.array(z.string()),
});

Close an issue with an optional reason.

Input Schema:

ParameterTypeRequiredDescription
idstringYesThe issue ID to close
reasonstringNoClosing comment/reason

Full-text search across all issues.

Input Schema:

ParameterTypeRequiredDescription
querystringYesSearch query string

Returns: Array of matching issue objects.


Add labels to an issue.

Input Schema:

ParameterTypeRequiredDescription
idstringYesThe issue ID
labelsstring[]YesLabels to add

Returns: { id, labelsAdded } confirmation object.


Remove labels from an issue.

Input Schema:

ParameterTypeRequiredDescription
idstringYesThe issue ID
labelsstring[]YesLabels to remove

Returns: { id, labelsRemoved } confirmation object.


Submit a structured code review for a pull request. The review includes per-file comments, an overall summary, a review decision, and suggested labels.

Input Schema:

ParameterTypeRequiredDescription
prNumbernumberYesThe pull request number
review.summarystringYesOverall review summary
review.status'approve' | 'request_changes' | 'comment'YesReview decision
review.commentsCodeReviewComment[]YesIndividual file comments
review.impact'low' | 'medium' | 'high' | 'critical'YesEstimated impact of changes
review.suggestedLabelsstring[]YesLabels suggested based on code changes

CodeReviewComment:

interface CodeReviewComment {
file: string; // File path
line?: number; // Line number (optional)
content: string; // Review comment text
type: 'suggestion' | 'issue' | 'question' | 'praise';
severity?: 'low' | 'medium' | 'high';
}
import { generateText } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { submitReviewTool } from '@jbcom/agentic-triage';
const result = await generateText({
model: anthropic('claude-sonnet-4-20250514'),
tools: { submitReview: submitReviewTool },
prompt: `Review PR #42. The diff adds a new authentication middleware.
Check for security issues, error handling, and test coverage.`,
maxSteps: 5,
});

Submit a structured analysis of a pull request covering scope, risk, testing, and breaking changes.

Input Schema:

ParameterTypeRequiredDescription
prNumbernumberYesThe pull request number
analysis.titlestringYesSuggested optimized PR title
analysis.summarystringYesExecutive summary of changes
analysis.scope'minor' | 'major' | 'patch' | 'breaking'YesImpact scope
analysis.riskLevel'low' | 'medium' | 'high'YesRisk level of merging
analysis.testingCoverage'none' | 'partial' | 'full'YesTesting assessment
analysis.breakingChangesstring[]YesList of breaking changes
analysis.relatedIssuesstring[]YesRelated issue IDs or URLs

The PRAnalysisSchema validates the analysis:

const PRAnalysisSchema = z.object({
title: z.string(),
summary: z.string(),
scope: z.enum(['minor', 'major', 'patch', 'breaking']),
riskLevel: z.enum(['low', 'medium', 'high']),
testingCoverage: z.enum(['none', 'partial', 'full']),
breakingChanges: z.array(z.string()),
relatedIssues: z.array(z.string()),
});

Ask Sage for technical advice, task decomposition, or agent routing based on repository context. Sage uses the configured AI model to provide intelligent recommendations.

Input Schema:

ParameterTypeRequiredDescription
querystringYesThe question or request for Sage
contextobjectNoAdditional repository context
context.repoStructurestringNoRepository file structure
context.keyFilesRecord<string, string>NoContents of key files (filename to content mapping)
context.issueContextstringNoContext from a GitHub issue or PR
context.currentContextstringNoCurrent working context

Sage automatically resolves the AI model using the triage configuration. It uses the createTool helper (which integrates with the escalation system) rather than the standard tool() function.

import { generateText } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { sageTool } from '@jbcom/agentic-triage';
const result = await generateText({
model: anthropic('claude-sonnet-4-20250514'),
tools: { sage: sageTool },
prompt: 'Should I refactor the auth module into separate files, or keep it monolithic?',
maxSteps: 3,
});

Perform a visual review of a web page using Playwright for screenshot capture and AI for image analysis.

Input Schema:

ParameterTypeRequiredDefaultDescription
urlstringYesURL of the page to review
scenariostringNoDescription of the test scenario
viewport.widthnumberNo1280Viewport width in pixels
viewport.heightnumberNo720Viewport height in pixels

Returns:

{
url: string;
status: 'success' | 'error';
screenshotTaken?: boolean;
analysis?: string;
message?: string; // Error message if status is 'error'
}

This tool launches a Chromium browser via Playwright, navigates to the URL, waits for networkidle, and captures a full-page screenshot. The Anthropic model is used for image analysis.

Requirements: @playwright/test must be installed and browsers must be available (npx playwright install chromium).

import { visualReviewTool } from '@jbcom/agentic-triage';
// Example usage in AI pipeline:
// "Take a screenshot of our staging site and check for visual regressions"

The triage tools use TriageConnectors internally, which supports multiple issue tracking providers:

import { TriageConnectors } from '@jbcom/agentic-triage';
// GitHub (default -- auto-detected from .git)
const github = new TriageConnectors();
// Jira
const jira = new TriageConnectors({
provider: 'jira',
jira: {
host: 'company.atlassian.net',
projectKey: 'PROJ',
},
});
// Linear
const linear = new TriageConnectors({
provider: 'linear',
linear: { teamId: 'TEAM123' },
});
// Beads (local-first)
const beads = new TriageConnectors({
provider: 'beads',
beads: { workingDir: '/path/to/project' },
});

interface Issue {
id: string;
title: string;
description?: string;
status: 'open' | 'in_progress' | 'blocked' | 'closed';
priority: 'critical' | 'high' | 'medium' | 'low' | 'backlog';
type: 'bug' | 'feature' | 'task' | 'epic' | 'chore' | 'docs';
labels: string[];
assignee?: string;
createdAt: string;
updatedAt: string;
}
interface IssueTriage {
title: string;
summary: string;
type: 'bug' | 'feature' | 'task' | 'epic' | 'chore' | 'docs';
priority: 'critical' | 'high' | 'medium' | 'low' | 'backlog';
labels: string[];
estimate?: number;
actionItems: string[];
}
interface CodeReview {
summary: string;
status: 'approve' | 'request_changes' | 'comment';
comments: CodeReviewComment[];
impact: 'low' | 'medium' | 'high' | 'critical';
suggestedLabels: string[];
}
interface PRAnalysis {
title: string;
summary: string;
scope: 'minor' | 'major' | 'patch' | 'breaking';
riskLevel: 'low' | 'medium' | 'high';
testingCoverage: 'none' | 'partial' | 'full';
breakingChanges: string[];
relatedIssues: string[];
}