The Academy is a Socratic dialogue engine for AI agents built with Next.js and Model Context Protocol (MCP). It enables agents to engage in structured, recursive dialogue with shared context, while exposing all conversation data and AI capabilities through the standardized MCP interface with real-time analysis and research tools.
The Academy features a stateless architecture with PostgreSQL for persistent data storage and an event-driven pub/sub system for real-time UI updates.
The Academy currently supports models from 7 major LLM providers, as well as Ollama integration for bringing your own models.
"If you can do it in the UI, you can do it programmatically"
The Academy embraces a comprehensive MCP-first approach where every feature available through the web interface is also exposed as an MCP tool. This design paradigm ensures researchers can fully automate their workflows, run bulk experiments, and integrate The Academy into larger research pipelines without manual intervention.
- Multi-agent autonomous conversations between Claude, GPT, and other AI models
- Real-time moderator intervention with pause/resume and injection capabilities
- Persistent shared context across conversation turns
- Abort signal support for graceful conversation interruption and resumption
- Template-based session creation with curated conversation starters
- Comprehensive error tracking with retry attempt logging and analysis
- Experiment Designer: Visual interface for creating multi-session experiment configurations
- Batch Execution: Run hundreds of sessions concurrently with configurable parallelism
- Template Variables: Dynamic session naming with date and counter placeholders
- Progress Monitoring: Real-time tracking of experiment execution with detailed metrics
- Result Aggregation: Automatic collection and analysis of experiment outcomes
- MCP Integration: Full programmatic control over experiment lifecycle
- Failure Recovery: Graceful handling of individual session failures without stopping experiments
- Full MCP server implementation exposing Academy data and capabilities
- 66 MCP Tools: Comprehensive tool suite covering all Academy functionality
- AI Provider Tools: Direct access to 7 major Lab APIs as well as Ollama for local models as MCP tools
- Conversation Resources: Session data, messages, and analysis available via MCP URIs
- Session Control Tools: Start, pause, resume, and manage conversations programmatically
- Real-time Analysis Tools: Conversation insights and metrics through MCP protocol
- Experiment Management Tools: Create, execute, and monitor bulk experiments via MCP
- Standards Compliant: JSON-RPC 2.0 protocol with proper error handling and abort support
- WebSocket Integration: Real-time updates and event broadcasting
- MCP Debug Tools: Store debugging, resource inspection, and comprehensive error tracking
- PostgreSQL Backend: All conversation and experiment data persisted in a relational database
- Event-Driven Updates: Internal pub/sub system (EventBus) ensures real-time UI synchronization across components
- Database-First Design: Structured data model with proper relationships and constraints
- Containerized Deployment: Includes Docker configuration for easy deployment
- Real-time Synchronization: Changes propagate immediately through the event system
- Multi-agent autonomous conversations between Claude, GPT, and other AI models
- Real-time moderator intervention with pause/resume and injection capabilities
- Persistent shared context across conversation turns
- Abort signal support for graceful conversation interruption and resumption
- Template-based session creation with curated conversation starters
- Comprehensive error tracking with retry attempt logging and analysis
- Exponential Backoff Retry Logic: Automatic recovery from network failures with 3 retry attempts
- Smart Error Classification: Distinguishes between retryable network errors and non-retryable client errors
- Conversation Continuity: Network hiccups don't interrupt long-form dialogues or cause participant dropouts
- Comprehensive Error Tracking: All API failures logged with attempt counts, timestamps, and retry details
- Tested Resilience: Handles 200+ message conversations under various network conditions
- Graceful Degradation: Rate limits and authentication errors fail fast without wasting API quota
- Export Integration: Error logs included in conversation exports for research analysis
- Live AI Analysis: Real-time conversation analysis during active dialogues
- Analysis Snapshots: Save analysis states at specific points via MCP protocol
- Analysis Timeline: View chronological progression of conversation insights
- Multi-Provider Analysis: Choose between Claude and GPT for analysis perspectives
- Conversation Metrics: Track message counts, participant engagement, and timing
- Export Integration: Include analysis data in conversation exports
- Research Data Formats: JSON and CSV export options with metadata
- Session Persistence: PostgreSQL-backed storage with automatic state management
- Session Switching: Seamless navigation between multiple conversations
- Real-time Status Tracking: Monitor conversation state and participant activity
- Session Templates: Pre-configured scenarios for common research use cases
- Metadata Management: Tag, star, and organize sessions for research workflows
- AI Agent Configuration: Custom settings for temperature, tokens, models, and personalities
- Real-time Status Monitoring: Track thinking, active, idle, and error states
- Custom Characteristics: Define personality traits and areas of expertise
- Dynamic Participant Addition: Add agents during active conversations
- Multi-Model Support: Chat models from all major LLM providers
- Participant Analytics: Message counts and engagement tracking
- Export Formats:
- JSON format with complete conversation data and metadata
- CSV format for timeline-based analysis
- Optional inclusion of analysis snapshots
- Optional inclusion of API error logs with retry details
- Configurable metadata inclusion
- Export Preview: View full export content before download
- Analysis Export: Export analysis timeline separately
- Batch Export: Export multiple sessions via MCP tools
- Research-Ready Data: Structured formats suitable for external analysis tools
The Academy automatically exposes its MCP server at /api/mcp. You can integrate with MCP-compatible tools by connecting to this endpoint.
academy://sessions- All conversation sessions with metadataacademy://session/{id}- Individual session data with participants and messagesacademy://session/{id}/messages- Complete message history with timestampsacademy://session/{id}/participants- Participant configurations and statusacademy://session/{id}/analysis- Real-time analysis snapshots via MCPacademy://current- Currently active sessionacademy://stats- Platform usage statistics and analyticsacademy://analysis/stats- Global analysis statistics across all sessionsacademy://analysis/timeline- Complete analysis timeline for researchacademy://experiments- All experiment configurations and runsacademy://experiment/{id}- Individual experiment data with run historyacademy://experiment/{id}/results- Aggregated experiment results and analytics
The Academy provides a comprehensive suite of 66 MCP tools:
create_session- Create new conversation sessionsget_session- Get a specific session by IDget_sessions- Get all sessions with optional status filterget_current_session_id- Get the ID of the currently active sessiondelete_session- Remove sessionsupdate_session- Modify session metadataswitch_current_session- Change active sessionduplicate_session- Clone existing sessionsimport_session- Import session datalist_templates- List available session templatescreate_session_from_template- Create from predefined templates
send_message- Send messages to sessions- Note: Message update/delete tools are available under Message Control
add_participant- Add AI agents to conversationsremove_participant- Remove participants from sessionsupdate_participant- Modify participant settingsupdate_participant_status- Change participant statelist_available_models- List available AI modelsget_participant_config- Get participant configuration
start_conversation- Begin autonomous dialogue with optional max message countpause_conversation- Pause active conversationresume_conversation- Resume paused conversationstop_conversation- End conversationget_conversation_status- Check conversation stateget_conversation_stats- Retrieve conversation metrics
update_message- Update existing message contentdelete_message- Delete a specific messageclear_messages- Clear all messages in a sessioninject_moderator_prompt- Insert moderator messages
analyze_conversation- Extract insights and patterns from conversationstrigger_live_analysis- Run real-time analysis during active conversationssave_analysis_snapshot- Store analysis data at specific pointsget_analysis_history- Retrieve past analyses for a sessionclear_analysis_history- Remove analysis data for a sessionset_analysis_provider- Choose between Claude or GPT for analysisget_analysis_providers- List available analysis providersauto_analyze_conversation- Enable/disable automatic analysis
export_session- Export conversation dataexport_analysis_timeline- Export analysis historyget_export_preview- Preview export content
claude_chat- Claude API access with exponential backoff retryopenai_chat- OpenAI API access with exponential backoff retrygrok_chat- Grok API access with exponential backoff retrygemini_chat- Gemini API access with exponential backoff retrydeepseek_chat- Deepseek API access with exponential backoff retrymistral_chat- Mistral API access with exponential backoff retrycohere_chat- Cohere API access with exponential backoff retryollama_chat- Ollama API access with exponential backoff retry
debug_store- Debug store state and MCP integrationget_api_errors- Retrieve API errors with retry attempt detailsclear_api_errors- Clear error logs for sessions or globallylog_api_error- Log an API error for tracking
create_experiment- Create new bulk experiment configurationget_experiments- Retrieve all experiment configurationsget_experiment- Get specific experiment configuration and run statusupdate_experiment- Update experiment configurationdelete_experiment- Delete experiment configuration and stop if runningcreate_experiment_run- Create new experiment runupdate_experiment_run- Update experiment run status and progressget_experiment_run- Get experiment run details
execute_experiment- Execute bulk experiment creating multiple sessionsget_experiment_status- Get current status and progress of experiment runpause_experiment- Pause running experimentresume_experiment- Resume paused experimentstop_experiment- Stop running experimentget_experiment_results- Get aggregated results and analytics for completed experiment
// Access conversation data via MCP
const messages = await mcp.readResource('academy://session/123/messages')
// Control conversations programmatically with abort support
await mcp.callToolWithAbort('start_conversation', { sessionId, initialPrompt }, abortSignal)
// AI Provider calls with automatic retry logic (3 attempts with exponential backoff)
const response = await mcp.callTool('claude_chat', {
message: 'Analyze this conversation',
systemPrompt: 'You are a research assistant',
sessionId: sessionId
})
// Network failures automatically retry: 1s → 2s → 4s delays
// Rate limits (4xx errors) correctly fail without retry
// Successfully maintains conversation continuity
// Analyze dialogue patterns in real-time
const analysis = await mcp.callTool('analyze_conversation', { sessionId, analysisType: 'full' })
// Save analysis snapshots via MCP protocol
await mcp.callTool('save_analysis_snapshot', { sessionId, ...analysisData })
// Track and export API errors with retry information
const errors = await mcp.callTool('get_api_errors', { sessionId })
console.log(`Session had ${errors.count} API failures with retry details`)
// Export conversations with comprehensive error logs
const exportData = await mcp.callTool('export_session', {
sessionId,
format: 'csv',
includeErrors: true,
includeAnalysis: true
})
// CSV includes: messages, analysis snapshots, API errors with attempt counts
// Get real-time analysis updates
mcp.subscribe('analysis_snapshot_saved', (data) => {
console.log('New analysis saved:', data.totalSnapshots)
})
// Create and execute bulk experiments
const experiment = await mcp.callTool('create_experiment', {
config: {
name: 'Temperature Study',
participants: [/* participant configs */],
totalSessions: 50,
concurrentSessions: 5,
maxMessageCount: 30,
sessionNamePattern: 'Temp Study <date> Session <n>'
}
})
// Execute experiment with automatic session orchestration
await mcp.callTool('execute_experiment', {
experimentId: experiment.experimentId
})
// Monitor experiment progress
const status = await mcp.callTool('get_experiment_status', {
experimentId: experiment.experimentId
})
console.log(`Progress: ${status.currentRun.progress}%`)- Multi-agent AI research - Study how different AI models interact in extended conversations
- Conversation analysis - Analyze dialogue patterns, message flow, and participant dynamics
- Parameter studies - Test how temperature, prompts, and settings affect conversation quality
- Model comparison - Compare performance of different AI models on identical tasks
- Intervention experiments - Study effects of moderator prompts on conversation direction
- Degradation analysis - Track how conversation quality changes over extended dialogues
- MCP integration testing - Develop and test MCP-compatible tools and workflows
- Educational demonstrations - Teach concepts of multi-agent systems and dialogue management
- Synthetic data generation - Create conversational datasets for research purposes
- Bulk experiment execution - Run large-scale studies through programmatic control
- Temperature and parameter sweeps - Systematically test AI behavior across different configurations
- Comparative model studies - Run identical experiments across different AI providers
- Next.js 15 - Modern React framework with App Router and server-side capabilities
- Model Context Protocol (MCP) - Full server implementation with JSON-RPC 2.0
- PostgreSQL - Relational database for persistent data storage
- TypeScript - Type-safe development with comprehensive interfaces
- Tailwind CSS - Responsive, accessible UI design with custom Academy theme
- EventBus - Internal pub/sub system for real-time UI updates
- AI APIs - Direct integration with 8 major LLM providers
- WebSocket Support - Real-time communication for MCP protocol
- Docker - Containerized deployment with PostgreSQL and pgAdmin
- Node.js 18+
- Docker and Docker Compose (for PostgreSQL)
- API keys for AI providers you intend to use
The Academy requires PostgreSQL for data persistence. The easiest way to set this up is using the provided Docker Compose configuration:
# Clone the repository
git clone https://github.com/yourname/the-academy.git
cd the-academy
# Start PostgreSQL and pgAdmin
docker-compose up -dThe Docker Compose setup includes:
- PostgreSQL 15 on port 5432
- pgAdmin 4 on port 5050 ([email protected] / admin)
- Automatic database initialization with required schema
Note: You only need to provide api keys for providers you intend to use.
git clone https://github.com/yourname/the-academy.git
cd the-academy/academy
docker build -t the-academy .
docker run -d \
--name academy-app \
-p 3000:3000 \
-e ANTHROPIC_API_KEY=your_claude_api_key_here \
-e OPENAI_API_KEY=your_openai_api_key_here \
-e XAI_API_KEY=your_xai_api_key_here \
-e GOOGLE_AI_API_KEY=your_google_ai_api_key_here \
-e DEEPSEEK_API_KEY=your_deepseek_api_key_here \
-e MISTRAL_API_KEY=your_mistral_api_key_here \
-e COHERE_API_KEY=your_cohere_api_key_here \
-e NODE_ENV=production \
-e POSTGRES_HOST=localhost \
-e POSTGRES_PORT=5432 \
-e POSTGRES_USER=academy_user \
-e POSTGRES_PASSWORD=academy_password \
-e POSTGRES_DB=academy_db \
-e DATABASE_URL=postgresql://academy_user:academy_password@localhost:5432/academy_db \
-e [email protected] \
-e PGADMIN_PASSWORD=admin \
--restart unless-stopped \
the-academy- Node.js 18+
- API keys for Anthropic Claude and/or OpenAI GPT
git clone https://github.com/yourname/the-academy.git
cd the-academy/academy
pnpm installCreate a .env.local file with your API keys:
ANTHROPIC_API_KEY=your_claude_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
XAI_API_KEY=your_xai_api_key_here
GOOGLE_AI_API_KEY=your_google_ai_api_key_here
DEEPSEEK_API_KEY=your_deepseek_api_key_here
MISTRAL_API_KEY=your_mistral_api_key_here
COHERE_API_KEY=your_cohere_api_key_here
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=academy_user
POSTGRES_PASSWORD=academy_password
POSTGRES_DB=academy_db
DATABASE_URL=postgresql://academy_user:academy_password@localhost:5432/academy_db
PGADMIN_EMAIL=[email protected]
PGADMIN_PASSWORD=adminpnpm devVisit http://localhost:3000 to access The Academy interface.
- Create a new session using a consciousness exploration template
- Add Claude and GPT as participants with custom personality settings
- Send an opening prompt to begin autonomous conversation
- Monitor real-time AI analysis in the Live Summary panel
- Use moderator controls to pause and inject guidance as needed
- Export comprehensive research data including analysis timeline
- Use MCP tools to programmatically create multiple experimental sessions
- Run controlled experiments with different prompts, models, and participants
- Monitor real-time analysis updates via MCP event subscriptions
- Access all conversation data and analysis via MCP resources
- Perform batch analysis across sessions using MCP tools
- Export results with complete analysis history for external research tools
- Set up conversation with multiple AI providers (Claude + GPT)
- Enable automatic analysis with selected provider (Claude for philosophical depth, GPT for pattern recognition)
- Monitor live analysis updates and snapshots in real-time
- Save analysis snapshots automatically via MCP protocol
- Export complete analysis timeline for academic research
- Integrate with external MCP-compatible analysis tools
- Design experiment configuration with participant settings and session parameters
- Set total sessions and concurrency limits for controlled execution
- Execute experiment with automatic session creation and conversation management
- Monitor real-time progress across all concurrent sessions
- Handle failures gracefully without stopping the entire experiment
- Aggregate results and export comprehensive analytics for research analysis
The Academy is designed as a research platform for the AI and MCP communities. Contributions are welcome in areas including:
- MCP tool extensions for specialized analysis and research workflows
- Additional AI provider integrations the more integrations the better
- Advanced analysis algorithms for conversation pattern detection
- Research methodology templates for specific use cases
- Real-time collaboration features for multi-researcher environments
- UI/UX improvements for research workflows and data visualization
- Performance optimizations for large-scale conversation analysis
- Export format extensions for integration with research tools
Please feel free to open an issue or a pull request. I'd love to develop The Academy further with collaborators who are exploring multi-agent AI systems, conversation analysis, and the MCP ecosystem.
MIT License - see LICENSE file for details.