From 6033ed7e5f19a564c895201b7aa17e622f604f90 Mon Sep 17 00:00:00 2001 From: Madhu Date: Sun, 8 Dec 2024 03:53:51 +0530 Subject: [PATCH] sequential - final structure --- .../ai_startup_org_agents/.gitignore | 1 + .../ai_startup_org_agents/README.md | 77 +++++++++++++++++++ .../ai_startup_org_agents/main.py | 77 ++++++++++++++----- .../ai_startup_org_agents/requirements.txt | 2 +- .../shared_files/agency_manifesto.md | 42 ---------- .../startup_analysis_templates.md | 25 ------ 6 files changed, 138 insertions(+), 86 deletions(-) delete mode 100644 ai_agent_tutorials/ai_startup_org_agents/shared_files/agency_manifesto.md delete mode 100644 ai_agent_tutorials/ai_startup_org_agents/shared_files/startup_analysis_templates.md diff --git a/ai_agent_tutorials/ai_startup_org_agents/.gitignore b/ai_agent_tutorials/ai_startup_org_agents/.gitignore index 19f4d17..c79c89c 100644 --- a/ai_agent_tutorials/ai_startup_org_agents/.gitignore +++ b/ai_agent_tutorials/ai_startup_org_agents/.gitignore @@ -1,3 +1,4 @@ .env startup-org settings.json +shared_files \ No newline at end of file diff --git a/ai_agent_tutorials/ai_startup_org_agents/README.md b/ai_agent_tutorials/ai_startup_org_agents/README.md index 8b13789..3341890 100644 --- a/ai_agent_tutorials/ai_startup_org_agents/README.md +++ b/ai_agent_tutorials/ai_startup_org_agents/README.md @@ -1 +1,78 @@ +# AI Startup Organization Agency 🚀 +An intelligent multi-agent system that provides comprehensive startup analysis and strategic guidance for a startup you'd want to build using Agency Swarm framework and OpenAI's GPT models + +## Demo: + +## Features + +### 🤖 Agency Swarm Agents + +- **CEO Agent**: Strategic leader and final decision maker + - Analyzes startup ideas using structured evaluation + - Makes strategic decisions across product, technical, marketing, and financial domains + - Uses AnalyzeStartupTool and MakeStrategicDecision tools + +- **CTO Agent**: Technical architecture and feasibility expert + - Evaluates technical requirements and feasibility + - Provides architecture decisions + - Uses QueryTechnicalRequirements and EvaluateTechnicalFeasibility tools + +- **Product Manager Agent**: Product strategy specialist + - Defines product strategy and roadmap + - Coordinates between technical and marketing teams + - Focuses on product-market fit + +- **Developer Agent**: Technical implementation expert + - Provides detailed technical implementation guidance + - Suggests optimal tech stack and cloud solutions + - Estimates development costs and timelines + +- **Marketing Manager Agent**: Marketing strategy leader + - Develops go-to-market strategies + - Plans customer acquisition approaches + - Coordinates with product team + +### 🔄 Asynchronous Communication + +The agency operates in async mode, enabling: +- Parallel processing of analyses from different agents +- Efficient multi-agent collaboration +- Real-time communication between agents +- Non-blocking operations for better performance + +### 🔗 Agent Communication Flows +- CEO ↔️ All Agents (Strategic Oversight) +- CTO ↔️ Developer (Technical Implementation) +- Product Manager ↔️ Marketing Manager (Go-to-Market Strategy) +- Product Manager ↔️ Developer (Feature Implementation) +- (and more!) +## How to Run + +Follow the steps below to set up and run the application: +Before anything else, Please get your OpenAI API Key here: https://platform.openai.com/api-keys + +1. **Clone the Repository**: + ```bash + git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git + cd ai_agent_tutorials + ``` + +2. **Install the dependencies**: + ```bash + pip install -r requirements.txt + ``` + +3. **Run the Streamlit app**: + ```bash + streamlit run ai_startup_org_agents/main.py + ``` + +4. **Enter your OpenAI API Key** in the sidebar when prompted and start analyzing your startup idea! + +## Project Structure + +ai_startup_org_agents/ +├── main.py # Main application file with agents and tools +├── requirements.txt # Project dependencies +└── README.md # Project documentation diff --git a/ai_agent_tutorials/ai_startup_org_agents/main.py b/ai_agent_tutorials/ai_startup_org_agents/main.py index acbdc62..0841f5c 100644 --- a/ai_agent_tutorials/ai_startup_org_agents/main.py +++ b/ai_agent_tutorials/ai_startup_org_agents/main.py @@ -5,12 +5,13 @@ import streamlit as st from instructor import OpenAISchema import asyncio -# New Tools +# Custom Tools - Startup Analysis, Strategic Decision, Technical Requirements, Technical Feasibility class StartupAnalysis(OpenAISchema): """Schema for startup analysis results""" market_potential: Literal["high", "medium", "low"] technical_complexity: Literal["high", "medium", "low"] resource_requirements: Literal["high", "medium", "low"] + rationale: str = Field(description="Explanation for the analysis") class AnalyzeStartupTool(BaseTool): """Tool to analyze startup ideas""" @@ -18,25 +19,45 @@ class AnalyzeStartupTool(BaseTool): target_market: str = Field(..., description="Target market description") def run(self): - # Tool implementation - analysis = StartupAnalysis( - market_potential="high", - technical_complexity="medium", - resource_requirements="low" - ) - return analysis.dict() + """Run startup analysis based on CEO's evaluation""" + prompt = f""" + Analyze this startup idea: + Idea: {self.startup_idea} + Target Market: {self.target_market} + + Provide a comprehensive analysis including: + 1. Market potential (high/medium/low) + 2. Technical complexity (high/medium/low) + 3. Resource requirements (high/medium/low) + 4. A brief rationale for your decisions + + Format your response as a StartupAnalysis object. + """ + response = self._llm.invoke(prompt) + analysis = StartupAnalysis.from_response(response) + + # Store analysis in shared state for other tools to access + self._shared_state.set("startup_analysis", analysis) + return analysis class MakeStrategicDecision(BaseTool): """Tool for CEO to make and track strategic decisions""" - decision: str = Field(..., description="The strategic decision to be recorded and taken for this particular startup idea") + decision: str = Field(..., description="The strategic decision to be made for this startup idea") decision_type: Literal["product", "technical", "marketing", "financial"] = Field(..., description="Type of decision") def run(self): - analysis = self._shared_state.get("startup_analysis", None) - if analysis is None: - raise ValueError("Please analyze the startup idea first using QueryStartupIdea tool.") + """Execute and record strategic decision""" + analysis = self._shared_state.get("startup_analysis") + if not analysis: + return "Please analyze the startup idea first using AnalyzeStartupTool" - return f"Decision recorded: {self.decision} (Type: {self.decision_type}) based on analysis" + decision_record = { + "decision": self.decision, + "type": self.decision_type, + "based_on_analysis": analysis + } + + return f"Strategic decision recorded: {self.decision} (Type: {self.decision_type})" class QueryTechnicalRequirements(BaseTool): """Tool to analyze technical requirements""" @@ -110,9 +131,28 @@ def main(): name="CEO", description="Strategic leader and final decision maker for the startup", instructions=""" - Analyze the given startup idea and take the authority of a CEO of the startup to make strategic decisions. - Use the AnalyzeStartupTool to evaluate the startup idea, and use the MakeStrategicDecision tool to make strategic decisions. - Coordinate with team members using the built-in SendMessage tool. + You are an experienced CEO with deep expertise in evaluating startup ideas. + Your role involves two main responsibilities: + + 1. ANALYZING STARTUP IDEAS: + When analyzing startup ideas, carefully consider: + - Market Potential (high/medium/low): market size, growth, competition, accessibility + - Technical Complexity (high/medium/low): tech stack, scalability, timeline + - Resource Requirements (high/medium/low): capital, team, marketing costs + + 2. MAKING STRATEGIC DECISIONS: + After analysis, you should make clear strategic decisions: + - Product decisions: features, roadmap, priorities + - Technical decisions: architecture, stack choices + - Marketing decisions: go-to-market strategy, channels + - Financial decisions: funding, resource allocation + + Process: + 1. First use AnalyzeStartupTool to evaluate the idea + 2. Then use MakeStrategicDecision to record your strategic choices + 3. Always base decisions on your previous analysis + + Provide clear, actionable insights and decisions. """, tools=[AnalyzeStartupTool, MakeStrategicDecision], temperature=0.7, @@ -157,7 +197,7 @@ def main(): api_headers=api_headers ) - # Initialize agency with communication paths + # Initializing the agency with communication paths agency = Agency( [ ceo, cto, product_manager, developer, marketing_manager, @@ -169,7 +209,7 @@ def main(): [product_manager, developer], [product_manager, marketing_manager] ], - async_mode='threading', + async_mode='threading', # Runs agent tasks in separate threads for concurrent execution shared_files='shared_files' ) @@ -280,3 +320,4 @@ def main(): if __name__ == "__main__": main() + diff --git a/ai_agent_tutorials/ai_startup_org_agents/requirements.txt b/ai_agent_tutorials/ai_startup_org_agents/requirements.txt index 4e4c6dd..ffde40e 100644 --- a/ai_agent_tutorials/ai_startup_org_agents/requirements.txt +++ b/ai_agent_tutorials/ai_startup_org_agents/requirements.txt @@ -1,3 +1,3 @@ python-dotenv==1.0.0 -agency-swarm +agency-swarm==0.4.1 streamlit \ No newline at end of file diff --git a/ai_agent_tutorials/ai_startup_org_agents/shared_files/agency_manifesto.md b/ai_agent_tutorials/ai_startup_org_agents/shared_files/agency_manifesto.md deleted file mode 100644 index f3fd6a2..0000000 --- a/ai_agent_tutorials/ai_startup_org_agents/shared_files/agency_manifesto.md +++ /dev/null @@ -1,42 +0,0 @@ -# AI Startup Agency Manifesto - -## Our Mission -To provide comprehensive, data-driven analysis and strategic guidance for startup ideas through collaborative AI agents. - -## Agent Responsibilities - -### CEO Agent -- Lead strategic decision-making -- Coordinate between all team members -- Ensure alignment with business goals -- Make final decisions on critical matters - -### CTO Agent -- Evaluate technical feasibility -- Guide technology stack decisions -- Assess technical risks -- Collaborate with Developer on implementation plans - -### Product Manager Agent -- Define product strategy -- Create and maintain product roadmap -- Balance user needs with technical constraints -- Coordinate between technical and marketing teams - -### Developer Agent -- Provide technical implementation insights -- Assess development complexity -- Suggest technical solutions -- Work closely with CTO on feasibility - -### Marketing Manager Agent -- Develop marketing strategies -- Analyze target audience -- Plan go-to-market approach -- Work with Product Manager on market fit - -## Communication Guidelines -- All agents should communicate clearly and concisely -- Use data to support recommendations -- Highlight risks and opportunities -- Maintain focus on startup success diff --git a/ai_agent_tutorials/ai_startup_org_agents/shared_files/startup_analysis_templates.md b/ai_agent_tutorials/ai_startup_org_agents/shared_files/startup_analysis_templates.md deleted file mode 100644 index c24c3bf..0000000 --- a/ai_agent_tutorials/ai_startup_org_agents/shared_files/startup_analysis_templates.md +++ /dev/null @@ -1,25 +0,0 @@ -# Startup Analysis Templates - -## Market Analysis Template -- Market Size: [TAM, SAM, SOM] -- Target Customer Segments: [Primary, Secondary] -- Competition Analysis: [Direct, Indirect] -- Market Trends: [Current, Emerging] - -## Technical Feasibility Template -- Technology Stack Requirements -- Development Timeline -- Resource Requirements -- Technical Risks and Mitigations - -## Financial Analysis Template -- Initial Investment Required -- Revenue Streams -- Cost Structure -- Break-even Analysis - -## Marketing Strategy Template -- Value Proposition -- Marketing Channels -- Customer Acquisition Strategy -- Growth Metrics