npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lov3kaizen/agentsea-analytics

v1.2.1

Published

Conversation analytics for AI agents - intent classification, flow analysis, sentiment tracking, and insights

Readme

@lov3kaizen/agentsea-analytics

Conversation analytics for AI agents - Intent classification, flow analysis, sentiment tracking, and actionable insights.

npm version License: MIT

Features

  • Intent Classification - Classify user intents with custom taxonomies
  • Sentiment Analysis - Track sentiment across conversations
  • Topic Classification - Categorize conversations by topic
  • Flow Analysis - Analyze conversation flows, drop-offs, and funnels
  • Anomaly Detection - Detect unusual patterns in conversations
  • Trend Analysis - Track trends over time
  • KPI Tracking - Monitor key performance indicators
  • Custom Metrics - Define and track custom metrics with aggregations
  • Dashboards - Generate dashboard data with time series and charts
  • Report Generation - Export reports in multiple formats
  • Storage Backends - Memory, SQLite, and PostgreSQL adapters
  • AgentSea Integration - Middleware and provider for AgentSea agents

Installation

pnpm add @lov3kaizen/agentsea-analytics

Quick Start

import {
  Analytics,
  Collector,
  IntentClassifier,
  SentimentAnalyzer,
  MetricsEngine,
} from '@lov3kaizen/agentsea-analytics';

// Create analytics instance
const analytics = new Analytics({
  collector: new Collector(),
  classifiers: [new IntentClassifier(), new SentimentAnalyzer()],
  metrics: new MetricsEngine(),
});

// Track a conversation
analytics.track({
  conversationId: 'conv-123',
  message: { role: 'user', content: 'I need help with my order' },
  metadata: { userId: 'user-456' },
});

Collection

Track conversations, messages, and sessions:

import {
  Collector,
  ConversationTracker,
  MessageTracker,
  BatchCollector,
} from '@lov3kaizen/agentsea-analytics/collection';

// Real-time collection
const collector = new Collector({
  batchSize: 100,
  flushInterval: 5000,
});

// Track conversations
const conversationTracker = new ConversationTracker();
conversationTracker.on('conversation:complete', (metrics) => {
  console.log('Duration:', metrics.duration);
  console.log('Messages:', metrics.messageCount);
  console.log('Resolution:', metrics.resolved);
});

// Track individual messages
const messageTracker = new MessageTracker();

// Batch collection for high-throughput
const batchCollector = new BatchCollector({
  maxBatchSize: 500,
  flushInterval: 10000,
});

Classification

Classify intents, sentiment, and topics:

import {
  IntentClassifier,
  SentimentAnalyzer,
  TopicClassifier,
  TaxonomyManager,
} from '@lov3kaizen/agentsea-analytics/classification';

// Intent classification
const intentClassifier = new IntentClassifier({
  intents: ['order-inquiry', 'refund-request', 'product-question', 'complaint'],
});
const intent = await intentClassifier.classify('Where is my order?');
// { intent: 'order-inquiry', confidence: 0.95 }

// Sentiment analysis
const sentimentAnalyzer = new SentimentAnalyzer();
const sentiment = await sentimentAnalyzer.analyze('This product is amazing!');
// { sentiment: 'positive', score: 0.92 }

// Topic classification
const topicClassifier = new TopicClassifier({
  topics: ['billing', 'shipping', 'product', 'technical'],
});

// Custom taxonomies
const taxonomy = new TaxonomyManager();
taxonomy.define({
  name: 'support-categories',
  categories: ['billing', 'shipping', 'returns', 'technical'],
});

Flow Analysis

Analyze conversation flows and identify bottlenecks:

import {
  FlowAnalyzer,
  DropOffDetector,
  SuccessAnalyzer,
  FunnelAnalyzer,
} from '@lov3kaizen/agentsea-analytics/analysis';

// Analyze conversation flow patterns
const flowAnalyzer = new FlowAnalyzer();
const flows = await flowAnalyzer.analyze(conversations);

// Detect drop-off points
const dropOffDetector = new DropOffDetector();
const dropOffs = await dropOffDetector.detect(conversations);

// Analyze success rates
const successAnalyzer = new SuccessAnalyzer({
  successCriteria: (conv) => conv.resolved === true,
});

// Funnel analysis
const funnelAnalyzer = new FunnelAnalyzer();
const funnel = await funnelAnalyzer.analyze({
  stages: ['greeting', 'problem-identification', 'solution', 'resolution'],
  conversations,
});

Clustering & Pattern Detection

Discover patterns and anomalies:

import {
  TopicClusterer,
  PatternDetector,
  AnomalyDetector,
  TrendAnalyzer,
} from '@lov3kaizen/agentsea-analytics/clustering';

// Cluster conversations by topic
const clusterer = new TopicClusterer();
const clusters = await clusterer.cluster(conversations);

// Detect conversation patterns
const patternDetector = new PatternDetector();
const patterns = await patternDetector.detect(conversations);

// Anomaly detection
const anomalyDetector = new AnomalyDetector({
  sensitivity: 'medium',
});
anomalyDetector.on('anomaly', (anomaly) => {
  console.log('Anomaly detected:', anomaly.description);
});

// Trend analysis
const trendAnalyzer = new TrendAnalyzer({ window: '7d' });
const trends = await trendAnalyzer.analyze(metrics);

Metrics & KPIs

Track and monitor key metrics:

import {
  MetricsEngine,
  KPITracker,
  CustomMetrics,
  AggregationBuilder,
} from '@lov3kaizen/agentsea-analytics/metrics';

// Built-in metrics engine
const metrics = new MetricsEngine();
metrics.record('response_time', 1500);
metrics.record('satisfaction_score', 4.5);

// KPI tracking
const kpiTracker = new KPITracker({
  kpis: [
    { name: 'resolution_rate', target: 0.85 },
    { name: 'avg_response_time', target: 2000 },
    { name: 'customer_satisfaction', target: 4.0 },
  ],
});

// Custom metrics
const custom = new CustomMetrics();
custom.define('escalation_rate', {
  type: 'ratio',
  numerator: 'escalated_conversations',
  denominator: 'total_conversations',
});

// Aggregations
const agg = new AggregationBuilder()
  .groupBy('intent')
  .aggregate('count')
  .aggregate('avg', 'duration')
  .build();

Reporting & Dashboards

Generate reports and dashboard data:

import {
  DashboardData,
  ReportGenerator,
  Exporter,
} from '@lov3kaizen/agentsea-analytics/reporting';

// Dashboard data
const dashboard = new DashboardData({
  timeRange: { start: '2025-01-01', end: '2025-01-31' },
});
const snapshot = await dashboard.getSnapshot();

// Generate reports
const reporter = new ReportGenerator();
const report = await reporter.generate({
  sections: ['summary', 'intents', 'sentiment', 'flows', 'kpis'],
  timeRange: { start: '2025-01-01', end: '2025-01-31' },
});

// Export in multiple formats
const exporter = new Exporter();
await exporter.export(report, { format: 'pdf', path: './report.pdf' });
await exporter.export(report, { format: 'csv', path: './data.csv' });
await exporter.export(report, { format: 'json', path: './report.json' });

Storage Backends

import {
  MemoryStorageAdapter,
  SQLiteStorageAdapter,
  PostgresStorageAdapter,
} from '@lov3kaizen/agentsea-analytics/storage';

// In-memory (development)
const memoryStore = new MemoryStorageAdapter();

// SQLite (single-server)
const sqliteStore = new SQLiteStorageAdapter({
  path: './analytics.db',
});

// PostgreSQL (production)
const pgStore = new PostgresStorageAdapter({
  connectionString: process.env.DATABASE_URL,
});

AgentSea Integration

import {
  createAnalyticsMiddleware,
  createAnalyticsProvider,
} from '@lov3kaizen/agentsea-analytics/integrations';
import {
  Agent,
  AnthropicProvider,
  ToolRegistry,
} from '@lov3kaizen/agentsea-core';

// As middleware
const middleware = createAnalyticsMiddleware({
  storage: sqliteStore,
  classifiers: [new IntentClassifier(), new SentimentAnalyzer()],
});

// As a provider wrapper
const provider = createAnalyticsProvider({
  provider: new AnthropicProvider(process.env.ANTHROPIC_API_KEY),
  analytics: analyticsInstance,
});

Sub-Package Imports

import { Collector } from '@lov3kaizen/agentsea-analytics/collection';
import { IntentClassifier } from '@lov3kaizen/agentsea-analytics/classification';
import { FlowAnalyzer } from '@lov3kaizen/agentsea-analytics/analysis';
import { TopicClusterer } from '@lov3kaizen/agentsea-analytics/clustering';
import { MetricsEngine } from '@lov3kaizen/agentsea-analytics/metrics';
import { DashboardData } from '@lov3kaizen/agentsea-analytics/reporting';
import { SQLiteStorageAdapter } from '@lov3kaizen/agentsea-analytics/storage';
import { createAnalyticsMiddleware } from '@lov3kaizen/agentsea-analytics/integrations';

License

MIT License - see LICENSE for details