diff --git a/task_examples/company_research_sales_strategy/README.md b/task_examples/company_research_sales_strategy/README.md new file mode 100644 index 0000000..7052173 --- /dev/null +++ b/task_examples/company_research_sales_strategy/README.md @@ -0,0 +1,129 @@ +# Company Research & Sales Strategy Agent + +A comprehensive Company Research and Sales Strategy Agent built with the **Upsonic AI Agent Framework**. This example demonstrates how to use `DeepAgent` with specialized subagents to conduct deep company research, analyze industry trends, perform financial analysis, and develop tailored sales strategies. + +## Features + +- šŸ” **Comprehensive Company Research**: Deep analysis of target companies including business models, products, markets, and competitive positioning +- šŸ“Š **Industry Analysis**: Market trends, competitive landscape, emerging technologies, and regulatory environment analysis +- šŸ’¹ **Financial Analysis**: Stock performance, fundamentals, analyst recommendations, and market sentiment using YFinance +- šŸŽÆ **Sales Strategy Development**: Tailored sales strategies with target segments, value propositions, pricing, and messaging +- šŸ¤– **DeepAgent Orchestration**: Automatically plans and coordinates specialized sub-agents to fulfill complex research goals +- 🧠 **Persistent Memory**: SQLite-based memory for session persistence and conversation history +- šŸ—ļø **Modular Design**: Clean separation of concerns with specialized agents, schemas, and utilities + +## Prerequisites + +- Python 3.10+ +- OpenAI API key +- (Optional) Tavily API key for enhanced search capabilities + +## Installation + +1. **Navigate to this directory**: + ```bash + cd examples/company_research_sales_strategy + ``` + +2. **Install dependencies**: + ```bash + # Install all dependencies (API) + upsonic install + + # Or install specific sections: + upsonic install api # API dependencies only (default) + upsonic install development # Development dependencies only + ``` + +3. **Set up environment variables**: + ```bash + export OPENAI_API_KEY="your-api-key" + export TAVILY_API_KEY="your-tavily-key" # Optional, falls back to DuckDuckGo + ``` + +## Usage + +### Run the API Server + +To run the agent as a FastAPI server: + +```bash +upsonic run +``` + +The API will be available at `http://localhost:8000` with automatic OpenAPI documentation at `http://localhost:8000/docs`. + +OR + +You can run the agent directly: + +```bash +python3 main.py +``` + +**Example API Call:** +```bash +curl -X POST http://localhost:8000/call \ + -H "Content-Type: application/json" \ + -d '{ + "company_name": "OpenAI", + "industry": "Artificial Intelligence", + "company_symbol": null + }' +``` + +## Project Structure + +``` +company_research_sales_strategy/ +ā”œā”€ā”€ main.py # Entry point with main() and amain() functions +ā”œā”€ā”€ upsonic_configs.json # Upsonic configuration and dependencies +ā”œā”€ā”€ orchestrator.py # DeepAgent orchestrator creation +ā”œā”€ā”€ subagents.py # Specialized subagent factory functions +ā”œā”€ā”€ schemas.py # Pydantic output schemas +ā”œā”€ā”€ task_builder.py # Task description builder +└── README.md # This file +``` + +## How It Works + +1. **Orchestrator Agent**: A `DeepAgent` that coordinates the entire research and strategy development process using planning tools and subagent delegation. + +2. **Specialized Subagents**: Four domain experts that handle specific research areas: + - **Company Researcher**: Gathers comprehensive company information using web search + - **Industry Analyst**: Analyzes industry trends and market dynamics + - **Financial Analyst**: Performs financial analysis using YFinance tools + - **Sales Strategist**: Develops tailored sales strategies based on research findings + +3. **DeepAgent Coordination**: Instead of manually chaining tasks, `DeepAgent` automatically: + - Creates execution plans using the planning tool + - Delegates tasks to appropriate specialists + - Passes context between subagents + - Synthesizes findings into comprehensive reports + +4. **Memory Persistence**: Uses SQLite database to store session history, summaries, and research findings for continuity across runs. + +## Example Queries + +- Research "Tesla" in the "Electric Vehicles" industry with stock symbol "TSLA" +- Analyze "Microsoft" and develop a sales strategy for the "Cloud Computing" industry +- Research "Anthropic" in the "AI Safety" industry without financial data + +## Input Parameters + +- `company_name` (required): Name of the target company +- `company_symbol` (optional): Stock symbol for financial analysis (e.g., "AAPL", "TSLA") +- `industry` (optional): Industry name for focused analysis +- `enable_memory` (optional): Whether to enable memory persistence (default: true) +- `storage_path` (optional): Path for SQLite storage (default: "company_research.db") +- `model` (optional): Model identifier (default: "openai/gpt-4o") + +## Output + +Returns a comprehensive report containing: +- Company research findings +- Industry analysis +- Financial analysis (if symbol provided) +- Tailored sales strategy +- Executive summary with key insights and recommendations + diff --git a/task_examples/company_research_sales_strategy/main.py b/task_examples/company_research_sales_strategy/main.py new file mode 100644 index 0000000..8f422f7 --- /dev/null +++ b/task_examples/company_research_sales_strategy/main.py @@ -0,0 +1,109 @@ +""" +Main entry point for Company Research and Sales Strategy Agent. + +This module provides the entry points (main and amain) that coordinate +the comprehensive research and strategy development process. +""" + +from __future__ import annotations + +from typing import Dict, Any + +from upsonic import Task +try: + from .orchestrator import create_orchestrator_agent + from .task_builder import build_research_task + from .schemas import ComprehensiveReportOutput +except ImportError: + from orchestrator import create_orchestrator_agent + from task_builder import build_research_task + from schemas import ComprehensiveReportOutput + + +def main(inputs: Dict[str, Any]) -> Dict[str, Any]: + """ + Main function for company research and sales strategy development. + + Args: + inputs: Dictionary containing: + - company_name: Name of the target company (required) + - company_symbol: Optional stock symbol for financial analysis + - industry: Optional industry name for focused analysis + - enable_memory: Whether to enable memory persistence (default: True) + - storage_path: Optional path for SQLite storage (default: "company_research.db") + - model: Optional model identifier (default: "openai/gpt-4o") + + Returns: + Dictionary containing comprehensive research report + """ + company_name = inputs.get("company_name") + if not company_name: + raise ValueError("company_name is required in inputs") + + company_symbol = inputs.get("company_symbol") + industry = inputs.get("industry") + enable_memory = inputs.get("enable_memory", True) + storage_path = inputs.get("storage_path") + model = inputs.get("model", "openai/gpt-4o") + + orchestrator = create_orchestrator_agent( + model=model, + storage_path=storage_path, + enable_memory=enable_memory, + ) + + task_description = build_research_task( + company_name=company_name, + company_symbol=company_symbol, + industry=industry, + ) + + task = Task(task_description, response_format=ComprehensiveReportOutput) + + result = orchestrator.do(task) + + return { + "company_name": company_name, + "comprehensive_report": result, + "research_completed": True, + } + + + +if __name__ == "__main__": + import json + import sys + + test_inputs = { + "company_name": "OpenAI", + "company_symbol": None, + "industry": "Artificial Intelligence", + "enable_memory": False, + "storage_path": None, + "model": "openai/gpt-4o-mini", + } + + if len(sys.argv) > 1: + try: + with open(sys.argv[1], "r") as f: + test_inputs = json.load(f) + except Exception as e: + print(f"Error loading JSON file: {e}") + print("Using default test inputs") + + try: + result = main(test_inputs) + + print("\n" + "=" * 80) + print("Research Completed Successfully!") + print("=" * 80) + print(f"\nCompany: {result.get('company_name')}") + print(f"Research Status: {'Completed' if result.get('research_completed') else 'Failed'}") + print(f"\nComprehensive Report:\n{result.get('comprehensive_report', 'N/A')}") + + except Exception as e: + print(f"\nāŒ Error during execution: {e}") + import traceback + traceback.print_exc() + sys.exit(1) + diff --git a/task_examples/company_research_sales_strategy/orchestrator.py b/task_examples/company_research_sales_strategy/orchestrator.py new file mode 100644 index 0000000..e06f713 --- /dev/null +++ b/task_examples/company_research_sales_strategy/orchestrator.py @@ -0,0 +1,103 @@ +""" +Orchestrator agent creation and configuration. + +Creates the main DeepAgent orchestrator that coordinates all specialized +subagents for comprehensive company research and sales strategy development. +""" + +from __future__ import annotations + +from typing import Optional + +from upsonic.agent.deepagent import DeepAgent +from upsonic.db.database import SqliteDatabase + +try: + from .subagents import ( + create_research_subagent, + create_industry_analyst_subagent, + create_financial_analyst_subagent, + create_sales_strategist_subagent, + ) +except ImportError: + from subagents import ( + create_research_subagent, + create_industry_analyst_subagent, + create_financial_analyst_subagent, + create_sales_strategist_subagent, + ) + + +def create_orchestrator_agent( + model: str = "openai/gpt-4o", + storage_path: Optional[str] = None, + enable_memory: bool = True, +) -> DeepAgent: + """Create the main orchestrator DeepAgent with all subagents. + + Args: + model: Model identifier for the orchestrator agent + storage_path: Optional path for SQLite storage database + enable_memory: Whether to enable memory persistence + + Returns: + Configured DeepAgent instance with all subagents + """ + db = None + memory = None + + if enable_memory: + if storage_path is None: + storage_path = "company_research.db" + db = SqliteDatabase( + db_file=storage_path, + agent_sessions_table_name="agent_sessions", + session_id="company_research_session", + user_id="research_user", + full_session_memory=True, + summary_memory=True, + model=model, + ) + memory = db.memory + + subagents = [ + create_research_subagent(), + create_industry_analyst_subagent(), + create_financial_analyst_subagent(), + create_sales_strategist_subagent(), + ] + + orchestrator = DeepAgent( + model=model, + name="Company Research & Sales Strategy Orchestrator", + role="Senior Business Strategy Consultant", + goal="Orchestrate comprehensive company research, industry analysis, financial evaluation, and sales strategy development", + system_prompt="""You are a senior business strategy consultant orchestrating a comprehensive + research and strategy development process. Your role is to: + + 1. Coordinate specialized subagents to conduct deep research on target companies + 2. Analyze industry trends and competitive landscape + 3. Evaluate financial performance and market position + 4. Synthesize findings into actionable sales strategies + + Use the planning tool (write_todos) to break down complex research tasks. Delegate specific + research areas to specialized subagents. Synthesize all findings into a comprehensive report + with actionable insights and recommendations. + + Always use subagents for specialized tasks: + - Use 'company-researcher' for company-specific research + - Use 'industry-analyst' for industry and market analysis + - Use 'financial-analyst' for financial data and stock analysis + - Use 'sales-strategist' for sales strategy development + + Coordinate parallel execution when tasks are independent to maximize efficiency.""", + memory=memory, + subagents=subagents, + enable_planning=True, + enable_filesystem=True, + tool_call_limit=30, + debug=False, + ) + + return orchestrator + diff --git a/task_examples/company_research_sales_strategy/schemas.py b/task_examples/company_research_sales_strategy/schemas.py new file mode 100644 index 0000000..91679e6 --- /dev/null +++ b/task_examples/company_research_sales_strategy/schemas.py @@ -0,0 +1,74 @@ +""" +Output schemas for company research and sales strategy agent. + +Defines structured Pydantic models for type-safe outputs from different +analysis components. +""" + +from __future__ import annotations + +from typing import List, Optional +from pydantic import BaseModel + + +class CompanyResearchOutput(BaseModel): + """Structured output for company research.""" + company_name: str + company_description: str + industry: str + key_products_services: List[str] + target_markets: List[str] + competitive_advantages: List[str] + recent_news_highlights: List[str] + website: Optional[str] = None + headquarters: Optional[str] = None + employee_count: Optional[str] = None + + +class IndustryAnalysisOutput(BaseModel): + """Structured output for industry analysis.""" + industry_name: str + market_size: str + growth_trends: List[str] + key_players: List[str] + emerging_technologies: List[str] + regulatory_environment: str + market_opportunities: List[str] + market_threats: List[str] + + +class FinancialAnalysisOutput(BaseModel): + """Structured output for financial analysis.""" + company_symbol: Optional[str] = None + current_price: Optional[str] = None + market_cap: Optional[str] = None + pe_ratio: Optional[str] = None + revenue_trend: str + profitability_status: str + financial_strengths: List[str] + financial_concerns: List[str] + analyst_sentiment: Optional[str] = None + + +class SalesStrategyOutput(BaseModel): + """Structured output for sales strategy.""" + target_segments: List[str] + value_propositions: List[str] + sales_channels: List[str] + pricing_strategy: str + competitive_positioning: str + key_messaging: List[str] + sales_process_recommendations: List[str] + success_metrics: List[str] + + +class ComprehensiveReportOutput(BaseModel): + """Final comprehensive report combining all analyses.""" + company_research: CompanyResearchOutput + industry_analysis: IndustryAnalysisOutput + financial_analysis: FinancialAnalysisOutput + sales_strategy: SalesStrategyOutput + executive_summary: str + key_insights: List[str] + recommended_next_steps: List[str] + diff --git a/task_examples/company_research_sales_strategy/subagents.py b/task_examples/company_research_sales_strategy/subagents.py new file mode 100644 index 0000000..c25b376 --- /dev/null +++ b/task_examples/company_research_sales_strategy/subagents.py @@ -0,0 +1,136 @@ +""" +Specialized subagent creation functions. + +Each function creates a specialized agent for a specific domain: +- Company research +- Industry analysis +- Financial analysis +- Sales strategy development +""" + +from __future__ import annotations + +import os +from typing import TYPE_CHECKING + +from upsonic import Agent +from upsonic.tools.common_tools.duckduckgo import duckduckgo_search_tool +from upsonic.tools.common_tools.financial_tools import YFinanceTools +from upsonic.tools.common_tools.tavily import tavily_search_tool + +if TYPE_CHECKING: + pass + + +def create_research_subagent(model: str = "openai/gpt-4o-mini") -> Agent: + """Create specialized subagent for company research. + + Args: + model: Model identifier for the subagent + + Returns: + Configured Agent instance for company research + """ + ddg_search = duckduckgo_search_tool(duckduckgo_client=None, max_results=10) + + return Agent( + model=model, + name="company-researcher", + role="Company Research Specialist", + goal="Conduct comprehensive research on target companies including business model, products, markets, and competitive positioning", + system_prompt="""You are an expert company researcher with deep knowledge of business analysis, + market research, and competitive intelligence. Your role is to gather comprehensive information + about companies including their business model, products/services, target markets, competitive + advantages, and recent developments. Use web search tools extensively to find current, accurate + information. Structure your findings clearly and cite sources when possible.""", + tools=[ddg_search], + tool_call_limit=15, + ) + + +def create_industry_analyst_subagent(model: str = "openai/gpt-4o-mini") -> Agent: + """Create specialized subagent for industry analysis. + + Args: + model: Model identifier for the subagent + + Returns: + Configured Agent instance for industry analysis + """ + tavily_api_key = os.getenv("TAVILY_API_KEY") + tools = [] + + if tavily_api_key: + tavily_search = tavily_search_tool(tavily_api_key) + tools.append(tavily_search) + else: + ddg_search = duckduckgo_search_tool(duckduckgo_client=None, max_results=10) + tools.append(ddg_search) + + return Agent( + model=model, + name="industry-analyst", + role="Industry Analysis Specialist", + goal="Analyze industry trends, market dynamics, competitive landscape, and emerging opportunities", + system_prompt="""You are a senior industry analyst with expertise in market research, trend analysis, + and competitive intelligence. Your role is to analyze industry trends, market size, growth patterns, + key players, emerging technologies, regulatory environment, opportunities, and threats. Provide + data-driven insights and strategic perspectives on industry dynamics.""", + tools=tools, + tool_call_limit=15, + ) + + +def create_financial_analyst_subagent(model: str = "openai/gpt-4o-mini") -> Agent: + """Create specialized subagent for financial analysis. + + Args: + model: Model identifier for the subagent + + Returns: + Configured Agent instance for financial analysis + """ + financial_tools = YFinanceTools( + stock_price=True, + company_info=True, + analyst_recommendations=True, + company_news=True, + enable_all=True, + ) + + return Agent( + model=model, + name="financial-analyst", + role="Financial Analysis Specialist", + goal="Perform comprehensive financial analysis including stock performance, fundamentals, and analyst sentiment", + system_prompt="""You are a financial analyst with expertise in company valuation, financial statement + analysis, and market research. Your role is to analyze financial data, stock performance, company + fundamentals, analyst recommendations, and market sentiment. Provide clear insights on financial + health, growth prospects, and investment considerations.""", + tools=financial_tools.functions(), + tool_call_limit=10, + ) + + +def create_sales_strategist_subagent(model: str = "openai/gpt-4o-mini") -> Agent: + """Create specialized subagent for sales strategy development. + + Args: + model: Model identifier for the subagent + + Returns: + Configured Agent instance for sales strategy development + """ + return Agent( + model=model, + name="sales-strategist", + role="Sales Strategy Specialist", + goal="Develop comprehensive, tailored sales strategies based on company research, industry analysis, and market insights", + system_prompt="""You are a sales strategy expert with deep knowledge of B2B and B2C sales, + go-to-market strategies, and revenue generation. Your role is to develop tailored sales strategies + that align with company capabilities, market opportunities, and competitive positioning. Create + actionable strategies covering target segments, value propositions, sales channels, pricing, + messaging, and success metrics.""", + tool_call_limit=5, + ) + diff --git a/task_examples/company_research_sales_strategy/task_builder.py b/task_examples/company_research_sales_strategy/task_builder.py new file mode 100644 index 0000000..27f4ed6 --- /dev/null +++ b/task_examples/company_research_sales_strategy/task_builder.py @@ -0,0 +1,72 @@ +""" +Task description builder for company research and sales strategy. + +Constructs comprehensive task descriptions based on input parameters. +""" + +from __future__ import annotations + +from typing import Optional + + +def build_research_task( + company_name: str, + company_symbol: Optional[str] = None, + industry: Optional[str] = None, +) -> str: + """Build comprehensive task description for company research and sales strategy. + + Args: + company_name: Name of the target company + company_symbol: Optional stock symbol for financial analysis + industry: Optional industry name for focused analysis + + Returns: + Comprehensive task description string + """ + task_description = f"""Conduct comprehensive research and develop a sales strategy for {company_name}. + + Requirements: + 1. **Company Research**: Use the 'company-researcher' subagent to gather comprehensive information about {company_name}: + - Business model and core products/services + - Target markets and customer segments + - Competitive advantages and differentiators + - Recent news and developments + - Company website and headquarters information + + 2. **Industry Analysis**: Use the 'industry-analyst' subagent to analyze the industry: + - Market size and growth trends + - Key players and competitive landscape + - Emerging technologies and innovations + - Regulatory environment + - Market opportunities and threats + {"- Focus on the " + industry + " industry" if industry else ""} + + 3. **Financial Analysis**: {"Use the 'financial-analyst' subagent to analyze financial data" if company_symbol else "Note: No stock symbol provided, skip detailed financial analysis"}: + {"- Stock symbol: " + company_symbol if company_symbol else ""} + - Current stock price and market cap + - Financial fundamentals and ratios + - Analyst recommendations and sentiment + - Recent financial news + + 4. **Sales Strategy Development**: Use the 'sales-strategist' subagent to develop a tailored sales strategy: + - Target customer segments + - Value propositions + - Recommended sales channels + - Pricing strategy recommendations + - Competitive positioning + - Key messaging points + - Sales process recommendations + - Success metrics + + 5. **Synthesis**: Create a comprehensive executive summary with: + - Key insights from all analyses + - Recommended next steps + - Strategic recommendations + + Use the planning tool to break down this complex task into manageable steps. Execute subagent tasks + in parallel when possible to maximize efficiency. Ensure all findings are well-documented and + actionable.""" + + return task_description + diff --git a/task_examples/company_research_sales_strategy/upsonic_configs.json b/task_examples/company_research_sales_strategy/upsonic_configs.json new file mode 100644 index 0000000..8648dc3 --- /dev/null +++ b/task_examples/company_research_sales_strategy/upsonic_configs.json @@ -0,0 +1,104 @@ +{ + "envinroment_variables": { + "UPSONIC_WORKERS_AMOUNT": { + "type": "number", + "description": "The number of workers for the Upsonic API", + "default": 1 + }, + "API_WORKERS": { + "type": "number", + "description": "The number of workers for the Upsonic API", + "default": 1 + }, + "RUNNER_CONCURRENCY": { + "type": "number", + "description": "The number of runners for the Upsonic API", + "default": 1 + }, + "NEW_FEATURE_FLAG": { + "type": "string", + "description": "New feature flag added in version 2.0", + "default": "enabled" + } + }, + "machine_spec": { + "cpu": 2, + "memory": 4096, + "storage": 1024 + }, + "agent_name": "Company Research & Sales Strategy Agent", + "description": "Comprehensive AI agent system that conducts deep company research, analyzes industry trends, performs financial analysis, and develops tailored sales strategies using DeepAgent with specialized subagents", + "icon": "briefcase", + "language": "python", + "streamlit": false, + "proxy_agent": false, + "dependencies": { + "api": [ + "upsonic", + "upsonic[tools]", + "upsonic[storage]" + ], + "development": [ + "python-dotenv", + "pytest" + ] + }, + "entrypoints": { + "api_file": "main.py", + "streamlit_file": "streamlit_app.py" + }, + "input_schema": { + "inputs": { + "company_name": { + "type": "string", + "description": "Name of the target company to research (required)", + "required": true, + "default": null + }, + "company_symbol": { + "type": "string", + "description": "Optional stock symbol (e.g., AAPL, TSLA) for financial analysis", + "required": false, + "default": null + }, + "industry": { + "type": "string", + "description": "Optional industry name for focused industry analysis", + "required": false, + "default": null + }, + "enable_memory": { + "type": "boolean", + "description": "Whether to enable memory persistence for session history", + "required": false, + "default": true + }, + "storage_path": { + "type": "string", + "description": "Optional path for SQLite storage database file", + "required": false, + "default": "company_research.db" + }, + "model": { + "type": "string", + "description": "Optional model identifier (e.g., openai/gpt-4o, openai/gpt-4o-mini)", + "required": false, + "default": "openai/gpt-4o" + } + } + }, + "output_schema": { + "company_name": { + "type": "string", + "description": "The researched company name" + }, + "comprehensive_report": { + "type": "string", + "description": "Comprehensive research report containing company research, industry analysis, financial analysis, and sales strategy" + }, + "research_completed": { + "type": "boolean", + "description": "Whether the research was successfully completed" + } + } +} \ No newline at end of file diff --git a/task_examples/groq_code_review_agent/README.md b/task_examples/groq_code_review_agent/README.md new file mode 100644 index 0000000..f6ebe57 --- /dev/null +++ b/task_examples/groq_code_review_agent/README.md @@ -0,0 +1,239 @@ +# Groq Code Review & Best Practices Agent + +A fast and comprehensive Code Review Agent built with the **Upsonic AI Agent Framework** using **Groq's ultra-fast inference**. This example demonstrates how to use Groq models for rapid code analysis, security vulnerability detection, and best practices recommendations. + +## Features + +- ⚔ **Ultra-Fast Reviews**: Leverages Groq's industry-leading inference speed for rapid code analysis +- šŸ”’ **Security Analysis**: Identifies vulnerabilities like SQL injection, XSS, and insecure patterns +- šŸš€ **Performance Review**: Analyzes algorithmic complexity and optimization opportunities +- ✨ **Best Practices**: Compares code against industry standards and suggests improvements +- šŸ“Š **Structured Output**: Returns typed, validated responses using Pydantic schemas +- šŸ” **Web Search Integration**: Uses DuckDuckGo to find current best practices and security advisories +- šŸŽÆ **Focused Analysis**: Supports custom focus areas for targeted reviews + +## Prerequisites + +- Python 3.10+ +- Groq API key (get one at [console.groq.com](https://console.groq.com)) + +## Installation + +1. **Navigate to this directory**: + ```bash + cd examples/groq_code_review_agent + ``` + +2. **Install dependencies**: + ```bash + # Install all dependencies + upsonic install + + # Or install specific sections: + upsonic install api # API dependencies only (default) + upsonic install development # Development dependencies only + ``` + +3. **Set up environment variables**: + ```bash + export GROQ_API_KEY="your-groq-api-key" + ``` + +## Usage + +### Run the API Server + +To run the agent as a FastAPI server: + +```bash +upsonic run +``` + +The API will be available at `http://localhost:8000` with automatic OpenAPI documentation at `http://localhost:8000/docs`. + +OR + +You can run the agent directly: + +```bash +python3 main.py +``` + +**Example API Call:** +```bash +curl -X POST http://localhost:8000/call \ + -H "Content-Type: application/json" \ + -d '{ + "code": "def process_user(input):\n query = \"SELECT * FROM users WHERE id = \" + input\n return db.execute(query)", + "language": "python", + "focus_areas": ["security", "best_practices"] + }' +``` + +## Project Structure + +``` +groq_code_review_agent/ +ā”œā”€ā”€ main.py # Entry point with main() and amain() functions +ā”œā”€ā”€ agent.py # Agent creation with Groq model configuration +ā”œā”€ā”€ schemas.py # Pydantic output schemas for structured responses +ā”œā”€ā”€ task_builder.py # Task description builder +ā”œā”€ā”€ upsonic_configs.json # Upsonic configuration and dependencies +└── README.md # This file +``` + +## How It Works + +1. **Groq Model**: Uses Groq's `llama-3.3-70b-versatile` model for fast, high-quality code analysis. The model can also be switched to `llama-3.1-8b-instant` for even faster responses. + +2. **Structured Output**: Leverages Pydantic schemas to ensure consistent, typed output including: + - Severity-rated issues with code examples + - Security analysis with OWASP category mapping + - Performance analysis with complexity concerns + - Code quality metrics and ratings + +3. **Web Search Integration**: Uses DuckDuckGo to search for: + - Current security best practices + - Language-specific coding standards + - Recent CVEs and security advisories + - Performance benchmarks and optimization techniques + +4. **Focused Analysis**: Supports optional focus areas to prioritize specific aspects: + - `security`: Emphasize vulnerability detection + - `performance`: Focus on optimization opportunities + - `best_practices`: Concentrate on coding standards + - `style`: Focus on readability and conventions + +## Available Groq Models + +| Model | Use Case | Speed | +|-------|----------|-------| +| `groq/llama-3.3-70b-versatile` | Comprehensive analysis | Fast | +| `groq/llama-3.1-8b-instant` | Quick reviews, simpler code | Ultra-fast | +| `groq/gemma2-9b-it` | Balanced performance | Fast | +| `groq/qwen-2.5-coder-32b` | Specialized for code | Fast | + +## Example Output + +When you run the agent, you'll see a structured output like this: + +``` +================================================================================ +šŸ” CODE REVIEW COMPLETED SUCCESSFULLY +================================================================================ + +šŸ“‹ Language: python +šŸŽÆ Focus Areas: security, performance, best_practices +⭐ Overall Rating: NEEDS_IMPROVEMENT + +-------------------------------------------------------------------------------- +šŸ“ SUMMARY +-------------------------------------------------------------------------------- +The code has several issues, including a critical SQL injection vulnerability, +high-severity input validation issue, and medium-severity performance issue. + +-------------------------------------------------------------------------------- +🚨 ISSUES FOUND (4) +-------------------------------------------------------------------------------- + +1. šŸ”“ [CRITICAL] SQL Injection Vulnerability + Category: security + Location: query = "SELECT * FROM users WHERE name = '" + user_input + "'" + Description: SQL injection vulnerability + Suggestion: Use parameterized queries + Example: query = "SELECT * FROM users WHERE name = ?" + +2. 🟠 [HIGH] Input Validation + Category: security + Description: Lack of input validation + Suggestion: Validate user input + +3. 🟔 [MEDIUM] Inefficient User Lookup + Category: performance + Description: Inefficient user lookup + Suggestion: Use a dictionary for user lookup + +-------------------------------------------------------------------------------- +šŸ”’ SECURITY ANALYSIS +-------------------------------------------------------------------------------- + Risk Level: HIGH + Vulnerabilities Found: 1 + OWASP Categories: A03:2021-Injection + Recommendations: + • Use parameterized queries + • Validate user input + +-------------------------------------------------------------------------------- +⚔ PERFORMANCE ANALYSIS +-------------------------------------------------------------------------------- + Complexity Issues: + • Inefficient user lookup + Optimization Opportunities: + • Use a dictionary for user lookup + +-------------------------------------------------------------------------------- +šŸ“Š CODE QUALITY METRICS +-------------------------------------------------------------------------------- + Readability: good + Maintainability: fair + Documentation: fair + Test Coverage: Write unit tests for each function + +-------------------------------------------------------------------------------- +āœ… POSITIVE ASPECTS +-------------------------------------------------------------------------------- + • Good naming conventions + • Clear code structure + +-------------------------------------------------------------------------------- +šŸŽÆ PRIORITY FIXES +-------------------------------------------------------------------------------- + 1. SQL injection vulnerability + 2. Input validation + 3. Inefficient user lookup + +-------------------------------------------------------------------------------- +šŸ“š LEARNING RESOURCES +-------------------------------------------------------------------------------- + • https://www.python.org/dev/peps/pep-0008/ + • https://docs.python.org/3/tutorial/errors.html + +================================================================================ +``` + +The structured `CodeReviewOutput` schema ensures consistent, typed responses: + +```python +CodeReviewOutput( + summary="...", + overall_rating="needs_improvement", # Literal type + issues=[CodeIssue(severity="critical", category="security", ...)], + security_analysis=SecurityAnalysis(vulnerabilities_found=1, risk_level="high", ...), + performance_analysis=PerformanceAnalysis(...), + code_quality=CodeQualityMetrics(readability_score="good", ...), + positive_aspects=["Good naming conventions", ...], + priority_fixes=["SQL injection vulnerability", ...], + learning_resources=["https://...", ...] +) +``` + +## Input Parameters + +| Parameter | Type | Required | Description | +|-----------|------|----------|-------------| +| `code` | string | āœ“ | The code snippet to review | +| `language` | string | āœ“ | Programming language (python, javascript, etc.) | +| `focus_areas` | array | āœ— | Areas to prioritize: security, performance, best_practices, style | +| `context` | string | āœ— | Project context for tailored recommendations | +| `model` | string | āœ— | Groq model identifier (default: groq/llama-3.3-70b-versatile) | + +## Why Groq? + +Groq's custom LPU (Language Processing Unit) hardware provides: +- **Speed**: Up to 10x faster inference than GPU-based solutions +- **Consistency**: Low latency variance for production workloads +- **Cost Efficiency**: Competitive pricing with high throughput +- **Quality**: Access to top-tier open-source models (LLaMA, Gemma, etc.) + +This makes Groq ideal for code review workflows where fast feedback loops improve developer productivity. + diff --git a/task_examples/groq_code_review_agent/agent.py b/task_examples/groq_code_review_agent/agent.py new file mode 100644 index 0000000..470e222 --- /dev/null +++ b/task_examples/groq_code_review_agent/agent.py @@ -0,0 +1,162 @@ +""" +Code Review Agent creation and configuration. + +Creates the main Agent that performs comprehensive code reviews +using Groq's fast inference capabilities with web search for best practices. +""" + +from __future__ import annotations + +from typing import Optional, List + +from upsonic import Agent +from upsonic.tools.common_tools.duckduckgo import duckduckgo_search_tool + + +def create_code_review_agent( + model: str = "groq/llama-3.3-70b-versatile", + tools: Optional[List] = None, +) -> Agent: + """Create the code review agent with Groq model. + + Args: + model: Groq model identifier for the agent + tools: Optional list of additional tools + + Returns: + Configured Agent instance for code review + """ + ddg_search = duckduckgo_search_tool(duckduckgo_client=None, max_results=5) + + agent_tools = [ddg_search] + if tools: + agent_tools.extend(tools) + + agent = Agent( + model=model, + name="code-review-agent", + role="Senior Software Engineer & Code Reviewer", + goal="Provide comprehensive code reviews with actionable feedback on security, performance, best practices, and code quality", + system_prompt="""You are an expert senior software engineer with 15+ years of experience + in code review and software architecture. Your expertise spans multiple programming languages + and you have deep knowledge of: + + - Security vulnerabilities and secure coding practices + - Performance optimization and algorithmic efficiency + - Design patterns and software architecture + - Clean code principles and maintainability + - Testing strategies and code coverage + - Industry best practices and coding standards + + When reviewing code: + 1. Identify potential bugs and logic errors + 2. Detect security vulnerabilities (SQL injection, XSS, buffer overflows, etc.) + 3. Suggest performance improvements + 4. Recommend better design patterns or abstractions + 5. Point out code style and readability issues + 6. Suggest appropriate test cases + + Use web search to find current best practices and industry standards when needed. + + Always provide: + - Clear explanation of issues found + - Severity level (Critical, High, Medium, Low) + - Specific code suggestions for fixes + - References to relevant documentation or best practices + + Be constructive and educational in your feedback. Help developers understand + not just what to fix, but why.""", + tools=agent_tools, + tool_call_limit=10, + ) + + return agent + + +def create_security_focused_agent( + model: str = "groq/llama-3.1-8b-instant", +) -> Agent: + """Create a security-focused code review agent. + + Args: + model: Groq model identifier for the agent + + Returns: + Configured Agent instance for security review + """ + ddg_search = duckduckgo_search_tool(duckduckgo_client=None, max_results=5) + + return Agent( + model=model, + name="security-review-agent", + role="Application Security Specialist", + goal="Identify and report security vulnerabilities in code with remediation guidance", + system_prompt="""You are a security expert specializing in application security and + secure coding practices. Your focus is on identifying: + + - SQL Injection vulnerabilities + - Cross-Site Scripting (XSS) + - Cross-Site Request Forgery (CSRF) + - Insecure Direct Object References + - Security Misconfiguration + - Sensitive Data Exposure + - Authentication/Authorization flaws + - Input validation issues + - Cryptographic weaknesses + - Race conditions and timing attacks + + For each vulnerability found: + 1. Explain the attack vector + 2. Demonstrate potential exploit scenarios + 3. Provide secure code alternatives + 4. Reference OWASP guidelines when applicable + + Use web search to find current CVEs and security advisories related to the + libraries or patterns being used.""", + tools=[ddg_search], + tool_call_limit=8, + ) + + +def create_performance_focused_agent( + model: str = "groq/llama-3.1-8b-instant", +) -> Agent: + """Create a performance-focused code review agent. + + Args: + model: Groq model identifier for the agent + + Returns: + Configured Agent instance for performance review + """ + ddg_search = duckduckgo_search_tool(duckduckgo_client=None, max_results=5) + + return Agent( + model=model, + name="performance-review-agent", + role="Performance Engineering Specialist", + goal="Analyze code for performance bottlenecks and optimization opportunities", + system_prompt="""You are a performance engineering specialist with expertise in: + + - Algorithmic complexity analysis (Big O notation) + - Memory management and optimization + - Database query optimization + - Caching strategies + - Concurrent programming and parallelism + - I/O optimization + - Profiling and benchmarking + + When analyzing code: + 1. Identify inefficient algorithms or data structures + 2. Spot memory leaks or excessive allocations + 3. Find N+1 query problems and database issues + 4. Suggest caching opportunities + 5. Identify blocking operations that could be async + 6. Recommend profiling strategies + + Use web search to find current benchmarks and performance best practices + for the specific language and framework being used.""", + tools=[ddg_search], + tool_call_limit=8, + ) + diff --git a/task_examples/groq_code_review_agent/main.py b/task_examples/groq_code_review_agent/main.py new file mode 100644 index 0000000..3983916 --- /dev/null +++ b/task_examples/groq_code_review_agent/main.py @@ -0,0 +1,214 @@ +from __future__ import annotations + +from typing import Dict, Any + +from upsonic import Task + +try: + from .agent import create_code_review_agent + from .task_builder import build_review_task + from .schemas import CodeReviewOutput +except ImportError: + from agent import create_code_review_agent + from task_builder import build_review_task + from schemas import CodeReviewOutput + + +def main(inputs: Dict[str, Any]) -> Dict[str, Any]: + """ + Main function for code review and best practices analysis. + + Args: + inputs: Dictionary containing: + - code: The code snippet to review (required) + - language: Programming language of the code (required) + - focus_areas: Optional list of areas to focus on (security, performance, etc.) + - context: Optional context about the codebase or project + - model: Optional model identifier (default: "groq/llama-3.3-70b-versatile") + + Returns: + Dictionary containing comprehensive code review + """ + code = inputs.get("code") + if not code: + raise ValueError("code is required in inputs") + + language = inputs.get("language") + if not language: + raise ValueError("language is required in inputs") + + focus_areas = inputs.get("focus_areas", []) + context = inputs.get("context") + model = inputs.get("model", "groq/llama-3.3-70b-versatile") + + agent = create_code_review_agent(model=model) + + task_description = build_review_task( + code=code, + language=language, + focus_areas=focus_areas, + context=context, + ) + + task = Task(task_description, response_format=CodeReviewOutput) + + result = agent.do(task) + + return { + "language": language, + "focus_areas": focus_areas, + "review_report": result, + "review_completed": True, + } + + + +if __name__ == "__main__": + import json + import sys + + test_code = ''' +def calculate_discount(price, discount_percent): + if discount_percent > 100: + discount_percent = 100 + final_price = price - (price * discount_percent / 100) + return final_price + +def process_user_data(user_input): + query = "SELECT * FROM users WHERE name = '" + user_input + "'" + return execute_query(query) + +class UserManager: + users = [] + + def add_user(self, name, email): + self.users.append({"name": name, "email": email}) + + def get_user(self, name): + for user in self.users: + if user["name"] == name: + return user + return None +''' + + test_inputs = { + "code": test_code, + "language": "python", + "focus_areas": ["security", "performance", "best_practices"], + "context": "E-commerce application backend", + "model": "groq/llama-3.3-70b-versatile", + } + + if len(sys.argv) > 1: + try: + with open(sys.argv[1], "r") as f: + test_inputs = json.load(f) + except Exception as e: + print(f"Error loading JSON file: {e}") + print("Using default test inputs") + + try: + result = main(test_inputs) + report: CodeReviewOutput = result.get('review_report') + + print("\n" + "=" * 80) + print("šŸ” CODE REVIEW COMPLETED SUCCESSFULLY") + print("=" * 80) + + print(f"\nšŸ“‹ Language: {result.get('language')}") + print(f"šŸŽÆ Focus Areas: {', '.join(result.get('focus_areas', []))}") + print(f"⭐ Overall Rating: {report.overall_rating.upper()}") + + print("\n" + "-" * 80) + print("šŸ“ SUMMARY") + print("-" * 80) + print(report.summary) + + print("\n" + "-" * 80) + print(f"🚨 ISSUES FOUND ({len(report.issues)})") + print("-" * 80) + for i, issue in enumerate(report.issues, 1): + severity_icons = { + "critical": "šŸ”“", + "high": "🟠", + "medium": "🟔", + "low": "🟢", + "info": "šŸ”µ" + } + icon = severity_icons.get(issue.severity, "⚪") + print(f"\n{i}. {icon} [{issue.severity.upper()}] {issue.title}") + print(f" Category: {issue.category}") + if issue.line_reference: + print(f" Location: {issue.line_reference}") + print(f" Description: {issue.description}") + print(f" Suggestion: {issue.suggestion}") + if issue.code_example: + print(f" Example: {issue.code_example}") + + print("\n" + "-" * 80) + print("šŸ”’ SECURITY ANALYSIS") + print("-" * 80) + sec = report.security_analysis + print(f" Risk Level: {sec.risk_level.upper()}") + print(f" Vulnerabilities Found: {sec.vulnerabilities_found}") + if sec.owasp_categories: + print(f" OWASP Categories: {', '.join(sec.owasp_categories)}") + if sec.recommendations: + print(" Recommendations:") + for rec in sec.recommendations: + print(f" • {rec}") + + print("\n" + "-" * 80) + print("⚔ PERFORMANCE ANALYSIS") + print("-" * 80) + perf = report.performance_analysis + if perf.complexity_issues: + print(" Complexity Issues:") + for issue in perf.complexity_issues: + print(f" • {issue}") + if perf.memory_concerns: + print(" Memory Concerns:") + for concern in perf.memory_concerns: + print(f" • {concern}") + if perf.optimization_opportunities: + print(" Optimization Opportunities:") + for opp in perf.optimization_opportunities: + print(f" • {opp}") + + print("\n" + "-" * 80) + print("šŸ“Š CODE QUALITY METRICS") + print("-" * 80) + quality = report.code_quality + print(f" Readability: {quality.readability_score}") + print(f" Maintainability: {quality.maintainability_score}") + print(f" Documentation: {quality.documentation_quality}") + print(f" Test Coverage: {quality.test_coverage_suggestion}") + + if report.positive_aspects: + print("\n" + "-" * 80) + print("āœ… POSITIVE ASPECTS") + print("-" * 80) + for aspect in report.positive_aspects: + print(f" • {aspect}") + + print("\n" + "-" * 80) + print("šŸŽÆ PRIORITY FIXES") + print("-" * 80) + for i, fix in enumerate(report.priority_fixes, 1): + print(f" {i}. {fix}") + + if report.learning_resources: + print("\n" + "-" * 80) + print("šŸ“š LEARNING RESOURCES") + print("-" * 80) + for resource in report.learning_resources: + print(f" • {resource}") + + print("\n" + "=" * 80) + + except Exception as e: + print(f"\nāŒ Error during execution: {e}") + import traceback + traceback.print_exc() + sys.exit(1) + diff --git a/task_examples/groq_code_review_agent/schemas.py b/task_examples/groq_code_review_agent/schemas.py new file mode 100644 index 0000000..a0e8e84 --- /dev/null +++ b/task_examples/groq_code_review_agent/schemas.py @@ -0,0 +1,129 @@ +""" +Output schemas for code review agent. + +Defines structured Pydantic models for type-safe outputs from the +code review analysis. +""" + +from __future__ import annotations + +from typing import List, Optional, Literal +from pydantic import BaseModel, Field + + +class CodeIssue(BaseModel): + """Represents a single code issue found during review.""" + + severity: Literal["critical", "high", "medium", "low", "info"] = Field( + description="Severity level of the issue" + ) + category: str = Field( + description="Category of the issue (e.g., security, performance, style, bug)" + ) + line_reference: Optional[str] = Field( + default=None, + description="Line number or code section reference" + ) + title: str = Field( + description="Brief title describing the issue" + ) + description: str = Field( + description="Detailed description of the issue" + ) + suggestion: str = Field( + description="Suggested fix or improvement" + ) + code_example: Optional[str] = Field( + default=None, + description="Example of correct/improved code" + ) + + +class SecurityAnalysis(BaseModel): + """Security-focused analysis results.""" + + vulnerabilities_found: int = Field( + description="Number of security vulnerabilities found" + ) + risk_level: Literal["critical", "high", "medium", "low", "none"] = Field( + description="Overall security risk level" + ) + owasp_categories: List[str] = Field( + default_factory=list, + description="Relevant OWASP categories for issues found" + ) + recommendations: List[str] = Field( + default_factory=list, + description="Security recommendations" + ) + + +class PerformanceAnalysis(BaseModel): + """Performance-focused analysis results.""" + + complexity_issues: List[str] = Field( + default_factory=list, + description="Algorithmic complexity concerns" + ) + memory_concerns: List[str] = Field( + default_factory=list, + description="Memory usage concerns" + ) + optimization_opportunities: List[str] = Field( + default_factory=list, + description="Potential performance optimizations" + ) + + +class CodeQualityMetrics(BaseModel): + """Code quality assessment metrics.""" + + readability_score: Literal["excellent", "good", "fair", "poor"] = Field( + description="Code readability assessment" + ) + maintainability_score: Literal["excellent", "good", "fair", "poor"] = Field( + description="Code maintainability assessment" + ) + test_coverage_suggestion: str = Field( + description="Suggestions for test coverage" + ) + documentation_quality: Literal["excellent", "good", "fair", "poor", "missing"] = Field( + description="Documentation quality assessment" + ) + + +class CodeReviewOutput(BaseModel): + """Complete code review output.""" + + summary: str = Field( + description="Executive summary of the code review" + ) + overall_rating: Literal["excellent", "good", "needs_improvement", "poor", "critical"] = Field( + description="Overall code quality rating" + ) + issues: List[CodeIssue] = Field( + default_factory=list, + description="List of all issues found" + ) + security_analysis: SecurityAnalysis = Field( + description="Security analysis results" + ) + performance_analysis: PerformanceAnalysis = Field( + description="Performance analysis results" + ) + code_quality: CodeQualityMetrics = Field( + description="Code quality metrics" + ) + positive_aspects: List[str] = Field( + default_factory=list, + description="Positive aspects of the code" + ) + priority_fixes: List[str] = Field( + default_factory=list, + description="Top priority items to fix, in order" + ) + learning_resources: List[str] = Field( + default_factory=list, + description="Recommended resources for improvement" + ) + diff --git a/task_examples/groq_code_review_agent/task_builder.py b/task_examples/groq_code_review_agent/task_builder.py new file mode 100644 index 0000000..744398e --- /dev/null +++ b/task_examples/groq_code_review_agent/task_builder.py @@ -0,0 +1,97 @@ +""" +Task description builder for code review agent. + +Constructs comprehensive task descriptions based on input parameters. +""" + +from __future__ import annotations + +from typing import Optional, List + + +def build_review_task( + code: str, + language: str, + focus_areas: Optional[List[str]] = None, + context: Optional[str] = None, +) -> str: + """Build comprehensive task description for code review. + + Args: + code: The code snippet to review + language: Programming language of the code + focus_areas: Optional list of areas to focus on + context: Optional context about the codebase + + Returns: + Comprehensive task description string + """ + focus_section = "" + if focus_areas: + focus_list = ", ".join(focus_areas) + focus_section = f""" + **Priority Focus Areas**: {focus_list} + - Pay special attention to these areas during your review + - Provide detailed analysis for each focus area""" + + context_section = "" + if context: + context_section = f""" + **Project Context**: {context} + - Consider this context when evaluating design decisions + - Tailor recommendations to fit the project requirements""" + + task_description = f"""Perform a comprehensive code review of the following {language} code. + +**Code to Review**: +```{language} +{code} +``` +{focus_section} +{context_section} + +**Review Requirements**: + +1. **Bug Detection**: + - Identify potential bugs and logic errors + - Look for edge cases that might not be handled + - Check for null/undefined handling + +2. **Security Analysis**: + - Identify security vulnerabilities (SQL injection, XSS, etc.) + - Check for sensitive data exposure + - Verify input validation and sanitization + - Use web search to find current security best practices for {language} + +3. **Performance Review**: + - Analyze algorithmic complexity + - Identify performance bottlenecks + - Suggest optimization opportunities + - Look for inefficient patterns + +4. **Code Quality Assessment**: + - Evaluate code readability and structure + - Check for proper error handling + - Assess naming conventions + - Review code organization and modularity + +5. **Best Practices**: + - Compare against {language} best practices + - Suggest design pattern improvements + - Recommend testing strategies + - Use web search to find current industry standards + +6. **Documentation**: + - Assess documentation quality + - Suggest necessary documentation additions + - Check for clear and helpful comments + +Provide your analysis in a structured format with: +- Clear severity levels for each issue +- Specific code examples for fixes +- Actionable recommendations +- Priority ordering for fixes +- Educational explanations to help the developer learn""" + + return task_description + diff --git a/task_examples/groq_code_review_agent/upsonic_configs.json b/task_examples/groq_code_review_agent/upsonic_configs.json new file mode 100644 index 0000000..5579b38 --- /dev/null +++ b/task_examples/groq_code_review_agent/upsonic_configs.json @@ -0,0 +1,102 @@ +{ + "envinroment_variables": { + "UPSONIC_WORKERS_AMOUNT": { + "type": "number", + "description": "The number of workers for the Upsonic API", + "default": 1 + }, + "API_WORKERS": { + "type": "number", + "description": "The number of workers for the Upsonic API", + "default": 1 + }, + "RUNNER_CONCURRENCY": { + "type": "number", + "description": "The number of runners for the Upsonic API", + "default": 1 + }, + "GROQ_API_KEY": { + "type": "string", + "description": "Groq API key for authentication", + "required": true + } + }, + "machine_spec": { + "cpu": 1, + "memory": 2048, + "storage": 512 + }, + "agent_name": "Groq Code Review & Best Practices Agent", + "description": "Fast and comprehensive code review agent powered by Groq's ultra-fast inference. Analyzes code for security vulnerabilities, performance issues, best practices, and provides actionable improvement suggestions.", + "icon": "code", + "language": "python", + "streamlit": false, + "proxy_agent": false, + "dependencies": { + "api": [ + "upsonic", + "upsonic[tools]" + ], + "development": [ + "python-dotenv", + "pytest" + ] + }, + "entrypoints": { + "api_file": "main.py", + "streamlit_file": "streamlit_app.py" + }, + "input_schema": { + "inputs": { + "code": { + "type": "string", + "description": "The code snippet to review (required)", + "required": true, + "default": null + }, + "language": { + "type": "string", + "description": "Programming language of the code (e.g., python, javascript, java)", + "required": true, + "default": null + }, + "focus_areas": { + "type": "array", + "description": "Optional list of areas to focus on (security, performance, best_practices, style)", + "required": false, + "default": [] + }, + "context": { + "type": "string", + "description": "Optional context about the codebase or project", + "required": false, + "default": null + }, + "model": { + "type": "string", + "description": "Groq model identifier (e.g., groq/llama-3.3-70b-versatile, groq/llama-3.1-8b-instant)", + "required": false, + "default": "groq/llama-3.3-70b-versatile" + } + } + }, + "output_schema": { + "language": { + "type": "string", + "description": "The programming language of the reviewed code" + }, + "focus_areas": { + "type": "array", + "description": "The focus areas that were analyzed" + }, + "review_report": { + "type": "object", + "description": "Comprehensive code review report with issues, suggestions, and metrics" + }, + "review_completed": { + "type": "boolean", + "description": "Whether the review was successfully completed" + } + } +} +