Skip to content

LaunchpadAI/Launchpad-TinyTroupe

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

87 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TinyTroupe Nx Monorepo

A production-ready monorepo for TinyTroupe with FastAPI backend and Next.js frontend for AI agent simulations and market research.

πŸ—οΈ Project Structure

TinyTroupe-Monorepo/
β”œβ”€β”€ apps/                           # Applications
β”‚   β”œβ”€β”€ api/                       # FastAPI TinyTroupe service
β”‚   └── web/                       # Next.js testing frontend
β”œβ”€β”€ libs/                          # Shared libraries
β”‚   β”œβ”€β”€ tinytroupe-core/          # Core TinyTroupe library (symlinked)
β”‚   └── api-client/               # TypeScript API client
β”œβ”€β”€ packages/                      # Legacy packages and original source
β”‚   └── tinytroupe-original/      # Original TinyTroupe codebase
β”‚       β”œβ”€β”€ examples/             # Agent configs, fragments, populations
β”‚       β”œβ”€β”€ docs/                 # Original documentation
β”‚       β”œβ”€β”€ tests/                # Original test suite
β”‚       └── tinytroupe/           # Original Python package
β”œβ”€β”€ tools/                         # Development utilities
β”‚   └── scripts/                  # Development scripts
└── dev_docs/                      # Development documentation

βœ… Production Status

TinyTroupe API v1.0 - PRODUCTION READY

  • βœ… 100% Functional - All core TinyTroupe capabilities implemented
  • βœ… Session Isolation - Concurrent simulations with isolated caches
  • βœ… Results Extraction - Statistical analysis and insights extraction
  • βœ… Agent Management - Conflict-free agent loading with unique instances
  • βœ… Full Compatibility - Mirrors TinyTroupe notebook patterns exactly

Successfully Tested:

  • Focus group simulations with results extraction
  • Individual agent interactions
  • Population generation and demographic sampling
  • Concurrent multi-session execution
  • Agent specification loading and management

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Python 3.8+
  • OpenAI API key

Setup

  1. Install dependencies:
npm install
  1. Configure API environment:
cp apps/api/.env.example apps/api/.env
# Edit apps/api/.env with your OpenAI API key
  1. Install Python dependencies:
cd apps/api && pip install -r requirements.txt && cd ../..
  1. Start development environment:
# Option 1: Use convenience script
./tools/scripts/start-dev.sh

# Option 2: Start services manually
nx run-many --target=serve --projects=api,web --parallel
  1. Access applications:

🎯 What You Can Test

The system provides comprehensive testing capabilities for TinyTroupe functionality:

API Testing Interface (Frontend)

  • Persona Management: Load agents, create demographic samples, apply fragments
  • Market Research: Product evaluation, consumer insights, brainstorming
  • Simulations: Focus groups, individual interactions, social simulations
  • Content Enhancement: AI-powered content enrichment and styling
  • Document Creation: TinyWordProcessor integration
  • Real-time API monitoring: Health checks and response inspection

Production Features

  • Session Isolation: Each simulation gets its own cache and agent instances
  • Concurrent Simulations: Multiple users can run simulations simultaneously
  • Results Analytics: Statistical analysis, sentiment distribution, insights extraction
  • Agent Specifications: Load from 3 pre-configured personas (Lisa, Oscar, Marcos)
  • Population Generation: Bulk generate up to 1000 agents with demographic controls

πŸ§ͺ Development

Key Commands

# Start both API and web app
nx run-many --target=serve --projects=api,web --parallel

# Build everything
nx run-many --target=build --projects=api,web

# Run tests
nx run-many --target=test --projects=api,web

# Start individual services
nx serve api        # Just the API
nx serve web        # Just the frontend

API Development

  • Modify /apps/api/main.py for API changes
  • Configuration in /apps/api/.env
  • Auto-reload enabled for development

Frontend Development

  • Pages in /apps/web/src/app/
  • Uses TypeScript API client from /libs/api-client/
  • Hot reload enabled

πŸ“– Documentation

🏭 Architecture

TinyTroupe API v1.0 (Production Ready)

  • FastAPI Backend: Clean modular architecture following DRY/SRP principles
  • Session Management: Isolated caches per simulation (cache/sessions/sim_<uuid>.json)
  • Agent Management: Unique agent instances per session to prevent conflicts
  • Results Processing: Full TinyTroupe pattern compatibility with statistical analysis
  • Concurrent Support: Multiple users can run simulations simultaneously

Monorepo Structure

This monorepo uses Nx to manage:

  • Multi-language support: Python (FastAPI) + TypeScript (Next.js)
  • Shared libraries: TypeScript API client with type safety
  • Development workflow: Unified commands for all services
  • Code organization: Clean separation between apps and libraries

The original TinyTroupe codebase is preserved in packages/tinytroupe-original/ for reference and to maintain access to examples, tests, and documentation.

API Architecture

apps/api/src/
β”œβ”€β”€ models/          # Pydantic schemas organized by domain
β”œβ”€β”€ services/        # Business logic layer
β”œβ”€β”€ routers/         # API endpoint handlers  
β”œβ”€β”€ core/            # Core infrastructure (config, dependencies)
└── utils/           # Utilities (logging, error handling)

πŸš€ Production Features

Available APIs

  • Persona Management: Load agents, create demographic samples, apply personality fragments
  • Market Research: Product evaluation, advertisement testing, brainstorming sessions
  • Simulations: Focus groups, individual interactions, social simulations
  • Content Enhancement: AI-powered content enrichment and styling
  • Document Creation: TinyWordProcessor integration for document generation
  • Population Generation: Bulk generate up to 1000 agents with demographic controls
  • Research Tools: Customer interviews, competitive analysis, consumer insights

Session Management & Caching

cache/sessions/sim_<uuid>.json  # Isolated per simulation
agents: Lisa Carter_a1b2c3d4    # Unique names per session

Concurrency Support: Multiple users can run simulations simultaneously without conflicts. Cache Cleanup: Session caches are automatically managed and can be cleaned up via the cache service.

πŸ”§ Next Steps

  1. βœ… API is Production Ready - All core functionality working
  2. Extend frontend workflow builder features
  3. Add advanced analytics and reporting
  4. Implement real-time monitoring dashboard
  5. Deploy to production environment

Built with ❀️ using FastAPI, Next.js, and TinyTroupe
Purpose: Production-ready AI agent simulation platform for market research and consumer insights.

About

LLM-powered multiagent persona simulation for imagination enhancement and business insights.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Jupyter Notebook 95.1%
  • HTML 2.9%
  • Python 1.6%
  • TypeScript 0.3%
  • Mustache 0.1%
  • Shell 0.0%