Skip to content
redhatpandaPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

110 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Renben MACs - Multi-Agent Consulting Intelligence

A production-grade MVP for an AI-powered consulting system that ingests enterprise documents, indexes them for RAG (Retrieval-Augmented Generation), and runs coordinated agents to produce comprehensive consulting reports with source citations.

๐Ÿš€ Features

  • Document Processing: Upload and parse PDF/DOCX files with automatic chunking and embedding
  • Multi-Agent System: Coordinated Strategy and Research agents using LangGraph
  • RAG-Powered Analysis: Semantic search across document chunks using pgvector
  • Report Generation: Automated consulting reports in Markdown and PDF formats
  • Blackboard Pattern: Shared knowledge base for agent coordination
  • Source Citations: Automatic citation generation with document references
  • Modern UI: Clean, responsive interface built with Next.js and shadcn/ui

๐Ÿ›  Tech Stack

  • Frontend: Next.js 15 (App Router) + TypeScript + Tailwind CSS + shadcn/ui
  • Backend: Next.js Route Handlers + Node.js 20
  • Agents/Orchestration: LangGraph with blackboard pattern
  • LLM Provider: OpenAI SDK (with provider abstraction)
  • Database: PostgreSQL + Prisma + pgvector for embeddings
  • Document Parsing: pdf-parse, docx libraries
  • PDF Generation: md-to-pdf for server-side rendering
  • Development: Docker + docker-compose, ESLint, Prettier, Vitest

๐Ÿ“‹ Prerequisites

  • Node.js 20+
  • pnpm (recommended) or npm
  • Docker and Docker Compose
  • OpenAI API key

๐Ÿš€ Quick Start

1. Clone and Setup

git clone <repository-url>
cd renben-maci
cp env.example .env

2. Configure Environment

Edit .env with your configuration:

DATABASE_URL="postgres://postgres:postgres@localhost:5432/maci"
OPENAI_API_KEY="your_openai_api_key_here"
NEXTAUTH_SECRET="your_nextauth_secret_here"
NEXTAUTH_URL="http://localhost:3000"
NODE_ENV="development"

3. Start Database

docker-compose up -d

This starts:

4. Install Dependencies

pnpm install

5. Setup Database

pnpm prisma generate
pnpm prisma db push
pnpm db:seed

6. Start Development Server

pnpm dev

Visit http://localhost:3000 to access the application.

๐ŸŽฏ Demo Scenario

Run the end-to-end demo:

pnpm demo

This will:

  1. Use the seeded sample project
  2. Start an orchestrator run with a sample brief
  3. Generate a consulting report with citations
  4. Show progress in the web interface

๐Ÿ“ Project Structure

/app
  /api                    # Next.js API routes
    /projects            # Project management endpoints
    /projects/[id]       # Project-specific operations
  /(dashboard)           # Dashboard pages
    /page.tsx           # Projects list
    /projects/[id]      # Project workspace
/components              # React components
  /ui                   # shadcn/ui components
  FileUploader.tsx      # Document upload component
  ProjectCard.tsx       # Project display component
  RunConsole.tsx        # Agent run interface
  ActivityFeed.tsx      # Blackboard activity display
/lib                    # Core libraries
  /agents              # Strategy and Research agents
  /graph               # LangGraph orchestrator
  db.ts                # Database connection
  embeddings.ts        # OpenAI embeddings service
  rag.ts              # RAG search functionality
  chunker.ts          # Text chunking utilities
  pdf.ts              # PDF parsing
  docx.ts             # DOCX parsing
  pdf-renderer.ts     # Markdown to PDF conversion
  blackboard.ts       # Blackboard pattern implementation
  citations.ts        # Citation management
/prisma                # Database schema and migrations
/scripts               # Utility scripts
  seed.ts             # Database seeding
  demo.ts             # Demo scenario
  init-pgvector.sql   # PostgreSQL extension setup

๐Ÿ”ง API Endpoints

Projects

  • GET /api/projects - List all projects
  • POST /api/projects - Create new project
  • GET /api/projects/[id] - Get project details
  • PUT /api/projects/[id] - Update project
  • DELETE /api/projects/[id] - Delete project

Documents

  • POST /api/projects/[id]/upload - Upload documents (multipart)

Runs

  • GET /api/projects/[id]/runs - List project runs
  • POST /api/projects/[id]/runs - Start new run
  • GET /api/projects/[id]/runs/[runId] - Get run details

Reports

  • GET /api/projects/[id]/runs/[runId]/report.md - Download Markdown report
  • GET /api/projects/[id]/runs/[runId]/report.pdf - Download PDF report

๐Ÿค– Agent System

Research Agent

  • Performs RAG searches across document chunks
  • Generates research summaries with confidence scores
  • Creates structured findings for the blackboard

Strategy Agent

  • Drafts report sections based on research findings
  • Generates strategic hypotheses
  • Assembles final reports with citations

Orchestrator (LangGraph)

  • Coordinates agent activities using blackboard pattern
  • Manages run lifecycle and error handling
  • Generates progress updates and logging

๐Ÿ“Š Database Schema

Core Models

  • User - System users
  • Project - Consulting projects
  • Document - Uploaded files with processing status
  • DocumentChunk - Text chunks with embeddings (pgvector)
  • Run - Agent execution runs
  • BlackboardNote - Agent communication and findings
  • Citation - Source references in reports

๐ŸŽจ UI Components

Built with shadcn/ui for consistency and accessibility:

  • Responsive design with Tailwind CSS
  • Dark/light mode support
  • Real-time progress indicators
  • Drag-and-drop file uploads
  • Interactive activity feeds

๐Ÿ” Development

Available Scripts

pnpm dev          # Start development server
pnpm build        # Build for production
pnpm start        # Start production server
pnpm lint         # Run ESLint
pnpm format       # Format with Prettier
pnpm test         # Run tests with Vitest
pnpm db:push      # Push schema to database
pnpm db:studio    # Open Prisma Studio
pnpm db:seed      # Seed database with sample data
pnpm demo         # Run end-to-end demo

Code Quality

  • ESLint for linting
  • Prettier for formatting
  • TypeScript for type safety
  • Vitest for testing

๐Ÿš€ Deployment

Docker Production Build

docker build -t renben-maci .
docker run -p 3000:3000 renben-maci

Environment Variables for Production

DATABASE_URL="postgres://user:pass@host:5432/maci"
OPENAI_API_KEY="your_production_key"
NEXTAUTH_SECRET="secure_random_string"
NEXTAUTH_URL="https://your-domain.com"
NODE_ENV="production"

๐Ÿ”ฎ Future Enhancements

Planned Features

  • Authentication: NextAuth with multiple providers
  • File Storage: Azure Blob Storage integration
  • Real-time Updates: WebSocket/SSE for live progress
  • Advanced Parsing: Better DOCX support, image extraction
  • Multi-language: Support for non-English documents
  • Collaboration: Multi-user project sharing
  • Analytics: Usage tracking and performance metrics

Infrastructure

  • Azure Container Apps: Serverless deployment
  • Azure Database: Managed PostgreSQL with pgvector
  • Azure Storage: Blob storage for documents
  • Azure Monitor: Application insights and logging

๐Ÿ› Troubleshooting

Common Issues

  1. Database Connection Failed

    docker-compose down
    docker-compose up -d
    pnpm prisma db push
  2. OpenAI API Errors

    • Verify API key in .env
    • Check API quota and billing
  3. PDF Generation Fails

    • Ensure md-to-pdf dependencies are installed
    • Check file permissions in /data directory
  4. Embeddings Not Working

    • Verify pgvector extension is installed
    • Check OpenAI API key and quota

Logs

Check application logs:

pnpm dev  # Shows logs in terminal

Database logs:

docker-compose logs postgres

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

๐Ÿ“ž Support

For questions or issues:

  • Create an issue in the repository
  • Check the troubleshooting section
  • Review the API documentation

Renben MACs - Empowering consulting with AI-driven intelligence.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages