Use this file to discover all available pages before exploring further.
GTM Feedback uses specialized AI agents built with the Vercel AI SDK to handle different aspects of feedback processing. Each agent is a ToolLoopAgent with access to specific tools and instructions.
Performs semantic search on feature requests using vector embeddings.Model: Claude Haiku Tools:searchRequests, createEmbedding, searchSimilar, getRequestsByIds Returns: Array of matches with confidence scores (0.0-1.0)
Usage example:
import { agent } from "@feedback/ai/agents";const result = await agent.search.generate({ query: "Users want to export their data to CSV format",});// result.output.matches = [// {// requestId: "req_123",// title: "CSV Export Feature",// description: "Allow users to export data as CSV",// confidence: 0.92,// reason: "Exact match - both describe CSV export functionality"// },// ...// ]
Confidence scoring:
// packages/ai/src/agents/search/prompts.tsexport const SEARCH_INSTRUCTIONS = `Confidence scoring:- 0.9-1.0: Query describes the exact same feature/issue- 0.8-0.89: Strong match, same general feature with minor differences- 0.7-0.79: Moderate match, related but not identical- 0.5-0.69: Weak match but potentially relevant- Below 0.5: Not a match, don't includeReturn all matches with confidence >= 0.5, ordered by highest confidence first.`;
Creates new feature requests and matches feedback to existing requests.Model: Claude Haiku Tools:getCandidateRequests, getProductAreas, getRequestById Modes: match, create, match_or_create, find_related
Usage example:
import { agent } from "@feedback/ai/agents";// Create a new feature requestconst result = await agent.request.generate({ customerPain: "Users can't export their data", mode: "create",});// result.output = {// type: "create",// title: "Data Export Functionality",// description: "Users need the ability to export their data...",// areaIds: ["area_analytics", "area_data"],// }
Match or create example:
// Try to match, create if no match foundconst result = await agent.request.generate({ customerPain: "Need better CSV export options", mode: "match_or_create",});// result.output = {// type: "match_or_create",// decision: "matched", // or "created"// requestId: "req_123",// confidence: 0.85,// reason: "Matches existing CSV export request",// }
Generates structured insights reports for product areas.Model: Claude Sonnet (higher quality for analysis) Tools:analyzeDealbreakers, analyzeSegments, analyzeThemes, getExecutionStatus Returns: Structured report with up to 4 sections
// packages/ai/src/agents/area-insights.tsconst AREA_INSIGHTS_INSTRUCTIONS = `You are a product analytics strategist analyzing OPEN feature requests.Your job is to produce a concise AreaInsightsReport with up to 4 sections:1. "dealbreakers" - Critical issues blocking revenue2. "segments" - Which customer segments feel the most pain3. "themes" - Recurring patterns of confusion or friction4. "execution" - How well this area is executingGuidelines:- Be opinionated: highlight what matters most- Keep summaries to 1-2 sentences max, no fluff- Set importance to "critical" only for dealbreakers with >$500k ARR- If a section has no meaningful data, skip it entirely- Order sections by importance (critical first)`;
Create agent directory in packages/ai/src/agents/your-agent/
Define tools in tools.ts:
import { tool } from "ai";import { z } from "zod";export const yourTool = tool({ description: "What this tool does", inputSchema: z.object({ param: z.string(), }), execute: async ({ param }, { experimental_context }) => { // Tool logic here },});export const yourTools = { yourTool };
Write instructions in prompts.ts:
export const YOUR_AGENT_INSTRUCTIONS = `You are an AI agent that...Your job is to...Guidelines:- Be specific- Use tools to fetch data- Return structured output`;
Create agent in index.ts:
import { ToolLoopAgent, Output } from "ai";import { z } from "zod";import { claudeHaiku } from "../../models";import { yourTools } from "./tools";import { YOUR_AGENT_INSTRUCTIONS } from "./prompts";const outputSchema = z.object({ result: z.string(),});export function createYourAgent() { return new ToolLoopAgent({ model: claudeHaiku, tools: yourTools, instructions: YOUR_AGENT_INSTRUCTIONS, output: Output.object({ schema: outputSchema }), });}