See how a team breaks โ before the stakes are real.
A living multi-agent AI crisis lab for people, decisions, and leadership.
Hidden thoughts become visible. Decisions reshape the world. Every intervention leaves a trace.
TeamDynamics turns an invisible organizational risk into something you can see, measure, and safely challenge. Build a psychologically distinct AI team, inject a high-stakes company crisis, and watch morale, stress, loyalty, alliances, decisions, and business metrics evolve together in real time.
Instead of asking a chatbot what might happen, TeamDynamics creates a living system where every personality, vote, intervention, and consequence becomes part of the outcome.
- Launch the Northstar Labs crisis โ no account, API key, or setup required.
- Watch three distinct agents collide across public debate, private thoughts, shifting emotions, and team decisions.
- Open God Mode to pause time, preview a targeted intervention, apply it, inspect its receipt, and safely undo it when eligible.
- Follow the consequences into the world state and final executive outcome.
The public demo sends 18 deterministic messages from three agents across three rounds through the real simulation engine, state transitions, persistence, WebSocket stream, decision tracking, and outcome generator โ without external model spend.
| Typical AI Demo | TeamDynamics |
|---|---|
| A single chatbot response | A society of agents with distinct psychology, memory, influence, and hidden intent |
| A scripted conversation | A stateful crisis where dialogue, team health, and company metrics affect one another |
| A magic action button | Previewed, scoped, confirmable interventions with receipts and safe undo |
| A static result | A live decision journey ending in an executive-grade diagnosis |
TeamDynamics entered OpenAI Build Week with an existing multi-agent simulation foundation. During the event, the project was extended into a clearer, judge-ready end-to-end experience:
- A public, rate-limited Quick Demo that requires no account or API key
- A deterministic three-agent demo story that still runs through the real simulation engine, persistence, WebSocket stream, decisions, and outcomes
- Document-assisted setup that extracts grounded company context, risks, crisis suggestions, and agent recommendations from uploaded files
- God Mode interventions with preview, scoped targets, confirmation, auditable receipts, and safe undo behavior
- More readable live conversations, structured events, and clearer report metrics so users can follow cause and effect
- Reliability improvements for aborted simulations, malformed agent output, agent identity validation, and report generation
- A more polished judge path across the landing page, guided setup, simulation, intervention workflow, and final executive report
These additions preserve the original Premeditatio Malorum-inspired idea while making the complete decision-rehearsal journey easier to experience and evaluate.
GPT-5.6 was used as a development reasoning model through OpenAI Codex, not
as TeamDynamics' deployed inference API. The application's current default
OpenAI runtime model remains gpt-4o-mini, while the public Quick Demo uses
deterministic responses to provide a reliable, zero-key judge experience.
Within Codex, GPT-5.6 helped reason across the full stack: tracing simulation state, reviewing agent and report behavior, identifying reliability and security risks, refining user flows, and checking whether frontend presentation matched backend behavior. This continued an earlier development path that used GPT-5.4 and GPT-5.5 before moving to GPT-5.6.
Codex was used throughout TeamDynamics as an agentic engineering collaborator, not only as code completion. It helped to:
- Explore and audit the existing Next.js, FastAPI, PostgreSQL, and WebSocket architecture before making changes
- Turn product requirements into scoped implementations across the setup, simulation, intervention, and report flows
- Trace failures across frontend and backend boundaries and implement focused fixes
- Run linting, type checks, unit tests, backend tests, and build verification
- Review reliability, security, documentation, and judge-facing clarity
- Work with TestSprite evidence in a build-test-inspect-fix-verify loop
TestSprite exercised real product journeys and exposed behavioral failures; Codex helped inspect those failures, identify root causes, implement fixes, and verify the affected flows again. Product direction, architecture, trade-offs, and final validation remained human-owned.
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.
Change the simulation without losing control. The backend-authoritative Observe / Intervene console can target the whole team, one agent, the project, or the decision process. Preview deterministic impact before applying, confirm high-impact actions, inspect an auditable receipt, and safely undo eligible changes. The console starts collapsed on desktop and mobile so the agents remain center stage.
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) |
The fastest way to evaluate TeamDynamics is the public Quick Demo. It requires no account, API key, or local setup.
For local development, follow the steps below.
- 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!
From the repository root:
cd backend
python -m pip install pytest
python -m pytest -qThe backend suite covers the demo engine and endpoint, simulation events, WebSocket completion behavior, document analysis, interventions, report generation, agent identity validation, and LLM-provider behavior. Model calls are mocked in focused tests, so the suite does not require spending API credit.
cd frontend
npm install
npm run lint
npm run test:unit
npx tsc --noEmit
npm run buildThe committed unit-test command covers the public demo API contract and simulation labels. Linting, TypeScript checking, and the production build catch broader integration and rendering regressions.
TeamDynamics was iteratively tested with TestSprite from early development.
Generated plans, browser tests, and the HTML report are preserved under
testsprite_tests/, including 35 named product journeys.
To replay a safe, unauthenticated local browser flow after starting both the backend and frontend:
python -m pip install playwright
python -m playwright install chromium
python testsprite_tests/TC012_Redirect_to_login_when_visiting_dashboard_unauthenticated.pySome generated scenarios exercise registration or authenticated data. Review a test file before replaying it and use dedicated test credentials rather than a personal or production account.
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 # cost-conscious default with Structured Outputs
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=openrouter/free
OPENROUTER_CHEAP_MODEL=openrouter/free
LLM_DAILY_BUDGET_USD=0.25 # local daily safety cap; adjust deliberately
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
โ โโโ interventions.py # Preview, apply, receipt, and safe-undo rules
โ โโโ 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}/interventions/preview |
Preview a scoped intervention |
POST |
/api/simulation/{id}/intervene |
Apply a previewed God-Mode intervention |
POST |
/api/simulation/{id}/interventions/{intervention_id}/undo |
Safely undo the latest eligible intervention |
POST |
/api/simulation/{id}/control |
Pause, resume, or step one agent turn |
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. Open the collapsed God Mode console only when needed to pause, preview, apply, audit, or safely undo a scoped intervention.
- 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
- 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 for leaders who would rather simulate the crisis than survive it.