API Reference
Brain API
API endpoints for controlling the autonomous Brain.
POST
/api/brain/analyzeAnalyze the application and get suggestions without running tests
Response
{
"understanding": "E-commerce app with user auth, catalog, cart, checkout",
"techStack": {
"framework": "Next.js 14",
"database": "PostgreSQL",
"auth": "NextAuth.js"
},
"suggestedTests": [
"Test cart persistence across sessions",
"Test checkout validation with invalid cards",
"Test product search functionality"
],
"suggestedAgents": [
"Payment Flow Specialist",
"Inventory Checker"
],
"risks": [
"Cart race conditions",
"Payment double-charge"
]
}POST
/api/brain/runStart a full autonomous testing session
Response
{
"sessionId": "session_abc123",
"status": "started",
"message": "Autonomous testing session started"
}POST
/api/brain/generate-testGenerate a specific test
Request Body
{
"type": "security",
"target": "Login form SQL injection",
"context": "The login form at /login accepts email and password"
}Response
{
"testId": "test_xyz789",
"name": "test_login_sql_injection.spec.ts",
"type": "security",
"code": "import { test, expect } from '@playwright/test';..."
}POST
/api/brain/create-agentCreate a custom specialized agent
Request Body
{
"purpose": "Test the multi-step checkout process with various payment methods"
}Response
{
"agentId": "agent_def456",
"name": "Checkout Flow Tester",
"purpose": "Test the multi-step checkout process with various payment methods",
"status": "created"
}POST
/api/brain/run-test/:idExecute a specific test by ID
Response
{
"testId": "test_xyz789",
"status": "running",
"startedAt": "2024-01-15T10:30:00Z"
}Test Types
| Type | Description |
|---|---|
| unit | Isolated function/component tests |
| functional | User workflow tests |
| e2e | Complete user journey tests |
| security | SQL injection, XSS, auth bypass |
| regression | Bug fix verification |
| performance | Load times, resource usage |
