Vercel AI SDK Integration
Vercel AI SDK Integration
Section titled “Vercel AI SDK Integration”@agentic/triage provides portable tools designed for the Vercel AI SDK. These tools can be used with any AI provider supported by the SDK.
Installation
Section titled “Installation”# Install triage packagenpm install @jbcom/agentic
# Install an AI providernpm install @ai-sdk/anthropic# ornpm install @ai-sdk/openaiQuick Start
Section titled “Quick Start”import { getTriageTools } from '@jbcom/agentic';import { generateText } from 'ai';import { anthropic } from '@ai-sdk/anthropic';
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);Available Tool Sets
Section titled “Available Tool Sets”All Tools
Section titled “All Tools”import { getTriageTools } from '@jbcom/agentic';
// Get all available toolsconst allTools = getTriageTools();Issue Tools
Section titled “Issue Tools”import { getIssueTools } from '@jbcom/agentic';
const issueTools = getIssueTools();// Includes: listIssues, getIssue, createIssue, updateIssue,// closeIssue, searchIssues, addLabels, removeLabelsReview Tools
Section titled “Review Tools”import { getReviewTools } from '@jbcom/agentic';
const reviewTools = getReviewTools();// Includes: getPRComments, addPRComment, approvePR, requestChangesProject Tools
Section titled “Project Tools”import { getProjectTools } from '@jbcom/agentic';
const projectTools = getProjectTools();// Includes: getSprints, getCurrentSprint, getSprintIssues, moveToSprintIndividual Tools
Section titled “Individual Tools”import { listIssuesTool, createIssueTool, getIssueTool, updateIssueTool, closeIssueTool, searchIssuesTool, addLabelsTool, removeLabelsTool,} from '@jbcom/agentic';
// Use only what you needconst minimalTools = { listIssues: listIssuesTool, createIssue: createIssueTool,};Usage Patterns
Section titled “Usage Patterns”Basic Text Generation
Section titled “Basic Text Generation”import { getTriageTools } from '@jbcom/agentic';import { generateText } from 'ai';import { anthropic } from '@ai-sdk/anthropic';
async function triageIssues() { const result = await generateText({ model: anthropic('claude-sonnet-4-20250514'), tools: getTriageTools(), maxSteps: 10, prompt: 'Find all open bugs, prioritize them by severity, and create a summary', });
return result.text;}Streaming
Section titled “Streaming”import { getTriageTools } from '@jbcom/agentic';import { streamText } from 'ai';import { anthropic } from '@ai-sdk/anthropic';
async function streamTriage() { const result = await streamText({ model: anthropic('claude-sonnet-4-20250514'), tools: getTriageTools(), maxSteps: 10, prompt: 'Review all open PRs and provide feedback', });
for await (const chunk of result.textStream) { process.stdout.write(chunk); }}With Tool Results
Section titled “With Tool Results”import { getTriageTools } from '@jbcom/agentic';import { generateText } from 'ai';import { anthropic } from '@ai-sdk/anthropic';
async function triageWithResults() { const result = await generateText({ model: anthropic('claude-sonnet-4-20250514'), tools: getTriageTools(), maxSteps: 10, prompt: 'List all open issues and categorize them', });
// Access tool call results for (const step of result.steps) { for (const toolCall of step.toolCalls) { console.log(`Tool: ${toolCall.toolName}`); console.log(`Args: ${JSON.stringify(toolCall.args)}`); } for (const toolResult of step.toolResults) { console.log(`Result: ${JSON.stringify(toolResult.result)}`); } }
return result.text;}Combining with Custom Tools
Section titled “Combining with Custom Tools”import { getIssueTools } from '@jbcom/agentic';import { generateText, tool } from 'ai';import { anthropic } from '@ai-sdk/anthropic';import { z } from 'zod';
// Custom toolconst notifySlackTool = tool({ description: 'Send a notification to Slack', parameters: z.object({ channel: z.string(), message: z.string(), }), execute: async ({ channel, message }) => { // Slack integration logic return { sent: true }; },});
async function triageAndNotify() { const result = await generateText({ model: anthropic('claude-sonnet-4-20250514'), tools: { ...getIssueTools(), notifySlack: notifySlackTool, }, maxSteps: 10, prompt: 'Find critical bugs and notify #engineering on Slack', });
return result.text;}Provider Examples
Section titled “Provider Examples”Anthropic
Section titled “Anthropic”import { anthropic } from '@ai-sdk/anthropic';import { getTriageTools } from '@jbcom/agentic';import { generateText } from 'ai';
const result = await generateText({ model: anthropic('claude-sonnet-4-20250514'), tools: getTriageTools(), prompt: 'Triage open issues',});OpenAI
Section titled “OpenAI”import { openai } from '@ai-sdk/openai';import { getTriageTools } from '@jbcom/agentic';import { generateText } from 'ai';
const result = await generateText({ model: openai('gpt-4o'), tools: getTriageTools(), prompt: 'Triage open issues',});import { google } from '@ai-sdk/google';import { getTriageTools } from '@jbcom/agentic';import { generateText } from 'ai';
const result = await generateText({ model: google('gemini-2.0-flash'), tools: getTriageTools(), prompt: 'Triage open issues',});Advanced Patterns
Section titled “Advanced Patterns”Custom System Prompt
Section titled “Custom System Prompt”const result = await generateText({ model: anthropic('claude-sonnet-4-20250514'), tools: getTriageTools(), system: `You are a senior engineering manager responsible for issue triage.
When triaging issues: 1. Prioritize security issues as critical 2. Group related issues together 3. Estimate effort for each issue 4. Suggest assignees based on labels`, prompt: 'Triage all open issues for the next sprint',});Multi-Turn Conversations
Section titled “Multi-Turn Conversations”import { generateText } from 'ai';import { getTriageTools } from '@jbcom/agentic';
const messages = [ { role: 'user', content: 'List all open bugs' },];
// First turnlet result = await generateText({ model: anthropic('claude-sonnet-4-20250514'), tools: getTriageTools(), messages,});
messages.push({ role: 'assistant', content: result.text });messages.push({ role: 'user', content: 'Now prioritize them by severity' });
// Second turnresult = await generateText({ model: anthropic('claude-sonnet-4-20250514'), tools: getTriageTools(), messages,});Error Handling
Section titled “Error Handling”import { generateText } from 'ai';import { getTriageTools } from '@jbcom/agentic';
try { const result = await generateText({ model: anthropic('claude-sonnet-4-20250514'), tools: getTriageTools(), maxSteps: 10, prompt: 'Triage issues', });
return result.text;} catch (error) { if (error.name === 'ToolExecutionError') { console.error('Tool failed:', error.message); // Handle tool failure } else if (error.name === 'RateLimitError') { console.error('Rate limited, retrying...'); // Implement retry logic } else { throw error; }}Tool Reference
Section titled “Tool Reference”listIssues
Section titled “listIssues”Lists issues with optional filtering.
// Parameters{ status?: 'open' | 'closed' | 'all'; labels?: string[]; assignee?: string; limit?: number;}createIssue
Section titled “createIssue”Creates a new issue.
// Parameters{ title: string; body?: string; labels?: string[]; assignees?: string[]; milestone?: string;}searchIssues
Section titled “searchIssues”Searches issues by query.
// Parameters{ query: string; sort?: 'created' | 'updated' | 'comments'; order?: 'asc' | 'desc';}addLabels
Section titled “addLabels”Adds labels to an issue.
// Parameters{ issueId: number; labels: string[];}getPRComments
Section titled “getPRComments”Gets comments on a pull request.
// Parameters{ prNumber: number;}approvePR
Section titled “approvePR”Approves a pull request.
// Parameters{ prNumber: number; comment?: string;}Next Steps
Section titled “Next Steps”- MCP Server Integration - Use with Claude Desktop
- @agentic/triage Package - Full package reference
- TypeScript Examples - More examples