Multi-Agent Gamified SaaS Simulation for Team Crisis Analysis
Identify the exact breaking point of your startup before it happens in real life.
TeamDynamics is a multi-agent AI-powered simulation platform that lets startup founders, HR leaders, and team managers stress-test their team's resilience under corporate crises. Assemble a virtual team of psychologically-profiled AI agents, inject a real-world crisis scenario, and observe in real-time how your team reacts โ predicting burnout cascades, communication breakdowns, and resignation waves before they happen.
| Challenge | How TeamDynamics Solves It |
|---|---|
| Unpredictable team reactions | Personality-weighted AI agents produce realistic, differentiated behavior |
| Costly trial-and-error | Simulate weeks of crisis in minutes with zero real-world risk |
| Hidden team fracture points | Expose breaking points through morale, stress, and loyalty tracking |
| One-size-fits-all management | Test different interventions (bonuses, overtime cancellation, etc.) and compare outcomes |
Each agent is equipped with a 5-trait personality system (Empathy, Ambition, Stress Tolerance, Agreeableness, Assertiveness) that drives unique speech patterns, decision-making, and stress responses โ no generic chatbot behavior.
Watch agents interact in a Slack-like surveillance interface via WebSocket connections. See public messages alongside hidden internal thoughts, with typing indicators and system event broadcasts.
Inject Pizza Parties, Cancel Overtime, Bonuses, or declare new crises on-the-fly. Watch immediate morale shifts with effects modulated by each agent's personality.
A persistent economic simulation layer tracks budget, reputation, customer satisfaction, technical debt, and deadline pressure โ making every agent decision consequential.
Proposals are voted on with influence weights based on role seniority. Senior roles carry more weight, mirroring real corporate power dynamics.
Upload company documents (PDF, DOCX, CSV, XLSX) and let AI extract team risks, suggest crises, and auto-fill simulation parameters.
Post-simulation AI-generated reports with agent-by-agent analysis, timeline charts, survival classifications, and actionable recommendations โ exportable as PDF.
Mix and match LLM providers (OpenAI, Google Gemini, OpenRouter) per-agent for behavioral diversity. Supports Claude, GPT-4, Llama 3, and more.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Next.js 16 Frontend โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Login / โ โ Setup โ โSimulation โ โ Report / โ โ
โ โ Register โ โ Wizard โ โ Live UI โ โ Dashboard โ โ
โ โโโโโโโฌโโโโโโ โโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโโฌโโโโโโโโ โ
โ โ JWT Auth โ WebSocket โ REST API โ โ
โโโโโโโโโโผโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโผโโโโโโโโโโ
โ โ โ โ
โโโโโโโโโโผโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโผโโโโโโโโโโ
โ โผ FastAPI Backend โผ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Auth Router โ Simulation Router โ Document โ WebSocket โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
โ โ Simulation Engine (Orchestrator) โ โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
โ โ Agent 1 โ Agent 2 โ Agent N โ Per-Agent LLM Model โ โ
โ โ (LLM) โ (LLM) โ (LLM) โ Override Support โ โ
โ โโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
โ โ Personality-Weighted State Machine โ Communication DNA โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโค โ
โ โ Decision Engine โ World State โ Phase System โ Memory โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
โ โ Hidden Agendas โ Random Events โ Report Generator โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ PostgreSQL Database โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Layer | Technology |
|---|---|
| Frontend | Next.js 16 (App Router), React 19, TypeScript |
| Styling | Tailwind CSS v4, shadcn/ui, Framer Motion |
| Charts | Recharts |
| Backend | Python, FastAPI, Uvicorn |
| Database | PostgreSQL (asyncpg) |
| Auth | JWT (python-jose) + bcrypt, Google OAuth 2.0 |
| AI Providers | OpenAI, Google Gemini, OpenRouter |
| Documents | PyPDF2, python-docx, openpyxl |
| Real-Time | WebSocket (FastAPI native) |
- Python 3.11+
- Node.js 20+
- Git
- At least one LLM API key (OpenAI, Gemini, or OpenRouter)
git clone https://github.com/bagusardin25/TeamDynamics.git
cd TeamDynamicscd backend
# Create and activate virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # macOS / Linux
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your API keys (see Environment Variables below)
# Start the backend
python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000๐ API Docs: Swagger UI available at https://teamdynamics.vercel.app/docs
Open a second terminal:
cd frontend
# Install dependencies
npm install
# Start the dev server
npm run devNavigate to https://teamdynamics.vercel.app โ create an account, set up a team, trigger a crisis, and watch the chaos unfold!
Create a .env file inside /backend based on .env.example:
# โโโ LLM Provider (required โ at least one) โโโ
LLM_PROVIDER=openai # openai | gemini | openrouter
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini # optional, default model
OPENAI_CHEAP_MODEL=gpt-4o-mini # used during traffic/cost spikes
GEMINI_API_KEY=AI...
GEMINI_MODEL=gemini-2.0-flash # optional, default model
GEMINI_CHEAP_MODEL=gemini-2.0-flash
OPENROUTER_API_KEY=sk-or-...
OPENROUTER_DEFAULT_MODEL=meta-llama/llama-3.1-8b-instruct:free
OPENROUTER_CHEAP_MODEL=meta-llama/llama-3.1-8b-instruct:free
LLM_DAILY_BUDGET_USD=5.00
LLM_FALLBACK_ENABLED=true
LLM_FALLBACK_BUDGET_THRESHOLD_PCT=80
LLM_TRAFFIC_SPIKE_ACTIVE_CALLS=10
# โโโ Server โโโ
HOST=0.0.0.0
PORT=8000
FRONTEND_URL=https://teamdynamics.vercel.app
ENVIRONMENT=production
FORCE_HTTPS=true
# โโโ Authentication โโโ
JWT_SECRET_KEY=<output-of-openssl-rand-hex-32>
ADMIN_EMAIL=admin@example.com # gets unlimited credits
# Error Tracking
SENTRY_DSN=https://...
SENTRY_ENVIRONMENT=production
# โโโ Database โโโ
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/teamdynamics
# โโโ Google OAuth (optional) โโโ
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secretFrontend analytics is optional. Set these in the frontend deployment when using PostHog:
NEXT_PUBLIC_POSTHOG_KEY=phc_...
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.comNote:
DATABASE_URLmust point to a PostgreSQL database in local and production environments. In production,JWT_SECRET_KEYmust be a strong random value with at least 32 characters or the backend will refuse to start.
Configure an external uptime monitor such as UptimeRobot or Better Stack to check GET /health every 1-5 minutes. Alert on non-2xx responses and latency spikes. Sentry covers application errors, while PostHog covers product analytics.
TeamDynamics/
โโโ backend/
โ โโโ main.py # FastAPI app entry point
โ โโโ requirements.txt # Python dependencies
โ โโโ .env.example # Environment template
โ โโโ models/
โ โ โโโ database.py # DB init, schemas, connection pooling
โ โโโ routers/
โ โ โโโ auth.py # Auth endpoints (register, login, OAuth)
โ โ โโโ simulation.py # Simulation CRUD & intervention endpoints
โ โ โโโ agents.py # Preset agent configurations
โ โ โโโ document.py # Document upload & AI analysis
โ โ โโโ websocket.py # WebSocket real-time streaming
โ โโโ services/
โ โโโ auth_service.py # JWT, password hashing, Google OAuth
โ โโโ simulation_engine.py # Core simulation orchestrator
โ โโโ llm_service.py # Multi-provider LLM integration
โ โโโ decision_engine.py # Proposal system & hierarchy voting
โ โโโ document_service.py # File parsing & AI extraction
โ โโโ report_generator.py # Post-simulation report generation
โ
โโโ frontend/
โ โโโ package.json
โ โโโ public/
โ โ โโโ logo.svg # Application logo
โ โโโ src/
โ โโโ app/
โ โ โโโ page.tsx # Landing page
โ โ โโโ login/ # Authentication โ login
โ โ โโโ register/ # Authentication โ register
โ โ โโโ dashboard/ # User dashboard & simulation history
โ โ โโโ setup/ # 3-step simulation setup wizard
โ โ โโโ simulation/ # Live simulation interface
โ โ โโโ report/ # Post-simulation executive report
โ โ โโโ docs/ # In-app technical documentation
โ โโโ components/
โ โโโ simulation/ # Simulation UI components
โ โ โโโ MessageFeed.tsx
โ โ โโโ MessageBubble.tsx
โ โ โโโ AgentSidebar.tsx
โ โ โโโ MetricsDashboard.tsx
โ โ โโโ InterventionPanel.tsx
โ โ โโโ RadialGauge.tsx
โ โ โโโ ...
โ โโโ ui/ # shadcn/ui components
โ
โโโ README.md
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/register |
Register with email/password |
POST |
/api/auth/login |
Login with email/password |
POST |
/api/auth/google |
Google OAuth sign-in |
GET |
/api/auth/me |
Get current user profile |
GET |
/api/auth/me/simulations |
Get user's simulation history |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/simulation/create |
Create & launch a new simulation |
GET |
/api/simulation/{id}/status |
Get simulation state & messages |
POST |
/api/simulation/{id}/intervene |
Send God-Mode intervention |
GET |
/api/simulation/{id}/report |
Generate executive report |
POST |
/api/simulation/generate-crisis |
AI-generate a crisis scenario |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/agents/presets |
Get preset agent configurations |
POST |
/api/document/analyze |
Upload & analyze document with AI |
WS |
/ws/simulation/{id} |
WebSocket: real-time simulation stream |
GET |
/health |
Backend health check |
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ 1. SETUP โโโโโถโ 2. CRISISโโโโโถโ 3. LIVE โโโโโถโ 4. REPORTโ
โ Team & โ โ Inject โ โ Observe โ โ Analyze โ
โ Company โ โ Scenarioโ โ & Act โ โ Results โ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
- Setup โ Configure your company profile, assemble a team (4-8 agents) with custom personalities, and choose simulation parameters.
- Crisis Injection โ Select a pre-built crisis (layoffs, CEO resignation, database wipe) or let AI generate one from uploaded documents.
- Live Simulation โ Watch agents debate, propose solutions, burn out, or resign in real-time. Use God-Mode to intervene with bonuses, pizza parties, or overtime cancellation.
- Report โ Receive an AI-generated executive report with per-agent analysis, morale/stress timelines, survival classifications, and actionable recommendations.
- 5-Phase Narrative Arc: Crisis Shock โ Debate & Proposals โ Escalation โ Resolution Attempt โ Aftermath
- Personality-Weighted State Machine: Morale, stress, loyalty, and productivity changes are modulated by each agent's unique personality traits
- Hidden Agendas: Agents have secret motivations that subtly influence their proposals and alliances
- Random Events: Unexpected events (client threats, security breaches, investor calls) inject chaos into the simulation
- Critical Events: Resignation, burnout, and warning detection based on personality-adjusted thresholds
- 6 Possible Outcomes: Team Triumph ๐ | Negotiated Settlement ๐ค | Pyrrhic Victory โก | Team Fracture ๐ | Total Collapse ๐ฅ | Stalemate โณ
Frontend: https://teamdynamics.vercel.app Backend API: Hosted on Railway
This project was tested using TestSprite MCP with 35 automated end-to-end test cases covering:
| Category | Tests | Pass Rate |
|---|---|---|
| Authentication (register, login, OAuth, guards) | 6 | 100% |
| Dashboard (stats, history, logout) | 4 | 50%* |
| Simulation Setup (wizard, agents, crisis gen) | 4 | 100% |
| Report & Analytics (metrics, PDF export, share) | 6 | 83% |
| Landing Page & Navigation (CTAs, 404, docs) | 4 | 75%** |
| Theme & Accessibility | 3 | 100% |
*TC008 and TC016 failures were root-caused and fixed post-test run. **TC015 blocked due to test plan targeting a deprecated feature โ not a product defect.
๐ All test cases and the full report are in testsprite_tests/.
- Parallel simulation execution for A/B testing
- Agent-to-agent private messaging channels
- Historical simulation replay
- Custom personality trait definitions
- Team template library (save & share configurations)
- Slack / Teams integration for output distribution
- Subscription-based pricing with tiered credits
- Admin dashboard with user management
This project is proprietary. All rights reserved.
Built with passion, caffeine, and a whole lot of AI for Hackathon Season 2.