|
| 1 | +from agno.agent import Agent |
| 2 | +from agno.knowledge.pdf import PDFKnowledgeBase, PDFReader |
| 3 | +from agno.models.openai import OpenAIChat |
| 4 | +from agno.team.team import Team |
| 5 | +from agno.tools.duckduckgo import DuckDuckGoTools |
| 6 | +from agno.tools.exa import ExaTools |
| 7 | +from agno.tools.slack import SlackTools |
| 8 | +from agno.tools.yfinance import YFinanceTools |
| 9 | +from agno.vectordb.pgvector.pgvector import PgVector |
| 10 | + |
| 11 | +knowledge_base = PDFKnowledgeBase( |
| 12 | + path="cookbook/teams/coordinator/data", |
| 13 | + vector_db=PgVector( |
| 14 | + table_name="autonomous_startup_team", |
| 15 | + db_url="postgresql+psycopg://ai:ai@localhost:5532/ai", |
| 16 | + ), |
| 17 | + reader=PDFReader(chunk=True), |
| 18 | +) |
| 19 | + |
| 20 | +knowledge_base.load(recreate=False) |
| 21 | + |
| 22 | +support_channel = "testing" |
| 23 | +sales_channel = "sales" |
| 24 | + |
| 25 | + |
| 26 | +legal_compliance_agent = Agent( |
| 27 | + name="Legal Compliance Agent", |
| 28 | + role="Legal Compliance", |
| 29 | + model=OpenAIChat("gpt-4o"), |
| 30 | + tools=[ExaTools()], |
| 31 | + knowledge=knowledge_base, |
| 32 | + instructions=[ |
| 33 | + "You are the Legal Compliance Agent of a startup, responsible for ensuring legal and regulatory compliance.", |
| 34 | + "Key Responsibilities:", |
| 35 | + "1. Review and validate all legal documents and contracts", |
| 36 | + "2. Monitor regulatory changes and update compliance policies", |
| 37 | + "3. Assess legal risks in business operations and product development", |
| 38 | + "4. Ensure data privacy and security compliance (GDPR, CCPA, etc.)", |
| 39 | + "5. Provide legal guidance on intellectual property protection", |
| 40 | + "6. Create and maintain compliance documentation", |
| 41 | + "7. Review marketing materials for legal compliance", |
| 42 | + "8. Advise on employment law and HR policies", |
| 43 | + ], |
| 44 | + add_datetime_to_instructions=True, |
| 45 | + markdown=True, |
| 46 | +) |
| 47 | + |
| 48 | +product_manager_agent = Agent( |
| 49 | + name="Product Manager Agent", |
| 50 | + role="Product Manager", |
| 51 | + model=OpenAIChat("gpt-4o"), |
| 52 | + knowledge=knowledge_base, |
| 53 | + instructions=[ |
| 54 | + "You are the Product Manager of a startup, responsible for product strategy and execution.", |
| 55 | + "Key Responsibilities:", |
| 56 | + "1. Define and maintain the product roadmap", |
| 57 | + "2. Gather and analyze user feedback to identify needs", |
| 58 | + "3. Write detailed product requirements and specifications", |
| 59 | + "4. Prioritize features based on business impact and user value", |
| 60 | + "5. Collaborate with technical teams on implementation feasibility", |
| 61 | + "6. Monitor product metrics and KPIs", |
| 62 | + "7. Conduct competitive analysis", |
| 63 | + "8. Lead product launches and go-to-market strategies", |
| 64 | + "9. Balance user needs with business objectives", |
| 65 | + ], |
| 66 | + add_datetime_to_instructions=True, |
| 67 | + markdown=True, |
| 68 | + tools=[], |
| 69 | +) |
| 70 | + |
| 71 | +market_research_agent = Agent( |
| 72 | + name="Market Research Agent", |
| 73 | + role="Market Research", |
| 74 | + model=OpenAIChat("gpt-4o"), |
| 75 | + tools=[DuckDuckGoTools(), ExaTools()], |
| 76 | + knowledge=knowledge_base, |
| 77 | + instructions=[ |
| 78 | + "You are the Market Research Agent of a startup, responsible for market intelligence and analysis.", |
| 79 | + "Key Responsibilities:", |
| 80 | + "1. Conduct comprehensive market analysis and size estimation", |
| 81 | + "2. Track and analyze competitor strategies and offerings", |
| 82 | + "3. Identify market trends and emerging opportunities", |
| 83 | + "4. Research customer segments and buyer personas", |
| 84 | + "5. Analyze pricing strategies in the market", |
| 85 | + "6. Monitor industry news and developments", |
| 86 | + "7. Create detailed market research reports", |
| 87 | + "8. Provide data-driven insights for decision making", |
| 88 | + ], |
| 89 | + add_datetime_to_instructions=True, |
| 90 | + markdown=True, |
| 91 | +) |
| 92 | + |
| 93 | +sales_agent = Agent( |
| 94 | + name="Sales Agent", |
| 95 | + role="Sales", |
| 96 | + model=OpenAIChat("gpt-4o"), |
| 97 | + tools=[SlackTools()], |
| 98 | + knowledge=knowledge_base, |
| 99 | + instructions=[ |
| 100 | + "You are the Sales & Partnerships Agent of a startup, responsible for driving revenue growth and strategic partnerships.", |
| 101 | + "Key Responsibilities:", |
| 102 | + "1. Identify and qualify potential partnership and business opportunities", |
| 103 | + "2. Evaluate partnership proposals and negotiate terms", |
| 104 | + "3. Maintain relationships with existing partners and clients", |
| 105 | + "5. Collaborate with Legal Compliance Agent on contract reviews", |
| 106 | + "6. Work with Product Manager on feature requests from partners", |
| 107 | + f"7. Document and communicate all partnership details in #{sales_channel} channel", |
| 108 | + "", |
| 109 | + "Communication Guidelines:", |
| 110 | + "1. Always respond professionally and promptly to partnership inquiries", |
| 111 | + "2. Include all relevant details when sharing partnership opportunities", |
| 112 | + "3. Highlight potential risks and benefits in partnership proposals", |
| 113 | + "4. Maintain clear documentation of all discussions and agreements", |
| 114 | + "5. Ensure proper handoff to relevant team members when needed", |
| 115 | + ], |
| 116 | + add_datetime_to_instructions=True, |
| 117 | + markdown=True, |
| 118 | +) |
| 119 | + |
| 120 | + |
| 121 | +financial_analyst_agent = Agent( |
| 122 | + name="Financial Analyst Agent", |
| 123 | + role="Financial Analyst", |
| 124 | + model=OpenAIChat("gpt-4o"), |
| 125 | + knowledge=knowledge_base, |
| 126 | + tools=[YFinanceTools()], |
| 127 | + instructions=[ |
| 128 | + "You are the Financial Analyst of a startup, responsible for financial planning and analysis.", |
| 129 | + "Key Responsibilities:", |
| 130 | + "1. Develop financial models and projections", |
| 131 | + "2. Create and analyze revenue forecasts", |
| 132 | + "3. Evaluate pricing strategies and unit economics", |
| 133 | + "4. Prepare investor reports and presentations", |
| 134 | + "5. Monitor cash flow and burn rate", |
| 135 | + "6. Analyze market conditions and financial trends", |
| 136 | + "7. Assess potential investment opportunities", |
| 137 | + "8. Track key financial metrics and KPIs", |
| 138 | + "9. Provide financial insights for strategic decisions", |
| 139 | + ], |
| 140 | + add_datetime_to_instructions=True, |
| 141 | + markdown=True, |
| 142 | +) |
| 143 | + |
| 144 | +customer_support_agent = Agent( |
| 145 | + name="Customer Support Agent", |
| 146 | + role="Customer Support", |
| 147 | + model=OpenAIChat("gpt-4o"), |
| 148 | + knowledge=knowledge_base, |
| 149 | + tools=[SlackTools()], |
| 150 | + instructions=[ |
| 151 | + "You are the Customer Support Agent of a startup, responsible for handling customer inquiries and maintaining customer satisfaction.", |
| 152 | + f"When a user reports an issue or issue or the question you cannot answer, always send it to the #{support_channel} Slack channel with all relevant details.", |
| 153 | + "Always maintain a professional and helpful demeanor while ensuring proper routing of issues to the right channels.", |
| 154 | + ], |
| 155 | + add_datetime_to_instructions=True, |
| 156 | + markdown=True, |
| 157 | +) |
| 158 | + |
| 159 | + |
| 160 | +autonomous_startup_team = Team( |
| 161 | + name="CEO Agent", |
| 162 | + mode="coordinator", |
| 163 | + model=OpenAIChat("gpt-4o"), |
| 164 | + instructions=[ |
| 165 | + "You are the CEO of a startup, responsible for overall leadership and success.", |
| 166 | + " Always transfer task to product manager agent so it can search the knowledge base.", |
| 167 | + "Instruct all agents to use the knowledge base to answer questions.", |
| 168 | + "Key Responsibilities:", |
| 169 | + "1. Set and communicate company vision and strategy", |
| 170 | + "2. Coordinate and prioritize team activities", |
| 171 | + "3. Make high-level strategic decisions", |
| 172 | + "4. Evaluate opportunities and risks", |
| 173 | + "5. Manage resource allocation", |
| 174 | + "6. Drive growth and innovation", |
| 175 | + "7. When a customer asks for help or reports an issue, immediately delegate to the Customer Support Agent", |
| 176 | + "8. When any partnership, sales, or business development inquiries come in, immediately delegate to the Sales Agent", |
| 177 | + "", |
| 178 | + "Team Coordination Guidelines:", |
| 179 | + "1. Product Development:", |
| 180 | + " - Consult Product Manager for feature prioritization", |
| 181 | + " - Use Market Research for validation", |
| 182 | + " - Verify Legal Compliance for new features", |
| 183 | + "2. Market Entry:", |
| 184 | + " - Combine Market Research and Sales insights", |
| 185 | + " - Validate financial viability with Financial Analyst", |
| 186 | + "3. Strategic Planning:", |
| 187 | + " - Gather input from all team members", |
| 188 | + " - Prioritize based on market opportunity and resources", |
| 189 | + "4. Risk Management:", |
| 190 | + " - Consult Legal Compliance for regulatory risks", |
| 191 | + " - Review Financial Analyst's risk assessments", |
| 192 | + "5. Customer Support:", |
| 193 | + " - Ensure all customer inquiries are handled promptly and professionally", |
| 194 | + " - Maintain a positive and helpful attitude", |
| 195 | + " - Escalate critical issues to the appropriate team", |
| 196 | + "", |
| 197 | + "Always maintain a balanced view of short-term execution and long-term strategy.", |
| 198 | + ], |
| 199 | + members=[ |
| 200 | + product_manager_agent, |
| 201 | + market_research_agent, |
| 202 | + financial_analyst_agent, |
| 203 | + legal_compliance_agent, |
| 204 | + customer_support_agent, |
| 205 | + sales_agent, |
| 206 | + ], |
| 207 | + add_datetime_to_instructions=True, |
| 208 | + markdown=True, |
| 209 | + debug_mode=True, |
| 210 | + show_members_responses=True, |
| 211 | +) |
| 212 | + |
| 213 | +autonomous_startup_team.print_response( |
| 214 | + message="I want to start a startup that sells AI agents to businesses. What is the best way to do this?", |
| 215 | + stream=True, |
| 216 | + stream_intermediate_steps=True, |
| 217 | +) |
| 218 | + |
| 219 | + |
| 220 | +autonomous_startup_team.print_response( |
| 221 | + message="Give me good marketing campaign for buzzai?", |
| 222 | + stream=True, |
| 223 | + stream_intermediate_steps=True, |
| 224 | +) |
| 225 | + |
| 226 | +autonomous_startup_team.print_response( |
| 227 | + message="What is my company and what are the monetization strategies?", |
| 228 | + stream=True, |
| 229 | + stream_intermediate_steps=True, |
| 230 | +) |
| 231 | + |
| 232 | +# autonomous_startup_team.print_response( |
| 233 | +# message="Read the partnership details and give me details about the partnership with InnovateAI", |
| 234 | +# stream=True, |
| 235 | +# stream_intermediate_steps=True, |
| 236 | +# ) |
0 commit comments