TeamDynamics Docs
Learn how to build, run, and analyze multi-agent AI simulations that predict team dynamics, breakdowns, and resilience under crisis conditions — complete with world state constraints, hidden agendas, power hierarchies, and dramatic outcomes.
Overview
TeamDynamics is a multi-agent AI simulation sandbox designed for founders, HR leaders, and organizational strategists. It lets you create a virtual team of AI-driven employees, inject real-world crises, and observe how your team would react—before it happens in real life.
Each agent has deep psychological profiles including traits like empathy, ambition, stress tolerance, and loyalty. When a crisis hits, agents react based on their personality, relationships, hidden agendas, and current state—producing realistic Slack-like conversations alongside their hidden internal thoughts. A dynamic World State engine tracks budget, deadlines, and reputation, while a Decision Engine manages team proposals with hierarchy-weighted voting.
Quick Start
Get your first simulation running in under 5 minutes. Follow these steps:
Sign In or Register
Create an account with email/password or sign in with Google OAuth. You start with 10 free simulation credits. Admin users have unlimited credits.
Configure Your Company
Navigate to the Setup page and define your company name, culture, and context. Optionally upload a document (PDF, DOCX, Excel) for AI-powered requirement extraction and crisis suggestions.
Assemble Your Team
Choose from 4 preset agent personas (Alex, Sam, Jordan, Casey) or create fully custom agents with unique personality traits, motivations, expertise, and per-agent LLM model overrides. Up to 8 agents per simulation.
Inject a Crisis
Select a pre-built scenario, use the AI Auto-Generate button for a tailored crisis based on your company profile, or write your own custom crisis event.
Start & Observe
Hit 'Launch Simulation' and watch your AI team react in a live Slack-like interface. Use God Mode to intervene in real-time. Random events may inject additional chaos mid-simulation.
Architecture
TeamDynamics is built on a modern stack designed for real-time AI interactions with persistent state:
┌──────────────────────────────────────────────────────────────┐
│ Next.js Frontend │
│ ┌─────────┐ ┌──────────┐ ┌──────────┐ ┌────────────┐ │
│ │ Login / │ │ Setup │ │Simulation│ │ Report / │ │
│ │Register │ │ Page │ │ Page │ │ Dashboard │ │
│ └────┬────┘ └─────┬────┘ └─────┬─────┘ └──────┬─────┘ │
│ │ Auth Context (JWT) │ WebSocket │ REST API │ │
└───────┼──────────────────────┼─────────────┼────────────┘ │
│ │ │ │
┌───────┼──────────────────────┼─────────────┼───────────────┐
│ ▼ FastAPI Backend ▼ ▼ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Auth Router ─── Simulation Router │ │
│ │ Agent Router ── Document Router │ │
│ │ WebSocket Router (Background Tasks) │ │
│ ├─────────────────────────────────────────────────────┤ │
│ │ Simulation Engine (Orchestrator) │ │
│ ├──────────┬──────────┬──────────┬───────────────────┤ │
│ │ Agent 1 │ Agent 2 │ Agent N │ Per-Agent LLM │ │
│ │ (LLM) │ (LLM) │ (LLM) │ Model Override │ │
│ ├──────────┴──────────┴──────────┴───────────────────┤ │
│ │ Personality-Weighted State Machine │ │
│ │ (Morale, Stress, Loyalty, Productivity) │ │
│ ├────────────────────────────────────────────────────┤ │
│ │ Decision Engine │ World State │ Round Agenda │ │
│ │ (Proposals, │ (Budget, │ (5 Phases, │ │
│ │ Voting, │ Deadline, │ Crisis-aware │ │
│ │ Hierarchy) │ Reputation) │ Modifiers) │ │
│ ├────────────────────────────────────────────────────┤ │
│ │ Hidden Agendas │ Random Events │ Agent Memory │ │
│ └────────────────────────────────────────────────────┘ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ PostgreSQL (asyncpg) │ Report Generator (LLM) │ │
│ └────────────────────────────────────────────────────┘ │
└───────────────────────────────────────────────────────────┘Authentication System
TeamDynamics supports two authentication methods for user accounts. Authentication is optional for simulation access but required for credit tracking and simulation history.
Credits & Roles
Every new user receives 10 simulation credits. Each simulation launch consumes 1 credit. Admin users (configured via ADMIN_EMAIL environment variable) have unlimited credits.
| Role | Credits | Capabilities |
|---|---|---|
| User | 10 (default) | Create simulations, view reports, manage profile |
| Admin | Unlimited | All user capabilities + unlimited simulations |
AI Agents
Each agent in TeamDynamics is a fully autonomous AI entity powered by a large language model. Agents have persistent memory, emotional states, hidden agendas, and evolving relationships with other team members. State changes are personality-weighted — agents with different traits absorb stress, morale hits, and bonuses differently.
Agent Properties
| Property | Type | Description |
|---|---|---|
| name | string | Agent display name |
| role | string | Job title (e.g., "Tech Lead", "Junior Dev") |
| type | string | Archetype label (e.g., "Strict & Burned Out") |
| personality | PersonalityTraits | Deep psychological profile object (5 traits) |
| motivation | string? | Hidden career motivation driving behavior |
| expertise | string? | Domain expertise area |
| model | string? | Per-agent LLM model override |
| morale | number (0-100) | Current emotional well-being |
| stress | number (0-100) | Current stress/burnout level |
| loyalty | number (0-100) | Commitment to the company |
| productivity | number (0-100) | Current output efficiency |
| memory | MemoryEntry[] | Persistent memory across rounds (last 8 entries) |
| has_resigned | boolean | Whether the agent has quit |
Personality-Weighted State Machine
State changes are not applied equally to all agents. Each personality trait creates multipliers that modulate how agents absorb changes:
| Trait | Effect | Range |
|---|---|---|
| Stress Tolerance | High tolerance → absorbs less stress | 0.4x – 1.6x |
| Empathy + Agreeableness | High → morale drops less from negativity, gains more from positivity | 0.7x – 1.3x |
| Ambition | High ambition → productivity drops less | 0.5x – 1.2x |
| Agreeableness + Assertiveness | High agreeableness + low assertiveness → loyalty more stable | 0.6x – 1.4x |
Persona Design
Personas define how agents think, communicate, and react to stress. TeamDynamics ships with 4 curated presets, but you can design fully custom personas with up to 8 agents per simulation.
Crisis Injection
Crisis events are the catalysts that trigger agent reactions. They simulate real-world disruptions that test team resilience. Each crisis also initializes a unique World State with appropriate constraints.
Built-in Crisis Scenarios
Document Upload & AI Analysis
Upload documents (PDF, DOCX, TXT, CSV, Excel — max 10MB) for AI-powered analysis. The system extracts text and produces:
- Document summary and key requirements
- Team risk identification
- Suggested crisis scenario tailored to the document content
- Suggested agent roles and rationale
- Actionable insights for simulation setup
Simulation Flow
Once configured, the simulation runs as a background task that survives WebSocket disconnects — clients can reconnect and resume viewing. Each round, agents process the current situation, update their internal states, and produce public messages, private thoughts, actions, and memory updates.
Round Lifecycle
Round Start
│
├─→ World State tick (deadline approaches, budget burns, debt creeps)
│
├─→ Phase transition check (broadcast phase shift announcement)
│
├─→ Roll for Random Event (may inject chaos)
│
├─→ Each agent processes (sequentially):
│ ├── Typing indicator broadcast
│ ├── Reviews personality, memory, hidden agenda
│ ├── Reads World State constraints & round agenda
│ ├── Evaluates hierarchy position & decision context
│ ├── Generates via LLM (per-agent model override)
│ └── Produces: public_message, internal_thought,
│ state_changes, memory_update, action, action_detail
│
├─→ Apply personality-weighted state changes
├─→ Process action through Decision Engine (proposals/votes/consequences)
├─→ Check for critical events (resignation, burnout)
├─→ Apply resignation effects to World State
│
├─→ God Mode check: Player can intervene via WebSocket
│
└─→ Record metrics snapshot → Check end conditions → Next Round
└─→ If final round or all resigned → Determine OutcomeMessage Types
Simulation Phases & Round Agenda
Each simulation progresses through 5 distinct phases based on round progression. Phases define the purpose of each round so conversations drive toward concrete decisions rather than aimless discussion.
The crisis just hit. Agents react emotionally and assess the damage.
Tone: Reactive, emotional, uncertain
Agents propose competing solutions and argue their merits.
Tone: Argumentative, strategic
The team must converge on a decision. Fence-sitters must pick a side.
Tone: Decisive, urgent
The team executes their decision and deals with consequences.
Tone: Focused, stressed
The crisis nears resolution. Agents reflect and decide their future.
Tone: Reflective, honest
World State Engine
The World State provides concrete, measurable constraints that ground agent decisions in reality. Agents reference these numbers when proposing solutions — no proposing hiring if budget is below 30%.
| Metric | Type | Per-Round Decay | Affected By |
|---|---|---|---|
| Budget Remaining | 0–100% | −2% / round | Actions, events, decisions |
| Deadline (Weeks Left) | countdown | −1 / round | Time only |
| Team Capacity | 0–100% | None | Resignations, rally actions |
| Customer Satisfaction | 0–100% | None | Events, transparency, blame |
| Technical Debt | 0–100% | +1% / round | Rushed decisions, alarms |
| Company Reputation | 0–100% | None | Media, events, decisions |
Decision Engine
The Decision Engine tracks proposals, votes, and team consensus using a hierarchy-weighted influence system. A proposal needs 3.0+ weighted influence to pass as a team decision.
Power Hierarchy
| Level | Roles | Influence Weight |
|---|---|---|
| C-Suite | CEO, CTO, CFO, COO | 3.0 |
| VP / Director | VP, Vice President, Director | 2.5 |
| Lead / Manager | Lead, Manager, Head, Principal | 2.0 |
| Senior | Senior, Staff, Architect | 1.5 |
| Individual Contributor | Default level | 1.0 |
| Junior | Junior, Intern, Associate, Entry | 0.7 |
Available Agent Actions
propose_solutionPropose a concrete solution to the crisissupport_proposalSupport another team member's proposaloppose_proposalDisagree with a proposal and explain whynegotiateSeek a compromise between competing proposalsescalateEscalate the issue to management/leadershiprally_teamBoost team morale and unityblamePoint fingers at who caused the problemresign_threatThreaten or hint at resignationreport_progressReport on progress of the current planraise_alarmSound alarm that something is going wrongHidden Agendas
Every agent has a secret hidden agenda that colors their decisions without other agents knowing. Preset agents have curated agendas, while custom agents receive randomly assigned ones.
“Secretly angling for a VP promotion. Prefers solutions that showcase their leadership, subtly undermines proposals that would make others the hero.”
“Secretly interviewing at other companies. Wants visible, impressive tasks for resume-building. Avoids grunt work.”
“Secretly promised a customer an impossible timeline. Steers conversations away from customer commitments.”
“Wants to stay under the radar and go home at 5pm. Resists any proposal that increases their workload.”
Random Events
Random events inject unpredictability into the simulation. Each round, there's a chance (8-15% per event) that an unexpected event fires. Events affect the World State and all active agents' morale/stress.
Negative Events
- • Key Client Threatens to Leave
- • Competitor Poaching Attempt
- • Additional Budget Cuts
- • Minor Security Incident
- • Negative Press Coverage
Positive Events
- • Investor Shows Renewed Confidence
- • Major Customer Sends Praise
- • Positive Media Coverage
- • Critical Resource Discovered
Mixed Events
- • Emergency Board Meeting Called
- • New Industry Regulation
God Mode
During any active simulation, you have access to God Mode—a powerful intervention system that lets you alter the course of the simulation in real-time. Interventions are personality-weighted — cynical agents (low agreeableness) benefit less from positive interventions.
Quick Actions
Simulation Outcomes
When a simulation ends (final round reached or all agents resign), the engine determines one of 6 possible outcomes based on agent states, decision status, and world health:
High morale, no resignations, decision reached, healthy world.
Decision reached through debate, acceptable state.
Crisis addressed, but at significant human cost.
>50% resigned or avg morale <20%. Deep fault lines exposed.
All agents resigned or burned out. No team left.
No proposals made, team talked in circles while crisis deepened.
Metrics & Tracking
During a simulation, the dashboard tracks key organizational health metrics in real-time with timeline history:
| Metric | Range | Critical Threshold | Impact |
|---|---|---|---|
| Morale | 0-100% | < 30% | Agent may resign or become uncooperative |
| Stress | 0-100% | > 80% | Output quality drops, burnout threshold hit |
| Loyalty | 0-100% | < 20% | Agent begins job-hunting behavior |
| Productivity | 0-100% | < 40% | Deadlines will be missed |
| Team Cohesion | 0-100% | < 30% | Composite of loyalty, morale, and alignment |
Post-Simulation Reports
After a simulation completes, TeamDynamics generates a comprehensive AI-powered report including:
- Executive Summary with key findings and critical alerts
- Simulation Overview — detailed objective and scenario description
- Structured Key Metrics (total agents, active, resignations, averages)
- In-depth Analysis Insights — AI-generated paragraph analyzing patterns
- Agent Resiliency Profiles showing start vs. end states with status labels
- Conclusion — final summary and risk assessment
- Timeline visualization (morale, stress, output per round)
- Actionable Recommendations — 3-5 AI-generated management actions
- Exportable to PDF for stakeholder sharing
AI Insights
The AI engine analyzes simulation data to produce actionable recommendations. These insights help leaders understand what went wrong and how to prevent similar outcomes.
API Endpoints
The TeamDynamics backend exposes a RESTful API with WebSocket support. All endpoints return JSON. Authentication uses Bearer JWT tokens.
Authentication
/api/auth/registerRegister a new user with email, name, and password.
/api/auth/loginLogin with email and password. Returns JWT token and user profile.
/api/auth/googleAuthenticate with Google OAuth credential. Auto-creates user if new.
/api/auth/meGet current user profile (requires Bearer token).
/api/auth/me/simulationsGet all simulations for the authenticated user.
Simulation
/api/simulation/createCreate a new simulation with company profile, agents, crisis config, and params. Deducts 1 credit.
/api/simulation/generate-crisisAI-generate a tailored crisis based on company name and culture.
/api/simulation/{id}/statusGet current simulation status, round, agents, messages, and metrics.
/api/simulation/{id}/interveneSend a God Mode intervention (bonus, pizza, cancel_overtime, custom).
/api/simulation/{id}/reportGenerate and retrieve the full post-simulation report with AI insights.
Other Endpoints
/api/agents/presetsList all 4 available preset agent personas.
/api/document/analyzeUpload a document (multipart) for AI-powered analysis. Max 10MB.
/healthHealth check — returns service status, version, and LLM provider.
/ws/simulation/{id}WebSocket for real-time simulation streaming. Supports interventions via JSON messages.
Data Models
Core data structures used across the TeamDynamics system:
interface CreateSimulationRequest {
company: {
name: string; // 1-100 chars
culture: string; // 1-1000 chars
};
agents: {
id: string;
name: string;
role: string;
type: string; // e.g. "Strict & Burned Out"
color?: string;
personality: {
empathy: number; // 0-100
ambition: number; // 0-100
stressTolerance: number; // 0-100
agreeableness: number; // 0-100
assertiveness: number; // 0-100
};
motivation?: string; // Career motivation text
expertise?: string; // Domain expertise area
model?: string; // Per-agent LLM model override
}[];
crisis: {
scenario: "rnd1" | "rnd2" | "rnd3" | "rnd4" | "custom";
custom_description?: string;
};
params: {
duration_weeks: number; // 1-52 (default: 12)
pacing: "slow" | "normal" | "fast";
};
}// Sent on each agent message during simulation
interface WebSocketPayload {
type: "init" | "message" | "completed" | "error" | "typing_start";
data?: { // Agent message data
id: number;
round: number;
agent_id: string;
agent_name: string;
type: "public" | "thought" | "system";
content: string;
thought?: string; // Internal thought (hidden insight)
state_changes?: {
morale?: number; // Delta (e.g., -5, +10)
stress?: number;
loyalty?: number;
productivity?: number;
};
timestamp: string;
};
agents: AgentState[]; // Updated agent states
metrics: {
avgMorale: number;
avgStress: number;
productivity: number;
resignations: number;
avgLoyalty: number;
teamCohesion: number; // Composite metric
};
worldState?: { // Dynamic world constraints
budgetRemaining: number;
customerSatisfaction: number;
companyReputation: number;
teamCapacity: number;
technicalDebt: number;
deadlineWeeksLeft: number;
};
decisionStatus?: { // Decision engine state
proposalCount: number;
hasDecision: boolean;
decidedProposal?: string;
leadingProposal?: string;
leadingSupport: number;
escalationCount: number;
resignThreats: string[];
};
currentRound: number;
totalRounds: number;
status: "idle" | "running" | "completed";
metricsHistory?: { round: number; morale: number; stress: number;
productivity: number; loyalty: number; cohesion: number; }[];
}interface ReportResponse {
simulation_id: string;
company_name: string;
crisis_name: string;
total_rounds: number;
completed_rounds: number;
executive_summary: string; // AI-generated overview
critical_finding: string; // Most critical issue identified
simulation_overview: string; // Detailed scenario description
key_metrics: {
total_agents: number;
active_agents: number;
resignations: number;
avg_morale: number;
avg_stress: number;
avg_loyalty: number;
avg_productivity: number;
productivity_drop: number;
simulation_weeks: number;
total_planned_weeks: number;
};
analysis_insights: string; // In-depth analysis paragraph
conclusion: string; // Final summary
agent_reports: {
id: string;
name: string;
role: string;
starting_morale: number;
ending_morale: number;
peak_stress: number;
has_resigned: boolean;
resigned_week?: number;
status: "Failed" | "Critical" | "Stressed" | "Stable" | "Thriving";
status_label: string; // e.g., "Resigned • Week 9"
}[];
productivity_drop: number;
recommendations: string[]; // 3-5 AI-generated actions
timeline: { // Per-round metrics for charts
round: number;
morale: number;
stress: number;
output: number;
}[];
}ws://localhost:8000/ws/simulation/{id}. The simulation runs as a background task — disconnecting does NOT stop the simulation. Reconnect anytime to resume viewing.LLM_PROVIDER env variable: OpenAI (gpt-4o-mini, gpt-4o), Google Gemini (gemini-2.0-flash), and OpenRouter (any model including free options like Llama 3.1 8B).