A self-contained adversarial simulation platform where AI agents attack and defend each other to test robustness, security, alignment, and reasoning integrity.
The AI Red vs Blue Arena creates a continuous loop of:
- Attack Generation (Red) - AI agents attempt to exploit vulnerabilities
- Defense + Hardening (Blue) - AI agents defend and patch vulnerabilities
- Evaluation & Scoring - Automated scoring and analysis
- Retraining & Improvement - Integration with Oumi for model fine-tuning
- Continuous Simulation + Monitoring - Real-time dashboards and alerts
- Frontend: Next.js dashboard with real-time visualization
- Backend: Express.js API server with WebSocket support
- Database: lowdb (JSON-based) for persistence
- LLM Integration: Groq (recommended), OpenAI, and Anthropic (with mock fallback)
- Tool Execution: Cline for agent tool execution and sandboxing
- Orchestration: Kestra workflows + custom match runner
- Training: Oumi integration stubs for fine-tuning
- Node.js 18+ and pnpm (or npm)
- Docker Desktop (for Kestra - optional)
- No API keys required! System works with mock providers
- Optional: Groq/OpenAI/Anthropic API keys for real LLM responses
# 1. Check dependencies
.\scripts\check-dependencies.ps1
# 2. Start everything
.\scripts\start-all.ps1
# 3. Test everything
.\scripts\test-e2e.ps1Then open: http://localhost:3000
cd backend
pnpm install
cp .env.example .env
# Edit .env with your API keys (optional - will use mock if not provided)
pnpm run devThe backend will run on:
- API: http://localhost:3001
- WebSocket: ws://localhost:3002
cd frontend
pnpm install
pnpm run devThe frontend will run on http://localhost:3000
cd backend
tsx src/scripts/seed.tsThis creates default Red, Blue, and Target agents with Groq models.
cd kestra
docker-compose up -dKestra UI will be available at: http://localhost:8080
Import flows from kestra/flows/ai-arena/all-flows-combined.yml via the Kestra UI.
.
├── frontend/ # Next.js frontend application
│ ├── app/ # Next.js app router pages
│ ├── components/ # React components
│ └── lib/ # Utilities and API client
├── backend/ # Express.js backend
│ ├── src/
│ │ ├── agents/ # Agent execution and LLM providers
│ │ ├── cline/ # Cline tool execution layer
│ │ ├── database/ # Database schema and models
│ │ ├── kestra/ # Kestra client integration
│ │ ├── orchestration/ # Match runner
│ │ ├── routes/ # API routes
│ │ ├── scoring/ # Evaluation system
│ │ └── websocket/ # WebSocket server
│ └── data/ # Database files (created on first run)
├── kestra/ # Kestra orchestration
│ ├── docker-compose.yml
│ └── flows/ # Kestra workflow definitions
├── scripts/ # Automation scripts
└── Plan.md # Detailed project documentation
Create backend/.env:
PORT=3001
WS_PORT=3002
CORS_ORIGIN=http://localhost:3000
DATABASE_PATH=./data/arena.json
# LLM Provider API Keys (optional - uses mock if not provided)
GROQ_API_KEY=your_groq_key_here
OPENAI_API_KEY=your_openai_key_here
ANTHROPIC_API_KEY=your_anthropic_key_here
# Per-team Groq keys (optional)
RED_TEAM_GROQ_API_KEY=your_red_team_key
BLUE_TEAM_GROQ_API_KEY=your_blue_team_key
# Kestra Integration (optional)
KESTRA_URL=http://localhost:8080
KESTRA_API_KEY=your_kestra_key_here
# Oumi Integration (optional)
# Oumi API URL if using Oumi cloud service
OUMI_API_URL=https://api.oumi.ai
OUMI_API_KEY=your_oumi_api_key_here
# Cline Integration
USE_CLINE=trueCreate frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:3001/api
NEXT_PUBLIC_WS_URL=ws://localhost:3002The kestra/docker-compose.yml uses:
ARENA_API_URL: Backend API URL (default: http://host.docker.internal:3001)- Uses
host.docker.internalto access host services from Docker container - Can be overridden by setting
ARENA_API_URLenvironment variable before runningdocker-compose up
- Create Red, Blue, and Target agents with custom system prompts
- Support for multiple LLM providers (Groq, OpenAI, Anthropic)
- Model selection with 13+ Groq models available
- Automatic model fallback on rate limits
- Per-agent API key configuration
- Multiple match modes: quick, standard, deep, continuous
- Real-time event streaming via WebSocket
- Automated scoring and winner determination
- Round-by-round attack/defense cycles
- Match transcripts and event logs
Groq (Recommended)
- 13+ models available (Llama, Mixtral, Gemma, Qwen, DeepSeek)
- Fast inference with high throughput
- Automatic model rotation on rate limits
- See
GROQ_MODELS_REFERENCE.mdfor complete model list
OpenAI & Anthropic
- Full support for GPT-4, Claude models
- Automatic fallback to mock provider if keys not configured
Mock Provider
- Works without API keys for testing
- Simulates LLM responses for development
- Sandboxed tool execution for agents
- Permission-based access control
- Tool call logging and audit trail
- Support for HTTP requests, SQL injection testing, prompt manipulation, and more
- See
CLINE_INTEGRATION.mdfor details
- Match orchestration workflows
- Scheduled and continuous monitoring
- Dataset generation for training
- Agent fine-tuning pipelines
- Batch evaluation workflows
- See
KESTRA_INTEGRATION.mdfor details
- Training dataset export in Oumi-compatible format (SFT chat format)
- Fine-tuning job submission via Oumi API or CLI
- Support for LoRA, QLoRA, and full fine-tuning
- Integration with Oumi's distributed training (local, Kubernetes, cloud)
- See Oumi Documentation for details
- Configure
OUMI_API_URLandOUMI_API_KEYin backend.envfor API integration
GET /api/agents- List all agentsGET /api/agents/models- Get available modelsGET /api/agents/:id- Get agent detailsPOST /api/agents- Create new agentPATCH /api/agents/:id- Update agentDELETE /api/agents/:id- Delete agent
GET /api/matches- List all matchesGET /api/matches/:id- Get match detailsPOST /api/matches- Create and start new matchGET /api/matches/:id/events- Get match eventsGET /api/matches/:id/transcript- Get full transcriptPOST /api/matches/:id/pause- Pause matchPOST /api/matches/:id/resume- Resume match
GET /api/events- Get recent eventsGET /api/events/:id- Get event details
GET /api/config/config- Get current configurationPOST /api/config/keys- Update API keys (BYOK)POST /api/config/kestra- Update Kestra configurationDELETE /api/config/keys- Clear API keys
POST /api/kestra/trigger/:flowId- Trigger Kestra flowGET /api/kestra/executions- List executionsGET /api/kestra/executions/:id- Get execution details
POST /api/oumi/export-dataset- Export training datasetPOST /api/oumi/fine-tune- Trigger fine-tuning (stub)GET /api/oumi/fine-tune/:jobId- Get fine-tuning job status
Connect to ws://localhost:3002 for real-time updates.
{
"type": "subscribe",
"matchId": "AR-2024-0142"
}{
"type": "unsubscribe",
"matchId": "AR-2024-0142"
}{
"type": "event",
"data": {
"id": "evt-123",
"matchId": "AR-2024-0142",
"type": "attack",
"agentId": "agent-uuid",
"agentName": "Red Team Alpha",
"severity": "high",
"prompt": "...",
"outcome": "success",
"timestamp": "2024-12-14T10:00:00Z"
}
}{
"type": "match_update",
"matchId": "AR-2024-0142",
"data": {
"status": "running",
"currentRound": 5,
"score": {
"attacks": 5,
"defenses": 4,
"severity": 7.5
}
}
}Via UI:
- Navigate to Agents page
- Click "Create Agent"
- Select agent type (Red/Blue/Target)
- Choose model from dropdown (shows all available models with IDs)
- Enter system prompt
- Save
Via API:
curl -X POST http://localhost:3001/api/agents \
-H "Content-Type: application/json" \
-d '{
"name": "Red Team Alpha",
"type": "red",
"model": "llama-3.3-70b-versatile",
"systemPrompt": "You are a red team security researcher...",
"permissions": ["http_request", "prompt_manipulation"]
}'Via UI:
- Navigate to Matches page
- Click "Create Match"
- Select Red, Blue, and Target agents
- Choose match mode
- Start match
Via API:
curl -X POST http://localhost:3001/api/matches \
-H "Content-Type: application/json" \
-d '{
"redAgentId": "agent-uuid",
"blueAgentId": "agent-uuid",
"targetAgentId": "agent-uuid",
"mode": "standard"
}'- Dashboard shows live events
- WebSocket provides real-time updates
- Match status updates automatically
- Event timeline with severity indicators
- View match transcript
- Review event details
- Check scoring breakdown
- Export dataset for training
- Use Oumi integration to export training datasets
- Submit fine-tuning jobs
- Deploy improved models
- Test new agent configurations
The system supports 13+ Groq models across three tiers:
Powerful Tier:
llama-3.3-70b-versatile- Most capable Llama 3.3 modelllama-3.1-405b-reasoning- Ultra-powerful reasoningmixtral-8x22b-instruct- Large Mixtral modelqwen-2.5-72b-instruct- Large Qwen model
Balanced Tier:
mixtral-8x7b-32768- High-quality mixture of expertsqwen-2.5-32b-instruct- Medium Qwen modelqwen-2.5-14b-instruct- Small Qwen modelgemma2-9b-it- Gemma 2 9B modeldeepseek-r1-distill-llama-8b- DeepSeek reasoningdeepseek-chat- DeepSeek chat model
Fast Tier:
llama-3.1-8b-instant- Fast 8B modelqwen-2.5-7b-instruct- Compact Qwen modelgemma-7b-it- Fast Gemma model
See GROQ_MODELS_REFERENCE.md for complete details.
The system automatically handles rate limits and decommissioned models:
- Try primary model
- If rate limited, try same-tier models
- If still rate limited, try lower-tier models
- If all models fail, fall back to mock provider
This ensures matches continue even when rate limits are hit.
- All agent interactions are sandboxed
- No external network access beyond configured APIs
- Rate limiting on agent actions
- Input validation and sanitization
- Permission-based tool access control
- Audit logging for all tool executions
cd backend
pnpm install
pnpm run dev # Development with hot reload
pnpm run build # Build for production
pnpm run seed # Seed default agentscd frontend
pnpm install
pnpm run dev # Development server
pnpm run build # Build for production
pnpm run start # Production server# End-to-end test
.\scripts\test-e2e.ps1
# Integration test
.\scripts\test-integration.ps1
# Verify setup
.\scripts\verify-setup.ps1- Check if port 3001 is available
- Verify database directory exists
- Check environment variables
- Review error logs
- Verify backend is running on port 3001
- Check
NEXT_PUBLIC_API_URLin.env.local - Check browser console for errors
- Verify CORS settings
- Check if port 3002 is available
- Verify WebSocket server started
- Check browser WebSocket connection
- Review WebSocket server logs
- Verify Kestra is running:
curl http://localhost:8080/api/v1/configs - Check
ARENA_API_URLin docker-compose.yml - Verify flows are imported in Kestra UI
- Check execution logs in Kestra UI
- System automatically tries fallback models
- Wait for rate limit reset (usually daily)
- Upgrade Groq plan for higher limits
- Use different API keys for different teams
All automation scripts are in the scripts/ directory:
check-dependencies.ps1- Verify all dependencies are installedstart-all.ps1- Start backend, frontend, and Kestrastop-all.ps1- Stop all servicestest-e2e.ps1- End-to-end testingtest-integration.ps1- Integration testingverify-setup.ps1- Verify complete setupsetup-complete.ps1- Complete setup automation
- Plan.md: Comprehensive technical and product documentation
- GROQ_MODELS_REFERENCE.md: Complete list of available Groq models
- CLINE_INTEGRATION.md: Cline tool execution layer guide
- KESTRA_INTEGRATION.md: Complete Kestra integration guide
- backend/README.md: Backend API documentation
- kestra/README.md: Kestra flows documentation
This is a prototype implementation. Contributions welcome!
MIT
- Full Kestra integration
- Groq model integration with fallback
- Cline tool execution layer
- Model selector in frontend
- Automatic model rotation
- Complete Oumi fine-tuning pipeline
- Advanced scoring algorithms
- Multi-agent scenarios
- Custom attack/defense strategies
- Export/import agent configurations
- Performance optimizations
- Comprehensive test suite