Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
credentials.json
token.json
171 changes: 171 additions & 0 deletions 2_openai/community_contributions/Mvp_Schedule_Builder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# MVP Schedule Builder 🚀

An intelligent product planning assistant that transforms your ideas into actionable development plans with integrated Google Calendar scheduling.

## 🎯 Overview

This AI-powered tool helps entrepreneurs and developers plan and prioritize building an MVP from concept to completion. Using a multi-agent system, it provides comprehensive product analysis and creates realistic development schedules.

### Key Features

- **💡 Idea Critique**: Analyzes your product concept with detailed pros, cons, and improvement suggestions
- **📊 Market Research**: Investigates competitors and identifies market opportunities
- **📋 Functional Requirements**: Generates prioritized feature lists based on market insights
- **📅 Smart Scheduling**: Creates realistic 4-week development timelines
- **🗓️ Google Calendar Integration**: Automatically syncs your project schedule to Google Calendar
- **🌐 Web Interface**: Beautiful Gradio-based UI for easy interaction

## 🛠️ Architecture

The system uses multiple specialized AI agents:

- **Market Researcher Agent**: Conducts competitor analysis and market validation
- **Idea Critiquer Agent**: Provides balanced feedback on product concepts
- **Product Manager Agent**: Orchestrates requirements and scheduling
- **Scheduler Agent**: Creates detailed project timelines with dependencies
- **Calendar Integration Tool**: Syncs schedules to Google Calendar

## 🚀 Quick Start

### Prerequisites

```bash
# Install dependencies
uv add gradio openai python-dotenv google-api-python-client google-auth-httplib2 google-auth-oauthlib
```

### Environment Setup

1. Create a `.env` file with your API keys:
```bash
OPENAI_API_KEY=your_openai_api_key_here
```

2. Set up Google Calendar OAuth (for calendar integration):
- Run the setup guide: `python setup_google_oauth.py`
- Follow the detailed instructions to configure Google Cloud Console

### Running the Application

```bash
# Launch the web interface
uv run mvp_schedule_builder.py
```

The app will open in your browser at `http://localhost:7860`

## 🖥️ Usage

1. **Enter Your Idea**: Describe your product concept in the text box
2. **Get Comprehensive Analysis**: The system will:
- Research the market and competitors
- Critique your idea with pros/cons
- Generate functional requirements
- Create a 4-week development schedule
3. **Calendar Integration**: Optionally sync the schedule to Google Calendar
4. **Review Results**: Get actionable insights and next steps

### Example Input
```
I want to build a mobile app that helps people find and book local fitness classes in their area, similar to ClassPass but focused on smaller, independent studios.
```

### Example Output
- Market analysis of fitness booking platforms
- Detailed critique with 3 pros and 3 cons
- Prioritized feature list (user auth, studio search, booking system, etc.)
- 4-week development timeline with specific tasks
- Google Calendar with scheduled development activities

## 📁 Project Structure

```
MVP_Schedule_Builder/
├── mvp_schedule_builder.py # Main Gradio web application
├── product_planner.py # Core orchestration logic
├── product_agents/ # AI agent implementations
│ ├── market_researcher_agent.py
│ ├── idea_critiquer_agent.py
│ ├── product_manager_agent.py
│ ├── scheduler_agent.py
│ └── base_model/ # Abstract base classes
├── tools/ # Utility tools and integrations
│ └── calendar_integration.py # Google Calendar API wrapper
├── setup_google_oauth.py # OAuth setup guide
├── reset_auth.py # Authentication reset utility
└── .env # Environment variables
```

## 🔧 Google Calendar Setup

### Method 1: OAuth 2.0 (Recommended)

1. **Create Google Cloud Project**:
- Go to [Google Cloud Console](https://console.cloud.google.com/)
- Create new project or select existing one

2. **Enable Calendar API**:
- Navigate to "APIs & Services > Library"
- Search and enable "Google Calendar API"

3. **Configure OAuth Consent Screen**:
- Go to "APIs & Services > OAuth consent screen"
- Choose "External" user type
- Fill required fields and add your email as test user

4. **Create OAuth Credentials**:
- Go to "APIs & Services > Credentials"
- Create "OAuth 2.0 Client ID" → "Desktop application"
- Download JSON file as `credentials.json`

5. **Register Redirect URIs**:
```
http://localhost:8080/
http://localhost:8081/
http://localhost:8082/
```

### Method 2: API Key (Limited Functionality)
Add `GOOGLE_CALENDAR_API_KEY` to your `.env` file (read-only access only).

## 🛠️ Development

### Running Individual Components

```bash
# Test market research agent
python -c "from product_agents import MarketResearcherAgent; agent = MarketResearcherAgent()"

# Test calendar integration
python -c "from tools import GoogleCalendarIntegration; cal = GoogleCalendarIntegration()"

# Reset authentication if needed
python reset_auth.py --reset
```

### Customization

- **Modify timeline**: Change `num_weeks` parameter in `SchedulerAgent`
- **Add new agents**: Extend `AgentModel` base class
- **Custom tools**: Use `@function_tool` decorator
- **UI themes**: Modify Gradio theme in `mvp_schedule_builder.py`

## 🚨 Troubleshooting

### Common Issues

**"Access blocked: This app's request is invalid"**
- Register redirect URIs in Google Cloud Console
- Ensure OAuth consent screen is configured

**"CSRF Warning! State not equal in request and response"**
- Close all Google auth browser tabs
- Clear browser cookies for Google accounts

**"Import errors"**
- Ensure all dependencies installed: `uv add [package-name]`
- Check Python path and virtual environment

**Calendar sync fails**
- Verify `credentials.json` file exists and is valid
- Check Google Calendar API is enabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
"""
Example usage of GoogleCalendarIntegration with SchedulerAgent output.

This demonstrates how to sync a Schedule created by the SchedulerAgent
to Google Calendar.
"""

import logging
from product_agents.scheduler_agent import SchedulerAgent, Schedule, Activity
from tools import GoogleCalendarIntegration

# Configure logging
logging.basicConfig(level=logging.INFO)

def example_usage():
"""Example of syncing scheduler output to Google Calendar."""

# Example: Create a sample schedule (normally this would come from SchedulerAgent)
sample_activities = [
Activity(
name="Project Setup & Planning",
start_date="2024-11-15",
end_date="2024-11-17",
description="Initialize project structure, setup development environment"
),
Activity(
name="Database Design",
start_date="2024-11-18",
end_date="2024-11-20",
description="Design database schema and setup database connections"
),
Activity(
name="API Development",
start_date="2024-11-21",
end_date="2024-11-25",
description="Develop core API endpoints and business logic"
),
Activity(
name="Frontend Development",
start_date="2024-11-26",
end_date="2024-11-30",
description="Build user interface and integrate with API"
),
Activity(
name="Testing & Deployment",
start_date="2024-12-01",
end_date="2024-12-05",
description="Comprehensive testing and production deployment"
)
]

sample_schedule = Schedule(
calendar_name="MVP Development Schedule",
activities=sample_activities
)

try:
# Initialize Google Calendar integration
# Note: You'll need credentials.json from Google Cloud Console
calendar_service = GoogleCalendarIntegration(
credentials_file='credentials.json',
token_file='token.json'
)

# Sync the schedule to Google Calendar
result = calendar_service.sync_schedule(sample_schedule)

print(f"✅ Successfully synced schedule!")
print(f"Calendar ID: {result['calendar_id']}")
print(f"Events created: {result['total_events']}/{result['activities_processed']}")
print(f"Event IDs: {result['event_ids']}")

except Exception as e:
print(f"❌ Failed to sync schedule: {e}")

def sync_scheduler_agent_output():
"""Example of using actual SchedulerAgent output."""

# Create scheduler agent
scheduler = SchedulerAgent()

# Example functional requirements (normally from ProductManagerAgent)
requirements = """
Functional Requirements for MVP:
1. User registration and authentication system
2. Product catalog with search functionality
3. Shopping cart and checkout process
4. Payment integration
5. Order management system
6. Admin dashboard for product management
"""

try:
# Get schedule from agent (this would be async in real usage)
# schedule = await scheduler.agent.run(requirements)

# For demo, we'll use the sample schedule
print("📅 Using sample schedule for demo...")
example_usage()

except Exception as e:
print(f"❌ Failed to generate or sync schedule: {e}")

if __name__ == "__main__":
example_usage()
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import gradio as gr
from dotenv import load_dotenv

from product_planner import ProductPlanner
from tools.calendar_integration import GoogleCalendarIntegration

load_dotenv(override=True)


async def run(query: str):
async for chunk in ProductPlanner().run(query):
yield chunk


with gr.Blocks(theme=gr.themes.Default(primary_hue="sky")) as ui:
gr.Markdown("# Product Planner")
query_textbox = gr.Textbox(
label="What is your idea for a new product? Lets make a plan to build it."
)
run_button = gr.Button("Run", variant="primary")
report = gr.Markdown(label="Report")

run_button.click(fn=run, inputs=query_textbox, outputs=report)
query_textbox.submit(fn=run, inputs=query_textbox, outputs=report)

ui.launch(inbrowser=True)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .idea_critiquer_agent import IdeaCritiquerAgent, IdeaCritiqueReport
from .market_researcher_agent import MarketResearcherAgent, MarketResearchReport
from .product_manager_agent import ProductManagerAgent
from .scheduler_agent import SchedulerAgent, Schedule
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .instruction_model import InstructionsModel
from .agent_model import AgentModel
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import abc

from agents import Agent, Tool


class AgentModel(abc.ABC):
agent: Agent

@abc.abstractmethod
def init_agent(self):
"""Initialize and return the agent."""
pass

@property
def agent_instance(self) -> Agent:
"""Return the agent instance."""
return self.agent

@abc.abstractmethod
def as_tool(self) -> Tool:
"""Return the agent as a tool."""
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import abc

from typing import Literal


class InstructionsModel(abc.ABC):
@property
@abc.abstractmethod
def name(self) -> str:
"""Return the name of the instruction model."""
pass

@property
@abc.abstractmethod
def instructions(self) -> str:
"""Return the instructions for the model."""
pass

@property
@abc.abstractmethod
def handoff_description(self) -> str:
"""Return the handoff description for the model."""
pass

@property
@abc.abstractmethod
def model(self) -> Literal["gpt-4o-mini", "gpt-4o"]:
"""Return the model type."""
pass
Loading