Introduction
The Debate API creates real-time AI-powered debates between a user’s AI agent and selected opponent personas. The system orchestrates multi-round debates, streaming responses in real-time using Server-Sent Events (SSE), and provides comprehensive synthesis reports with winner determination.Key Features
- Real-time Streaming: All debate responses stream via SSE for immediate user feedback
- Multi-round Debates: Configurable debate rounds (default: 5 rounds)
- Intelligent Agent System: User agents adopt personality traits, interests, and communication styles from user profiles
- Dynamic Opponent Selection: System selects appropriate opponent personas based on debate topics
- Comprehensive Synthesis: AI-generated analysis including consensus points, disagreements, winner determination, and recommendations
- Debate History: Persistent storage and retrieval of all debate sessions
Authentication
All Debate API endpoints require authentication via NextAuth session. Unauthenticated requests return401 Unauthorized.
Rate Limits
Debate Flow
- Initialization: User submits topic and profile information
- Opponent Selection: System selects appropriate opponent based on topic
- Opening Statement: User’s AI agent presents opening argument
- Debate Rounds: Alternating responses between user agent and opponent (5 rounds)
- Synthesis: AI evaluates the debate and generates comprehensive analysis
- Completion: Debate saved to database with complete transcript and synthesis
Available Endpoints
Start Debate
POST /api/debate - Start a new AI-powered debate session
Debate History
GET /api/debate/history - Retrieve user’s debate history
Next Steps
Start a Debate
Learn how to initiate and stream debate sessions
View History
Retrieve and analyze past debates