curl "https://api.playgent.com/v1/analytics/failure-analysis?agent_id=agent_abc123&period=30d" \
-H "Authorization: Bearer your-api-key"
{
"period": "30d",
"total_failures": 156,
"failure_categories": [
{
"category": "Hallucination",
"count": 45,
"percentage": 28.8,
"example_run_ids": ["run_1", "run_2"],
"common_patterns": [
"Made up order numbers not in context",
"Stated incorrect refund policy details"
],
"suggested_fix": "Add explicit instruction: 'Only reference order numbers provided in the context'"
},
{
"category": "Off-topic Response",
"count": 32,
"percentage": 20.5,
"example_run_ids": ["run_3", "run_4"],
"common_patterns": [
"Discussed unrelated products",
"Provided information not asked for"
],
"suggested_fix": "Add guardrail: 'Stay focused on the customer's specific question'"
},
{
"category": "Incomplete Response",
"count": 28,
"percentage": 17.9,
"example_run_ids": ["run_5", "run_6"],
"common_patterns": [
"Did not address all parts of multi-part questions",
"Missing follow-up information"
],
"suggested_fix": "Add instruction: 'Ensure all parts of the user's question are addressed'"
}
]
}
Analytics
Get Failure Analysis
Get intelligent failure analysis with patterns and suggestions
GET
/
v1
/
analytics
/
failure-analysis
curl "https://api.playgent.com/v1/analytics/failure-analysis?agent_id=agent_abc123&period=30d" \
-H "Authorization: Bearer your-api-key"
{
"period": "30d",
"total_failures": 156,
"failure_categories": [
{
"category": "Hallucination",
"count": 45,
"percentage": 28.8,
"example_run_ids": ["run_1", "run_2"],
"common_patterns": [
"Made up order numbers not in context",
"Stated incorrect refund policy details"
],
"suggested_fix": "Add explicit instruction: 'Only reference order numbers provided in the context'"
},
{
"category": "Off-topic Response",
"count": 32,
"percentage": 20.5,
"example_run_ids": ["run_3", "run_4"],
"common_patterns": [
"Discussed unrelated products",
"Provided information not asked for"
],
"suggested_fix": "Add guardrail: 'Stay focused on the customer's specific question'"
},
{
"category": "Incomplete Response",
"count": 28,
"percentage": 17.9,
"example_run_ids": ["run_5", "run_6"],
"common_patterns": [
"Did not address all parts of multi-part questions",
"Missing follow-up information"
],
"suggested_fix": "Add instruction: 'Ensure all parts of the user's question are addressed'"
}
]
}
Get intelligent analysis of test failures including categorization, common patterns, and actionable suggestions for improvement.
string
Filter by agent ID (optional)
string
Time period to analyze (default: “30d”)
string
required
Analysis period
integer
required
Total number of failures
array
required
curl "https://api.playgent.com/v1/analytics/failure-analysis?agent_id=agent_abc123&period=30d" \
-H "Authorization: Bearer your-api-key"
{
"period": "30d",
"total_failures": 156,
"failure_categories": [
{
"category": "Hallucination",
"count": 45,
"percentage": 28.8,
"example_run_ids": ["run_1", "run_2"],
"common_patterns": [
"Made up order numbers not in context",
"Stated incorrect refund policy details"
],
"suggested_fix": "Add explicit instruction: 'Only reference order numbers provided in the context'"
},
{
"category": "Off-topic Response",
"count": 32,
"percentage": 20.5,
"example_run_ids": ["run_3", "run_4"],
"common_patterns": [
"Discussed unrelated products",
"Provided information not asked for"
],
"suggested_fix": "Add guardrail: 'Stay focused on the customer's specific question'"
},
{
"category": "Incomplete Response",
"count": 28,
"percentage": 17.9,
"example_run_ids": ["run_5", "run_6"],
"common_patterns": [
"Did not address all parts of multi-part questions",
"Missing follow-up information"
],
"suggested_fix": "Add instruction: 'Ensure all parts of the user's question are addressed'"
}
]
}
⌘I

