Inspiration
Team formation is typically treated as a logistical or social task rather than an engineering problem. In classrooms and organizations, teams are often formed randomly or based on convenience, which can lead to personality clashes, skill redundancy, and inefficient collaboration. We realized that team formation is fundamentally a constrained optimization problem that requires reliable inputs and structured evaluation. However, most AI-based personality tools rely on single-pass outputs, which can be inconsistent due to the stochastic nature of large language models. If the input data is unstable, any optimization algorithm built on top of it becomes unreliable. This insight inspired us to design a system that validates personality stability before forming teams. TeamHarmony AI was created to bring engineering rigor, explainability, and mathematical structure to human collaboration.
What it does
TeamHarmony AI is a three-layer system that optimizes team formation using both generative AI and deterministic algorithms. First, it analyzes personality data from resumes, surveys, and audio using multi-run AI validation to ensure consistency. It produces a Stability Score, Confidence Level, and structured personality profile. Second, it evaluates team compatibility using a structured multi-agent model. Independent agents score role balance, skill overlap, communication risk, deadline stress resilience, and MBTI personality compatibility. Each dimension is evaluated separately to prevent any single AI judgment from dominating the result. Third, in Teacher Mode, the system models classrooms as weighted graphs, where students are nodes and compatibility scores are edges. It then performs balanced weighted graph clustering using a greedy initialization followed by local refinement to maximize overall compatibility across groups. This approach allows near-optimal team distribution without combinatorial explosion.
How we built it
We built the frontend using Next.js and React to create a modular, responsive interface with clearly separated modes for personality analysis, team evaluation, and teacher optimization. The backend is powered by Next.js API routes that act as a secure AI orchestration layer. All AI calls are handled server-side to maintain security and prevent client-side exposure of API keys. We used Supabase for our database, including PostgreSQL, authentication, and Row-Level Security to ensure structured and secure data storage. For generative AI, we implemented the Google Gemini API for personality inference, MBTI estimation, structured text analysis, and embedding generation. We built a custom multi-run consistency validation layer to measure agreement across multiple AI outputs before accepting results. Additionally, we used ElevenLabs in order to transfer audio into data we could use to help determine personalities. Finally, we implemented a deterministic graph clustering algorithm with greedy grouping and local swap refinement to solve the classroom team optimization problem efficiently in polynomial time.
Challenges we ran into
AI Inconsistency LLMs are stochastic. The same input can produce slightly different outputs. This directly threatens compatibility modeling.
Combinatorial Explosion Teacher grouping is an NP-hard problem. Brute-force search becomes infeasible even at moderate classroom sizes.
Latency Issue with Personality Stability Layer - Optimization : Parallelization — All 6 agent calls (3 trait + 3 MBTI) now run simultaneously instead of two sequential batches. Also disabled Gemini's "thinking" mode (thinkingBudget: 0) which adds significant latency. Expected improvement: ~30s → ~8-12s.
Accomplishments that we're proud of
We are proud of designing and implementing a true three-layer architecture that combines generative AI with deterministic optimization. Instead of building a simple prompt-based application, we engineered a stability-aware system that validates AI outputs before using them in mathematical models. We successfully created a scalable team optimization algorithm capable of handling 100+ students efficiently. We also maintained clean separation of concerns between frontend, AI orchestration, and optimization logic. Most importantly, we built a system that prioritizes explainability and engineering integrity rather than relying on black-box scoring.
What we learned
Through this project, we learned that AI outputs should be validated before they are optimized. Stability and consistency are more important than simply increasing model sophistication. We learned that multi-agent systems reduce bias and increase robustness compared to single-model decision making. We also learned that combining generative AI with deterministic algorithms produces more reliable and scalable systems than relying purely on generative outputs. Finally, we learned that human collaboration can be treated as an engineering problem when approached with the right mathematical and architectural mindset.
What's next for TeamHarmony AI
In the future, we plan to transition from structured JSON scoring to high-dimensional vector embeddings for more nuanced compatibility modeling. We also aim to integrate explicit fairness and diversity constraints directly into our graph partitioning algorithm. We plan to implement hierarchical clustering methods to scale to larger classrooms beyond current context window limitations. Additionally, we want to conduct real-world validation studies to measure predicted compatibility against actual team performance outcomes. Long-term, we envision expanding beyond classrooms into startup accelerators, hackathons, and corporate environments where team formation quality directly impacts success.
Built With
- algorithms
- authentication
- clustering
- deterministic
- elevenlabs
- gemini
- graph
- greedy
- llm
- next.js
- orchestration
- supabase
Log in or sign up for Devpost to join the conversation.