GuidesCases & Fixes

Cases & Fixes

⚠️

Migration Notice: This guide uses the legacy Cases API (/api/v1/cases). The Cases API has been renamed to the Issues & Fixes API (/api/v2/issues). See the Issues & Fixes API Reference for current endpoints. The concepts and workflows below still apply — only the endpoint paths have changed.

ThinkHive automatically clusters similar agent failures into Cases (now called Issues) and generates AI-powered Fix proposals that you can validate through shadow testing before deploying.

How Cases Work

Automatic Case Creation

When ThinkHive detects a cluster of similar failures, it automatically creates a case:

  1. Failure Detection — Traces are analyzed for errors, low-quality responses, or evaluation failures
  2. Clustering — Similar failures are grouped using semantic similarity
  3. Case Creation — A case is created with a description, severity, and representative traces
  4. Pattern Extraction — Common patterns across the clustered traces are identified

Cases are created automatically when the failure pattern reaches a configurable threshold (default: 3 similar failures).

Viewing Cases

In the Dashboard

Navigate to Cases in the sidebar to see all open cases. Each case shows:

  • Title — Auto-generated description of the failure pattern
  • Severitycritical, high, medium, or low
  • Trace Count — Number of affected traces
  • Statusopen, investigating, fix_proposed, resolved
  • First/Last Seen — Time range of affected traces

Via API

# List all cases
curl "https://app.thinkhive.ai/api/v1/cases" \
  -H "Authorization: Bearer thk_your_api_key"
 
# Get a specific case with its traces
curl "https://app.thinkhive.ai/api/v1/cases/case_abc123" \
  -H "Authorization: Bearer thk_your_api_key"

Response:

{
  "id": "case_abc123",
  "title": "Incomplete password reset instructions for MFA users",
  "severity": "high",
  "status": "open",
  "traceCount": 47,
  "pattern": "Agent omits 2FA reset step when user has MFA enabled",
  "firstSeen": "2025-01-10T08:00:00Z",
  "lastSeen": "2025-01-15T14:30:00Z",
  "representativeTraces": ["trace_1", "trace_2", "trace_3"],
  "suggestedFix": {
    "id": "fix_def456",
    "description": "Add conditional step for MFA users in password reset flow",
    "confidence": 0.87
  }
}

Case Lifecycle

StatusDescriptionActions Available
openNew case, not yet reviewedAssign, investigate, generate fix
investigatingUnder active reviewAdd notes, link traces, generate fix
fix_proposedAI-generated fix availableReview fix, run shadow test
testingShadow test in progressMonitor test results
resolvedFix deployed and verifiedClose, reopen if recurring
dismissedNot a real issueReopen if needed

Working with Fixes

AI-Generated Fixes

ThinkHive analyzes the clustered failure traces and proposes fixes:

# Generate a fix for a case
curl -X POST "https://app.thinkhive.ai/api/v1/cases/case_abc123/fixes" \
  -H "Authorization: Bearer thk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "strategy": "auto"
  }'

Fix strategies:

StrategyDescription
autoLet ThinkHive choose the best approach
prompt_updateSuggest prompt modifications
context_enrichmentRecommend additional context or retrieval
guardrailAdd validation or safety checks

Fix Response

{
  "id": "fix_def456",
  "caseId": "case_abc123",
  "strategy": "prompt_update",
  "description": "Add conditional step for MFA users in password reset flow",
  "changes": [
    {
      "type": "prompt_addition",
      "content": "If the user has MFA/2FA enabled, include steps to reset their authenticator app or backup codes.",
      "position": "after_step_3"
    }
  ],
  "confidence": 0.87,
  "evidence": [
    "47 traces show users with MFA enabled receiving incomplete instructions",
    "All affected traces lack mention of authenticator reset"
  ]
}

Validating Fixes with Shadow Testing

Before deploying a fix, validate it with shadow testing:

Create a shadow test

curl -X POST "https://app.thinkhive.ai/api/v1/shadow-tests" \
  -H "Authorization: Bearer thk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "fixId": "fix_def456",
    "caseId": "case_abc123",
    "traceIds": ["trace_1", "trace_2", "trace_3"],
    "evaluationSuiteId": "suite_xyz"
  }'

Monitor the test

curl "https://app.thinkhive.ai/api/v1/shadow-tests/st_789" \
  -H "Authorization: Bearer thk_your_api_key"

Review results

The shadow test compares the original agent behavior against the fixed version:

{
  "id": "st_789",
  "status": "completed",
  "results": {
    "baseline": { "averageScore": 2.1, "passRate": 0.15 },
    "withFix": { "averageScore": 4.3, "passRate": 0.89 },
    "improvement": "+74% pass rate"
  }
}

Deploy or iterate

If the shadow test passes, mark the case as resolved. If not, iterate on the fix.

SDK Integration

import { ThinkHive } from 'thinkhive-js';
 
const th = new ThinkHive({
  apiKey: process.env.THINKHIVE_API_KEY,
  endpoint: 'https://app.thinkhive.ai',
  serviceName: 'my-agent'
});
 
// List open cases
const cases = await th.cases.list({ status: 'open' });
 
// Get case details
const caseDetail = await th.cases.get('case_abc123');
 
// Generate a fix
const fix = await th.cases.generateFix('case_abc123', {
  strategy: 'auto'
});

Best Practices

  • Review cases regularly — check the Cases dashboard daily to catch emerging issues early
  • Set severity thresholds — configure auto-escalation for critical and high-severity cases
  • Use shadow testing — always validate fixes before deploying to production
  • Link to evaluation suites — connect cases to ThinkEval criteria for automated quality gates
  • Track resolution time — monitor mean time to resolution (MTTR) as a platform KPI

Next Steps