@thinkhive/sdk 4.2.0 → 4.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +161 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ThinkHive SDK v4.1.0
1
+ # ThinkHive SDK v4.2.0
2
2
 
3
3
  The official JavaScript/TypeScript SDK for [ThinkHive](https://thinkhive.ai) - AI Agent Observability Platform.
4
4
 
@@ -73,6 +73,19 @@ await shutdown();
73
73
  | `conversationEval` | Multi-turn conversation grading |
74
74
  | `transcriptPatterns` | Pattern detection in transcripts |
75
75
 
76
+ ### Operations & Monitoring APIs
77
+
78
+ | API | Description |
79
+ |-----|-------------|
80
+ | `evalRuns` | Create, manage, and query evaluation runs |
81
+ | `signals` | Behavioral signal configuration, stats, and trends |
82
+ | `notifications` | Alert rules and notification management |
83
+ | `documents` | Agent RAG document upload and management |
84
+ | `shadowTests` | Shadow test creation and execution |
85
+ | `sessions` | Trace session grouping and querying |
86
+ | `drift` | Model/behavior drift detection |
87
+ | `llmCosts` | LLM usage cost tracking and optimization |
88
+
76
89
  ### Legacy APIs (V2)
77
90
 
78
91
  | API | Description |
@@ -520,7 +533,153 @@ import { customerContext, captureCustomerContext } from '@thinkhive/sdk/integrat
520
533
  | `THINKHIVE_SERVICE_NAME` | Service name for traces (optional) |
521
534
  | `THINKHIVE_AGENT_ID` | Default agent ID (optional) |
522
535
 
523
- ## Upgrading from v4.0
536
+ ## Eval Runs
537
+
538
+ ```typescript
539
+ import { evalRuns } from '@thinkhive/sdk';
540
+
541
+ // Create an evaluation run
542
+ const run = await evalRuns.create('agent-123', { confidenceLevel: 'medium' });
543
+
544
+ // Get results
545
+ const results = await evalRuns.getResults(run.id, { limit: 50 });
546
+
547
+ // Estimate cost before running
548
+ const cost = await evalRuns.estimateCost('agent-123', { confidenceLevel: 'high' });
549
+
550
+ // List recent runs
551
+ const runs = await evalRuns.list({ agentId: 'agent-123', limit: 10 });
552
+ ```
553
+
554
+ ## Signals
555
+
556
+ ```typescript
557
+ import { signals } from '@thinkhive/sdk';
558
+
559
+ // List all signals
560
+ const allSignals = await signals.list();
561
+
562
+ // Create a custom behavioral signal
563
+ await signals.create('Escalation Request', 'negative', {
564
+ type: 'keywords',
565
+ keywords: ['speak to manager', 'escalate'],
566
+ });
567
+
568
+ // Get signal stats and trends
569
+ const stats = await signals.getStats({ agentId: 'agent-123' });
570
+ const trends = await signals.getTrends({ granularity: 'daily' });
571
+ ```
572
+
573
+ ## Notifications
574
+
575
+ ```typescript
576
+ import { notifications } from '@thinkhive/sdk';
577
+
578
+ // Create an alert rule
579
+ await notifications.createRule({
580
+ agentId: 'agent-123',
581
+ name: 'High failure rate alert',
582
+ eventType: 'failure_spike',
583
+ condition: { threshold: 0.3 },
584
+ channel: 'email',
585
+ target: 'team@company.com',
586
+ });
587
+
588
+ // List notifications
589
+ const alerts = await notifications.listNotifications('agent-123', true);
590
+ ```
591
+
592
+ ## Documents (RAG)
593
+
594
+ ```typescript
595
+ import { documents } from '@thinkhive/sdk';
596
+
597
+ // Upload a document
598
+ await documents.upload('agent-123', 'faq.txt', 'text/plain', 1024);
599
+
600
+ // List agent documents
601
+ const docs = await documents.list('agent-123');
602
+
603
+ // Delete a document
604
+ await documents.remove('agent-123', 'doc-456');
605
+ ```
606
+
607
+ ## Shadow Tests
608
+
609
+ ```typescript
610
+ import { shadowTests } from '@thinkhive/sdk';
611
+
612
+ // Create a shadow test
613
+ await shadowTests.create({
614
+ fixId: 'fix-456',
615
+ agentId: 'agent-123',
616
+ testName: 'Refund policy test',
617
+ inputData: { message: 'How do I get a refund?' },
618
+ expectedOutput: 'You can request a refund within 30 days.',
619
+ });
620
+
621
+ // List tests for an agent
622
+ const tests = await shadowTests.list('agent-123');
623
+ ```
624
+
625
+ ## Sessions
626
+
627
+ ```typescript
628
+ import { sessions } from '@thinkhive/sdk';
629
+
630
+ // List conversation sessions
631
+ const allSessions = await sessions.list('agent-123', { limit: 20 });
632
+
633
+ // Get all traces in a session
634
+ const traces = await sessions.getTraces('session-789', 'agent-123');
635
+ ```
636
+
637
+ ## Drift Detection
638
+
639
+ ```typescript
640
+ import { drift, hasDrift, getDriftSeverity } from '@thinkhive/sdk';
641
+
642
+ // Detect drift for an agent
643
+ const report = await drift.detect('agent-123');
644
+ if (hasDrift(report)) {
645
+ console.log(`Drift severity: ${getDriftSeverity(report)}`);
646
+ }
647
+
648
+ // Detect drift across all agents
649
+ const allDrift = await drift.detectAll();
650
+ ```
651
+
652
+ ## LLM Costs
653
+
654
+ ```typescript
655
+ import { llmCosts, formatCost } from '@thinkhive/sdk';
656
+
657
+ // Get cost summary
658
+ const summary = await llmCosts.getSummary({ period: '30d' });
659
+ console.log(`Total cost: ${formatCost(summary.totalCost)}`);
660
+
661
+ // Get per-agent breakdown
662
+ const breakdown = await llmCosts.getBreakdown('agent-123');
663
+
664
+ // Get optimization savings
665
+ const savings = await llmCosts.getSavings();
666
+ ```
667
+
668
+ ## Upgrading
669
+
670
+ ### v4.1.0 → v4.2.0
671
+
672
+ New in v4.2.0:
673
+ - **`evalRuns`** — create, list, and manage evaluation runs programmatically
674
+ - **`signals`** — behavioral signal CRUD with stats and trends
675
+ - **`notifications`** — alert rule configuration and notification management
676
+ - **`documents`** — agent RAG document upload/list/delete
677
+ - **`shadowTests`** — shadow test creation and management
678
+ - **`sessions`** — trace session grouping and querying
679
+ - **`drift`** — model/behavior drift detection with helpers
680
+ - **`llmCosts`** — LLM usage cost tracking and optimization savings
681
+
682
+ ### v4.0 → v4.1.0
524
683
 
525
684
  - `roiAnalytics` now includes V3 methods: `getConfig()`, `createConfig()`, `updateConfig()`, `configVersions()`, `calculateV3()`, `trendV3()`
526
685
  - `linking` now includes: `autoLink()`, `stats()`, `generateMarker()`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkhive/sdk",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "description": "ThinkHive SDK v4.0 - AI agent observability with business metrics, ROI analytics, and 25+ trace format support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",