
Product
Rust Support in Socket Is Now Generally Available
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.
@thinkhive/sdk
Advanced tools
ThinkHive SDK - AI Agent Observability Platform with explainability, RAG evaluation, and business impact analysis
The official JavaScript/TypeScript SDK for ThinkHive - AI Agent Observability Platform.
npm install @thinkhive/sdk
import { ThinkHive } from '@thinkhive/sdk';
// Initialize client
const client = new ThinkHive({
apiKey: 'your_api_key',
baseUrl: 'https://api.thinkhive.ai'
});
// Send a trace
const result = await client.trace({
userMessage: 'What is the weather in San Francisco?',
agentResponse: 'The weather in San Francisco is currently 65°F and sunny.',
agentId: 'weather-agent'
});
console.log(`Trace ID: ${result.traceId}`);
if (result.analysis) {
console.log(`Outcome: ${result.analysis.outcome.verdict}`);
console.log(`Impact Score: ${result.analysis.businessImpact.impactScore}`);
}
const result = await client.trace({
userMessage: 'I want to cancel my order #12345',
agentResponse: 'I understand you want to cancel order #12345...',
agentId: 'support-agent',
businessContext: {
customerId: 'cust_abc123',
transactionValue: 150.00,
priority: 'high',
industry: 'ecommerce'
}
});
// Access ROI metrics
if (result.analysis?.businessImpact?.roi) {
const roi = result.analysis.businessImpact.roi;
console.log(`Estimated Revenue Loss: $${roi.estimatedRevenueLoss}`);
console.log(`Churn Probability: ${roi.churnProbability}%`);
}
// Full trace analysis with RAG evaluation
const analysis = await client.explainer.analyze({
userMessage: 'What is your return policy?',
agentResponse: 'Items can be returned within 30 days...',
retrievedContexts: ['Return Policy: 30 day returns...'],
outcome: 'success'
}, {
tier: 'full_llm',
includeRagEvaluation: true,
includeHallucinationDetection: true
});
console.log(`Summary: ${analysis.summary}`);
console.log(`Groundedness: ${analysis.ragEvaluation?.groundedness}`);
// Batch analysis
const batchResult = await client.explainer.analyzeBatch([
{ userMessage: '...', agentResponse: '...' },
{ userMessage: '...', agentResponse: '...' }
], { tier: 'fast_llm' });
// Semantic search
const searchResults = await client.explainer.search({
query: 'refund complaints',
filters: { outcome: 'failure' },
limit: 10
});
// Get RAG scores
const ragScores = await client.quality.getRagScores('trace-123');
console.log(`Groundedness: ${ragScores.groundedness}`);
console.log(`Faithfulness: ${ragScores.faithfulness}`);
// Get hallucination report
const report = await client.quality.getHallucinationReport('trace-123');
if (report.hasHallucinations) {
for (const detection of report.detectedTypes) {
console.log(`- ${detection.type}: ${detection.description}`);
}
}
// Evaluate RAG for custom input
const evaluation = await client.quality.evaluateRag({
query: 'What is the return policy?',
response: 'Items can be returned within 30 days.',
contexts: [{ content: 'Return Policy: 30 day returns...' }]
});
// Get ROI summary
const summary = await client.analytics.getRoiSummary();
console.log(`Revenue Saved: $${summary.totalRevenueSaved}`);
// Get per-agent ROI
const agentRoi = await client.analytics.getRoiByAgent('support-agent');
console.log(`Success Rate: ${agentRoi.successRate}%`);
// Get correlation analysis
const correlations = await client.analytics.getCorrelations();
for (const corr of correlations.correlations) {
console.log(`${corr.type}: ${corr.actionableInsight}`);
}
// After receiving user feedback
await client.feedback({
traceId: result.traceId,
rating: 5,
wasHelpful: true,
comment: 'Very accurate response!'
});
// When response was incorrect
await client.feedback({
traceId: result.traceId,
rating: 2,
wasHelpful: false,
hadIssues: ['incorrect_info', 'too_long'],
correctedResponse: 'The correct answer is...'
});
import { init, autoInstrument } from '@thinkhive/sdk';
// Initialize SDK
init({
apiKey: 'your_api_key',
serviceName: 'my-ai-agent',
autoInstrument: true,
frameworks: ['langchain', 'openai']
});
// Or manually instrument
autoInstrument(client, {
frameworks: ['langchain', 'openai'],
capturePrompts: true,
captureResponses: true,
businessContext: { industry: 'saas' }
});
// Now all LangChain and OpenAI calls are automatically traced!
| Tier | Description | Models Used | Latency | Cost |
|---|---|---|---|---|
rule_based | Pattern matching, keyword extraction | None (deterministic) | ~50ms | Free |
fast_llm | Quick LLM analysis | GPT-5-mini, Gemini 3 Flash, Claude Haiku 4.5 | ~300ms | Low |
full_llm | Complete analysis | GPT-5, Gemini 2.5 Pro, Claude Sonnet 4.5 | ~2s | Standard |
deep | Multi-pass with validation | GPT-5.2, o3-pro, Claude Opus 4.5 | ~10s | Premium |
| Variable | Description |
|---|---|
THINKHIVE_API_KEY | Your ThinkHive API key |
THINKHIVE_ENDPOINT | Custom API endpoint (optional) |
THINKHIVE_SERVICE_NAME | Service name for traces (optional) |
See API Documentation for complete type definitions.
MIT License - see LICENSE for details.
FAQs
ThinkHive SDK v3.1 - AI agent observability supporting 25 trace formats including LangSmith, Langfuse, Opik, Braintrust, Datadog, MLflow, and more
The npm package @thinkhive/sdk receives a total of 27 weekly downloads. As such, @thinkhive/sdk popularity was classified as not popular.
We found that @thinkhive/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.

Research
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.