curl -X POST https://api.playgent.com/v1/test-cases/generate \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_abc123",
"source_type": "documents",
"documents": [
{
"content": "Our refund policy allows returns within 30 days...",
"name": "refund_policy.md"
}
],
"generation_config": {
"num_test_cases": 10,
"difficulty_distribution": { "easy": 0.3, "medium": 0.5, "hard": 0.2 },
"include_edge_cases": true,
"focus_areas": ["policy_violations", "ambiguous_requests"]
}
}'
{
"generated_test_cases": [
{
"name": "Edge Case: Refund after 30 days",
"turns": [
{
"input": { "text": "I bought this 45 days ago, can I return it?" },
"expected_behavior": "Agent should explain the 30-day policy limit"
}
],
"difficulty": "hard",
"rationale": "Tests boundary condition of refund policy"
}
],
"coverage_analysis": {
"policy_topics_covered": ["returns", "refunds", "exchanges"],
"gaps_identified": ["international shipping returns not covered"]
}
}
Test Cases
Generate Test Cases
Auto-generate test cases from documents or conversation logs
POST
/
v1
/
test-cases
/
generate
curl -X POST https://api.playgent.com/v1/test-cases/generate \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_abc123",
"source_type": "documents",
"documents": [
{
"content": "Our refund policy allows returns within 30 days...",
"name": "refund_policy.md"
}
],
"generation_config": {
"num_test_cases": 10,
"difficulty_distribution": { "easy": 0.3, "medium": 0.5, "hard": 0.2 },
"include_edge_cases": true,
"focus_areas": ["policy_violations", "ambiguous_requests"]
}
}'
{
"generated_test_cases": [
{
"name": "Edge Case: Refund after 30 days",
"turns": [
{
"input": { "text": "I bought this 45 days ago, can I return it?" },
"expected_behavior": "Agent should explain the 30-day policy limit"
}
],
"difficulty": "hard",
"rationale": "Tests boundary condition of refund policy"
}
],
"coverage_analysis": {
"policy_topics_covered": ["returns", "refunds", "exchanges"],
"gaps_identified": ["international shipping returns not covered"]
}
}
Automatically generate test cases from documents, conversation logs, or failure analysis. This endpoint uses AI to create comprehensive test suites including edge cases.
string
required
Agent to generate test cases for
string
required
Source type:
documents, conversation_logs, or failure_analysisarray
array
object
Configuration for test generation
Show properties
Show properties
integer
Number of test cases to generate (default: 10)
object
boolean
Include adversarial edge cases (default: true)
array
Specific areas to focus on (e.g.,
policy_violations,
ambiguous_requests)array
required
object
required
curl -X POST https://api.playgent.com/v1/test-cases/generate \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_abc123",
"source_type": "documents",
"documents": [
{
"content": "Our refund policy allows returns within 30 days...",
"name": "refund_policy.md"
}
],
"generation_config": {
"num_test_cases": 10,
"difficulty_distribution": { "easy": 0.3, "medium": 0.5, "hard": 0.2 },
"include_edge_cases": true,
"focus_areas": ["policy_violations", "ambiguous_requests"]
}
}'
{
"generated_test_cases": [
{
"name": "Edge Case: Refund after 30 days",
"turns": [
{
"input": { "text": "I bought this 45 days ago, can I return it?" },
"expected_behavior": "Agent should explain the 30-day policy limit"
}
],
"difficulty": "hard",
"rationale": "Tests boundary condition of refund policy"
}
],
"coverage_analysis": {
"policy_topics_covered": ["returns", "refunds", "exchanges"],
"gaps_identified": ["international shipping returns not covered"]
}
}
⌘I

