Index

Elsewhere

Project / 013Case study

Boardroom Simulator: A Multi-Agent Negotiation Engine

Simulated boardroom meetings where a deterministic behavior engine decides who speaks and why, and an LLM only turns that decision into dialogue.

  • AI systems
  • Experiments
Status
Prototype
Role
Sole developer
Year
2026
Language
Python
Platform
Web
Reading
5 min
Stack
  • FastAPI
  • Next.js
  • PostgreSQL
  • Prisma
  • Redis
  • RQ
  • Chroma
  • Neo4j
  • OpenRouter
  • LangSmith
  • d3
  • Recharts
  • react-force-graph-2d
  • GSAP
Boardroom Simulator: A Multi-Agent Negotiation Engine cover
Boardroom Simulator: behavior engine, language engine, turn

The problem

When you let several LLM agents talk, the conversation drifts: everyone is agreeable, nobody holds a position and the outcome is arbitrary. I wanted to simulate negotiation where positions, trust and pressure are explicit state, so a meeting can be replayed, measured and argued with.

The system

10 components · 10 connections · 2 request flows

A FastAPI service advances each meeting turn. The Behavior Engine updates social state and bids for the floor, then the Language Engine asks an LLM to voice the chosen move. Sessions are stored in PostgreSQL and streamed to the UI.

System map

Follow a request
  • Client
  • Worker
  • Service
  • Data store
  • Queue / stream
  • External service
  • Trust boundary

Select a component to see its role, the technology behind it and what it connects to, or follow a request through the system hop by hop.

Start at
Component reference10 components · 2 flows · as text

Components · in request order

Client · layer 01Meeting UI
Watch, steer and replay a meeting
Graphs of trust and tension, relationship network and timeline views.
TechNext.js, d3, Recharts, react-force-graph-2d, GSAP
ToSimulation API (start, steer, stream)
Worker · layer 01Eval harness
Replays scenarios and scores them
Invariant checks, metrics, an LLM judge and 12 scenarios with recordings.
TechPython
ToSimulation API (replay scenarios)
Service · layer 02Simulation API
Sessions, turns, streaming and replay
Streams turns over SSE and exposes replay, export, inject and postmortem endpoints.
TechFastAPI, SSE
FromMeeting UI (start, steer, stream); Eval harness (replay scenarios)
ToBehavior Engine (advance a turn); Session store (persist sessions); Job queue (background jobs); Knowledge store (retrieve context)
Worker · layer 03Behavior Engine
Deterministic social state
Relationship matrix, social physics, emotions and strategic plans updated by rules, not by the model.
TechPython
FromSimulation API (advance a turn)
ToUrgency bidding (candidate speakers)
InsideBehavior and language engines
Data store · layer 03Session store
Meetings, personas and recordings
TechPostgreSQL, Prisma
FromSimulation API (persist sessions)
Queue / stream · layer 03Job queue
Background jobs
TechRedis, RQ
FromSimulation API (background jobs)
Data store · layer 03Knowledge store
Retrieval for scenario context
TechChroma
FromSimulation API (retrieve context)
Worker · layer 04Urgency bidding
Decides who speaks next
60 percent formula, 40 percent LLM urgency score with a 2.5 second timeout.
TechPython
FromBehavior Engine (candidate speakers)
ToLLM provider (urgency score); Language Engine (chosen speaker and move)
InsideBehavior and language engines
Worker · layer 05Language Engine
Turns a decision into dialogue
TechPython, Prompting
FromUrgency bidding (chosen speaker and move)
ToLLM provider (voice the move)
InsideBehavior and language engines
External service · layer 06LLM provider
Urgency scores and spoken lines
Traced with LangSmith.
TechOpenRouter, LangSmith
FromUrgency bidding (urgency score); Language Engine (voice the move)

Request flows

  1. One meeting turn

    State is updated deterministically before any language is generated.

    1. Step 1: Meeting UI
    2. Step 2: Simulation API
    3. Step 3: Behavior Engine
    4. Step 4: Urgency bidding
    5. Step 5: Language Engine
    6. Step 6: LLM provider
  2. Evaluation run

    1. Step 1: Eval harness
    2. Step 2: Simulation API
    3. Step 3: Behavior Engine

Trust boundaries

  • Behavior and language engines — Behavior Engine, Urgency bidding, Language Engine

Decisions & trade-offs

5 decisions

  1. D01

    Separate behavior from language

    The v2 runtime is a deterministic Behavior Engine plus a Language Engine. State changes come from rules and numbers. The LLM only writes the words for a decision that was already made.

  2. D02

    Model social state explicitly

    Six layers of state: events, an NxN relationship matrix, social physics (trust, leverage, tension, dominance, credibility, momentum), emotions, strategic plans and a narrative layer.

  3. D03

    Hybrid urgency bidding

    Who speaks next is a blend of a formula (60 percent) and an LLM urgency score (40 percent) with a 2.5 second timeout, so a slow model cannot stall the room.

  4. D04

    Personas as archetypes

    Opportunist, idealist, diplomat, pragmatist, agitator and guardian give each seat a recognisable strategy rather than a random personality.

  5. D05

    Measure, do not eyeball

    An eval harness checks invariants and metrics over recorded scenarios and uses an LLM judge for the parts rules cannot score.

Outcomes

  • 23 seeded personas across 6 archetypes, with 12 evaluation scenarios.
  • Five ways a meeting can end: vote, explicit agreement, walkaway, consensus or timeout.
  • Replay, export, inject and postmortem endpoints, with an eval harness for invariants and an LLM judge.
  • MIT licensed.

RoleSole developer

View on GitHub

The write-up

5 min read

Put several LLM agents in a room and they politely agree with each other until the meeting ends. Boardroom Simulator is my attempt at making a meeting where positions, pressure and trust are real, measurable state.

The core idea: behavior first, language second

The current runtime splits the problem in two. A deterministic Behavior Engine decides what happens: who has leverage, who is tense, who wants the floor. A Language Engine then asks an LLM to voice that decision. The model never gets to quietly change the outcome.

Six layers of state

  1. Procedural. Events and meeting rules.

  2. Relationship. An NxN matrix of how every participant sees every other.

  3. Social physics. Trust, leverage, tension, dominance, credibility and momentum.

  4. Cognitive. Emotions such as anger, fear, joy, shame and surprise.

  5. Strategic. Plans and subgoals per participant.

  6. Narrative. The LLM layer that writes the dialogue.

Who speaks next

Speaking order uses hybrid urgency bidding: 60 percent from a formula and 40 percent from an LLM urgency score, with a 2.5 second timeout so a slow model cannot freeze the room.

Personas and endings

Six archetypes (opportunist, idealist, diplomat, pragmatist, agitator, guardian) back 23 seeded personas. A meeting can end in a vote, explicit agreement, a walkaway, consensus or a timeout.

Tooling around the engine

  • A FastAPI backend with SSE streaming, plus replay, export, inject and postmortem endpoints.

  • A Next.js frontend with d3, Recharts and react-force-graph-2d for trust and relationship views.

  • PostgreSQL with Prisma, Redis with RQ, optional Neo4j and a Chroma store for retrieval. Models run through OpenRouter and runs are traced with LangSmith.

  • An evaluation harness with invariants, metrics, an LLM judge and 12 scenarios with recordings.

Status

A working prototype under the MIT license. The older v1 design, a LangGraph StateGraph, is kept in the docs as history; the Behavior Engine is the current runtime.

Linked by shared domain, stack or language

  • Project / 012 · 2026

    AI Research Agent: Template-First Research Runs on LangGraph

    A LangGraph research agent that plans, fans out parallel retrieval, merges evidence and writes a versioned report, with a live run room to watch it happen.

    Shared:

    • AI systems
    • Python
    • FastAPI
    • OpenRouter
    • LangSmith
  • Project / 010 · 2026

    Building a Contract Review Agent with LLMs, pgvector, and a Dash of Production Regret

    How I wired Claude, FastAPI, and Postgres into a legal review pipeline — clause extraction, risk scoring, RAG-backed redlines, and the migration bug that silently broke production.

    Shared:

    • AI systems
    • Python
    • FastAPI
    • PostgreSQL
    • Next.js
  • Project / 009 · 2026

    DripOrSkip

    An AI outfit checker and digital closet. Upload a look, get a Drip or Skip verdict with fix-it suggestions, and see daily outfits matched to your weather and style.

    Shared:

    • AI systems
    • Next.js
    • OpenRouter

rk@request · simulated terminal