Skip to content

SheteUC/market-gap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MarketGap AI πŸš€

A simplified market research and gap analysis system powered by Letta's native multi-agent capabilities. MarketGap AI discovers untapped market opportunities by analyzing consulting firm white papers, social signals, and industry trends using a clean, Letta-native architecture.

🎯 Why Letta-Native?

This implementation follows Letta best practices exactly:

  • 🀝 Manager-Worker Pattern: Single Orchestrator Agent manages all worker agents
  • πŸ“ Shared Memory Blocks: All agents share state via Letta's native memory system
  • πŸ› οΈ Built-in Tools: Uses Letta's native multi-agent communication tools
  • πŸ”„ Exact Workflow: Follows the precise 8-step sequence from workspace rules
  • πŸ’Ύ Persistent State: All agent state persists automatically in Letta's database

πŸ—οΈ Simplified Architecture

graph TD
    A[Orchestrator Agent] --> B[Shared Memory Blocks]
    A --> C[Worker Agents Created On-Demand]
    
    B --> D[consulting_groups]
    B --> E[consulting_docs] 
    B --> F[gap_list]
    B --> G[audience_signals]
    B --> H[problem_queue]
    B --> I[user_feedback]
    B --> J[idea_history]
    B --> K[final_ideas]
    
    C --> L[Market Research]
    L --> |white-papers| E
    C --> N[Market Analyzer]
    N --> |gaps| F
    C --> M[Social Listener]
    M --> |signals| G
    C --> O[Solution Generator]
Loading

Shared Memory Blocks (Per Workspace Rules)

  • consulting_groups (100 KB) - CSV/JSON of consulting firms
  • consulting_docs (10 MB) - PDF chunks {tag, text}
  • gap_list (256 KB) - Market gaps {id, title, severity, summary}
  • audience_signals (5 MB) - Social signals {platform, author, text, sentiment}
  • problem_queue (64 KB) - Ordered gaps sent to UI
  • user_feedback (64 KB) - User feedback {problemId, action, notes}
  • idea_history (2 MB) - All brainstorming iterations
  • final_ideas (128 KB) - Approved novel ideas

Exact Workflow Sequence

  1. marketResearch (async) – crawl PDFs from consulting firms
  2. marketAnalyzer (wait) – produce gap_list
  3. socialListener (wait) – write combined audience & Google insights to audience_signals
  4. solutionGenerator (wait) – brainstorm first batch of ideas β†’ final_ideas
  5. (Competitor check skipped in demo)
  6. Emit workflow_complete and show ideas on dashboard

πŸ› οΈ Setup & Installation

Prerequisites

Installation

# Clone the repository
git clone <your-repo-url>
cd market-gap

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env.local
# Edit .env.local and add your LETTA_API_KEY

Environment Configuration

Create a .env.local file:

# Required: Letta Configuration
LETTA_API_KEY=your_letta_cloud_api_key_here
LETTA_BASE_URL=https://api.letta.com

πŸš€ Quick Start

Option 1: Web Interface

npm run dev
# Navigate to http://localhost:3000/workflow

Option 2: API Direct

# Start workflow
curl -X POST http://localhost:3000/api/letta-workflow \
  -H "Content-Type: application/json" \
  -d '{"action": "start", "industry": "FinTech"}'

# Check status
curl http://localhost:3000/api/letta-workflow?action=status

πŸ“ Project Structure

market-gap/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”œβ”€β”€ orchestrator/            # Manager agent
β”‚   β”‚   β”œβ”€β”€ marketResearch/          # Worker agents
β”‚   β”‚   β”œβ”€β”€ marketAnalyzer/
β”‚   β”‚   β”œβ”€β”€ socialListener/
β”‚   β”‚   β”œβ”€β”€ solutionGenerator/
β”‚   β”‚   └── competitorResearch/
β”‚   └── simple-orchestrator.ts    # Main Letta-native orchestrator
β”œβ”€β”€ components/                  # React UI components
β”œβ”€β”€ context/                     # React context
└── types/                       # TypeScript types
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── letta-workflow/         # Single API endpoint
β”‚   β”œβ”€β”€ workflow/                   # Dashboard page
β”‚   └── [other pages]/              # Additional UI pages
β”œβ”€β”€ README.md                        # This file
└── SIMPLIFIED_APPROACH.md          # Detailed documentation

πŸ§ͺ Testing

You can validate everything is wired up in two ways:

  1. Web UI – Run npm run dev and watch the workflow update live at http://localhost:3000/workflow.
  2. Direct API – Use the cURL commands in the Quick-Start section to start a workflow and poll for status.

No extra scripts are required.

πŸ”§ How It Works

Single Orchestrator Agent

  • Creates and manages all worker agents using Letta's built-in tools
  • Uses send_message_to_agent_async for non-blocking tasks
  • Uses send_message_to_agent_and_wait_for_reply for blocking steps
  • Maintains workflow state in shared memory blocks

Shared Memory System

  • All agents access the same memory blocks
  • Memory persists automatically across sessions
  • Follows exact memory block structure from workspace rules
  • 10 MB block cap with automatic archival

Built-in Letta Tools

  • web_search – For research tasks
  • run_code – For data processing
  • Native multi-agent communication tools
  • No custom tools needed

πŸ“Š Benefits of Simplified Approach

Before (Complex) After (Simplified)
7 agent classes + custom tools 1 orchestrator using Letta's built-ins
Multiple API routes 1 API endpoint
Complex agent manager Native Letta multi-agent system
Custom memory system Shared memory blocks
500+ lines of config Environment variables only

πŸ“š Documentation

βœ… Key Features

  • βœ… Letta-Native: Uses built-in multi-agent capabilities
  • βœ… Shared Memory: Proper shared memory blocks following workspace rules
  • βœ… Manager-Worker: Single orchestrator manages worker agents
  • βœ… Exact Workflow: Follows 8-step sequence precisely
  • βœ… Dashboard & API Testing: No extra scripts required
  • βœ… Clean Architecture: No unnecessary complexity
  • βœ… Proper Documentation: Clear, comprehensive guides

🎯 Next Steps

  1. Open http://localhost:3000/workflow and start a new workflow.
  2. Check shared memory blocks are updating correctly via the dashboard or API.
  3. Extend with additional worker agents as needed.
  4. Deploy to production using Letta Cloud.

⚠️ Status: Backend Stable · Front-End WIP

The multi-agent backend (Orchestrator β†’ Market-Research β†’ Market-Analyzer β†’ Social-Listener) is fully functional and passes all automated tests.
However, the Next.js front-end is still under heavy development – navigation works, but many pages show placeholder data and WebSocket updates are stubbed. Use the dashboard or the API endpoints to exercise the workflow until the UI is finished.

πŸ”„ Idea Loop (Hackathon Demo)

For demo speed we run one Solution-Generator pass and stop. Novelty & competitor checks can be re-enabled after the event.


Built with Letta's stateful agent framework - the future of AI applications.

About

A simplified market research and gap analysis system powered by Letta's native multi-agent capabilities. MarketGap AI discovers untapped market opportunities by analyzing consulting firm white papers, social signals, and industry trends using a clean, Letta-native architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages