From 0ceba80c609c459f612d7fd4e17fd41f8912fe1e Mon Sep 17 00:00:00 2001 From: harshalmore31 Date: Fri, 1 Aug 2025 11:06:00 +0530 Subject: [PATCH 1/6] fixed links --- docs/swarms_cloud/swarm_types.md | 33 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/docs/swarms_cloud/swarm_types.md b/docs/swarms_cloud/swarm_types.md index f6091501..2e69466d 100644 --- a/docs/swarms_cloud/swarm_types.md +++ b/docs/swarms_cloud/swarm_types.md @@ -1,30 +1,27 @@ # Multi-Agent Architectures -Each multi-agent architecture type is designed for specific use cases and can be combined to create powerful multi-agent systems. Here's a comprehensive overview of each available swarm: +Each multi-agent architecture type is designed for specific use cases and can be combined to create powerful multi-agent systems. Below is an overview of each available swarm type: | Swarm Type | Description | Learn More | -|---------------------|------------------------------------------------------------------------------|------------| -| AgentRearrange | Dynamically reorganizes agents to optimize task performance and efficiency. Optimizes agent performance by dynamically adjusting their roles and positions within the workflow. This architecture is particularly useful when the effectiveness of agents depends on their sequence or arrangement. | [Learn More](/swarms/structs/agent_rearrange) | -| MixtureOfAgents | Creates diverse teams of specialized agents, each bringing unique capabilities to solve complex problems. Each agent contributes unique skills to achieve the overall goal, making it excel at tasks requiring multiple types of expertise or processing. | [Learn More](/swarms/structs/moa) | -| SpreadSheetSwarm | Provides a structured approach to data management and operations, making it ideal for tasks involving data analysis, transformation, and systematic processing in a spreadsheet-like structure. | [Learn More](/swarms/structs/spreadsheet_swarm) | -| SequentialWorkflow | Ensures strict process control by executing tasks in a predefined order. Perfect for workflows where each step depends on the completion of previous steps. | [Learn More](/swarms/structs/sequential_workflow) | -| ConcurrentWorkflow | Maximizes efficiency by running independent tasks in parallel, significantly reducing overall processing time for complex operations. Ideal for independent tasks that can be processed simultaneously. | [Learn More](/swarms/structs/concurrentworkflow) | -| GroupChat | Enables dynamic collaboration between agents through a chat-based interface, facilitating real-time information sharing and decision-making. | [Learn More](/swarms/structs/group_chat) | -| MultiAgentRouter | Acts as an intelligent task dispatcher, ensuring optimal distribution of work across available agents based on their capabilities and current workload. | [Learn More](/swarms/structs/multi_agent_router) | -| AutoSwarmBuilder | Simplifies swarm creation by automatically configuring agent architectures based on task requirements and performance metrics. | [Learn More](/swarms/structs/auto_swarm_builder) | -| HiearchicalSwarm | Implements a structured approach to task management, with clear lines of authority and delegation across multiple agent levels. | [Learn More](/swarms/structs/multi_swarm_orchestration) | -| auto | Provides intelligent swarm selection based on context, automatically choosing the most effective architecture for given tasks. | [Learn More](/swarms/concept/how_to_choose_swarms) | -| MajorityVoting | Implements robust decision-making through consensus, particularly useful for tasks requiring collective intelligence or verification. | [Learn More](/swarms/structs/majorityvoting) | -| MALT | Specialized framework for language-based tasks, optimizing agent collaboration for complex language processing operations. | [Learn More](/swarms/structs/malt) | +|----------------------|------------------------------------------------------------------------------|------------| +| AgentRearrange | Dynamically reorganizes agents to optimize task performance and efficiency. Useful when agent effectiveness depends on their sequence or arrangement. | [Learn More](swarms_api.md#agentrearrange) | +| MixtureOfAgents | Builds diverse teams of specialized agents, each contributing unique skills to solve complex problems. Excels at tasks requiring multiple types of expertise. | [Learn More](swarms_api.md#mixtureofagents) | +| SpreadSheetSwarm | Provides a structured approach to data management and operations, ideal for tasks involving data analysis, transformation, and systematic processing in a spreadsheet-like structure. | [Learn More](swarms_api.md#spreadsheetswarm) | +| SequentialWorkflow | Executes tasks in a strict, predefined order. Perfect for workflows where each step depends on the completion of the previous one. | [Learn More](swarms_api.md#sequentialworkflow) | +| ConcurrentWorkflow | Runs independent tasks in parallel, significantly reducing processing time for complex operations. Ideal for tasks that can be processed simultaneously. | [Learn More](swarms_api.md#concurrentworkflow) | +| GroupChat | Enables dynamic collaboration between agents through a chat-based interface, facilitating real-time information sharing and decision-making. | [Learn More](swarms_api.md#groupchat) | +| MultiAgentRouter | Acts as an intelligent task dispatcher, distributing work across agents based on their capabilities and current workload. | [Learn More](swarms_api.md#multiagentrouter) | +| AutoSwarmBuilder | Automatically configures agent architectures based on task requirements and performance metrics, simplifying swarm creation. | [Learn More](swarms_api.md#autoswarmbuilder) | +| HierarchicalSwarm | Implements a structured, multi-level approach to task management, with clear lines of authority and delegation. | [Learn More](swarms_api.md#hierarchicalswarm) | +| Auto | Intelligently selects the most effective swarm architecture for a given task based on context. | [Learn More](swarms_api.md#auto) | +| MajorityVoting | Implements robust decision-making through consensus, ideal for tasks requiring collective intelligence or verification. | [Learn More](swarms_api_tools.md#majorityvoting) | +| MALT | Specialized framework for language-based tasks, optimizing agent collaboration for complex language processing operations. | [Learn More](swarms_api_tools.md#malt) | # Learn More -To learn more about Swarms architecture and how different swarm types work together, visit our comprehensive guides: +To explore Swarms architecture and how different swarm types work together, check out our comprehensive guides: - [Introduction to Multi-Agent Architectures](/swarms/concept/swarm_architectures) - - [How to Choose the Right Multi-Agent Architecture](/swarms/concept/how_to_choose_swarms) - - [Framework Architecture Overview](/swarms/concept/framework_architecture) - - [Building Custom Swarms](/swarms/structs/custom_swarm) From 117f49c3b2339e480c990c986e589d41ad4dfa58 Mon Sep 17 00:00:00 2001 From: harshalmore31 Date: Fri, 1 Aug 2025 12:39:38 +0530 Subject: [PATCH 2/6] seprate docs for each multi-agent structure for api --- docs/mkdocs.yml | 13 ++ docs/swarms_cloud/agent_rearrange.md | 176 ++++++++++++++++ docs/swarms_cloud/auto.md | 203 +++++++++++++++++++ docs/swarms_cloud/auto_swarm_builder.md | 195 ++++++++++++++++++ docs/swarms_cloud/concurrent_workflow.md | 198 ++++++++++++++++++ docs/swarms_cloud/group_chat.md | 204 +++++++++++++++++++ docs/swarms_cloud/hierarchical_swarm.md | 241 ++++++++++++++++++++++ docs/swarms_cloud/index.md | 0 docs/swarms_cloud/majority_voting.md | 240 ++++++++++++++++++++++ docs/swarms_cloud/malt.md | 248 +++++++++++++++++++++++ docs/swarms_cloud/mixture_of_agents.md | 187 +++++++++++++++++ docs/swarms_cloud/multi_agent_router.md | 224 ++++++++++++++++++++ docs/swarms_cloud/sequential_workflow.md | 192 ++++++++++++++++++ docs/swarms_cloud/spreadsheet_swarm.md | 232 +++++++++++++++++++++ docs/swarms_cloud/swarm_types.md | 24 +-- 15 files changed, 2565 insertions(+), 12 deletions(-) create mode 100644 docs/swarms_cloud/agent_rearrange.md create mode 100644 docs/swarms_cloud/auto.md create mode 100644 docs/swarms_cloud/auto_swarm_builder.md create mode 100644 docs/swarms_cloud/concurrent_workflow.md create mode 100644 docs/swarms_cloud/group_chat.md create mode 100644 docs/swarms_cloud/hierarchical_swarm.md create mode 100644 docs/swarms_cloud/index.md create mode 100644 docs/swarms_cloud/majority_voting.md create mode 100644 docs/swarms_cloud/malt.md create mode 100644 docs/swarms_cloud/mixture_of_agents.md create mode 100644 docs/swarms_cloud/multi_agent_router.md create mode 100644 docs/swarms_cloud/sequential_workflow.md create mode 100644 docs/swarms_cloud/spreadsheet_swarm.md diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 006ff72e..a371119c 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -446,6 +446,19 @@ nav: - Tools: "swarms_cloud/swarms_api_tools.md" - Multi-Agent: - Multi Agent Architectures Available: "swarms_cloud/swarm_types.md" + - Swarm Types: + - AgentRearrange: "swarms_cloud/agent_rearrange.md" + - MixtureOfAgents: "swarms_cloud/mixture_of_agents.md" + - SpreadSheetSwarm: "swarms_cloud/spreadsheet_swarm.md" + - SequentialWorkflow: "swarms_cloud/sequential_workflow.md" + - ConcurrentWorkflow: "swarms_cloud/concurrent_workflow.md" + - GroupChat: "swarms_cloud/group_chat.md" + - MultiAgentRouter: "swarms_cloud/multi_agent_router.md" + - AutoSwarmBuilder: "swarms_cloud/auto_swarm_builder.md" + - HierarchicalSwarm: "swarms_cloud/hierarchical_swarm.md" + - Auto: "swarms_cloud/auto.md" + - MajorityVoting: "swarms_cloud/majority_voting.md" + - MALT: "swarms_cloud/malt.md" - Examples: - Medical Swarm: "swarms/examples/swarms_api_medical.md" - Finance Swarm: "swarms/examples/swarms_api_finance.md" diff --git a/docs/swarms_cloud/agent_rearrange.md b/docs/swarms_cloud/agent_rearrange.md new file mode 100644 index 00000000..15c05125 --- /dev/null +++ b/docs/swarms_cloud/agent_rearrange.md @@ -0,0 +1,176 @@ +# AgentRearrange + +*Dynamically reorganizes agents to optimize task performance and efficiency* + +**Swarm Type**: `AgentRearrange` + +## Overview + +The AgentRearrange swarm type dynamically reorganizes the workflow between agents based on task requirements and performance metrics. This architecture is particularly useful when the effectiveness of agents depends on their sequence or arrangement, allowing for optimal task distribution and execution flow. + +Key features: +- **Dynamic Reorganization**: Automatically adjusts agent order based on task needs +- **Performance Optimization**: Optimizes workflow for maximum efficiency +- **Adaptive Sequencing**: Learns from execution patterns to improve arrangement +- **Flexible Task Distribution**: Distributes work based on agent capabilities + +## Use Cases + +- Complex workflows where task order matters +- Multi-step processes requiring optimization +- Tasks where agent performance varies by sequence +- Adaptive workflow management systems + +## API Usage + +### Basic AgentRearrange Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Document Processing Rearrange", + "description": "Process documents with dynamic agent reorganization", + "swarm_type": "AgentRearrange", + "task": "Analyze this legal document and extract key insights, then summarize findings and identify action items", + "agents": [ + { + "agent_name": "Document Analyzer", + "description": "Analyzes document content and structure", + "system_prompt": "You are an expert document analyst. Extract key information, themes, and insights from documents.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Legal Expert", + "description": "Provides legal context and interpretation", + "system_prompt": "You are a legal expert. Analyze documents for legal implications, risks, and compliance issues.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Summarizer", + "description": "Creates concise summaries and action items", + "system_prompt": "You are an expert at creating clear, actionable summaries from complex information.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.4 + } + ], + "rearrange_flow": "Optimize agent sequence based on document complexity and required output quality", + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Document Processing Rearrange", + "description": "Process documents with dynamic agent reorganization", + "swarm_type": "AgentRearrange", + "task": "Analyze this legal document and extract key insights, then summarize findings and identify action items", + "agents": [ + { + "agent_name": "Document Analyzer", + "description": "Analyzes document content and structure", + "system_prompt": "You are an expert document analyst. Extract key information, themes, and insights from documents.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Legal Expert", + "description": "Provides legal context and interpretation", + "system_prompt": "You are a legal expert. Analyze documents for legal implications, risks, and compliance issues.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Summarizer", + "description": "Creates concise summaries and action items", + "system_prompt": "You are an expert at creating clear, actionable summaries from complex information.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.4 + } + ], + "rearrange_flow": "Optimize agent sequence based on document complexity and required output quality", + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("AgentRearrange swarm completed successfully!") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Output: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "document-processing-rearrange", + "swarm_type": "AgentRearrange", + "task": "Analyze this legal document and extract key insights, then summarize findings and identify action items", + "output": { + "analysis": "Document analysis results...", + "legal_insights": "Legal implications and risks...", + "summary": "Concise summary of findings...", + "action_items": ["Action 1", "Action 2", "Action 3"] + }, + "metadata": { + "agent_sequence": ["Legal Expert", "Document Analyzer", "Summarizer"], + "rearrangement_reason": "Optimized for legal document analysis workflow", + "execution_time_seconds": 18.2, + "billing_info": { + "total_cost": 0.045 + } + } +} +``` + +## Configuration Options + +| Parameter | Type | Description | Default | +|-----------|------|-------------|---------| +| `rearrange_flow` | string | Instructions for how agents should be rearranged | None | +| `agents` | Array | List of agents to be dynamically arranged | Required | +| `max_loops` | integer | Maximum rearrangement iterations | 1 | + +## Best Practices + +- Provide clear `rearrange_flow` instructions for optimal reorganization +- Design agents with complementary but flexible roles +- Use when task complexity requires adaptive sequencing +- Monitor execution patterns to understand rearrangement decisions + +## Related Swarm Types + +- [SequentialWorkflow](sequential_workflow.md) - For fixed sequential processing +- [AutoSwarmBuilder](auto_swarm_builder.md) - For automatic swarm construction +- [HierarchicalSwarm](hierarchical_swarm.md) - For structured agent hierarchies \ No newline at end of file diff --git a/docs/swarms_cloud/auto.md b/docs/swarms_cloud/auto.md new file mode 100644 index 00000000..262797a1 --- /dev/null +++ b/docs/swarms_cloud/auto.md @@ -0,0 +1,203 @@ +# Auto + +*Intelligently selects the most effective swarm architecture for a given task* + +**Swarm Type**: `auto` (or `Auto`) + +## Overview + +The Auto swarm type intelligently selects the most effective swarm architecture for a given task based on context analysis and task requirements. This intelligent system evaluates the task description and automatically chooses the optimal swarm type from all available architectures, ensuring maximum efficiency and effectiveness. + +Key features: +- **Intelligent Selection**: Automatically chooses the best swarm type for each task +- **Context Analysis**: Analyzes task requirements to make optimal decisions +- **Adaptive Architecture**: Adapts to different types of problems automatically +- **Zero Configuration**: No manual architecture selection required + +## Use Cases + +- When unsure about which swarm type to use +- General-purpose task automation +- Rapid prototyping and experimentation +- Simplified API usage for non-experts + +## API Usage + +### Basic Auto Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Auto Content Creation", + "description": "Let the system choose the best approach for content creation", + "swarm_type": "auto", + "task": "Create a comprehensive blog post about sustainable investing, including research, writing, editing, and SEO optimization", + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Auto Content Creation", + "description": "Let the system choose the best approach for content creation", + "swarm_type": "auto", + "task": "Create a comprehensive blog post about sustainable investing, including research, writing, editing, and SEO optimization", + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("Auto swarm completed successfully!") + print(f"Selected architecture: {result['metadata']['selected_swarm_type']}") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Content: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "auto-content-creation", + "swarm_type": "SequentialWorkflow", + "task": "Create a comprehensive blog post about sustainable investing, including research, writing, editing, and SEO optimization", + "output": { + "research_phase": { + "key_findings": "Sustainable investing has grown 42% in the past two years...", + "market_trends": "ESG funds outperformed traditional funds by 3.2%...", + "statistics": "Global sustainable investment assets reached $35.3 trillion..." + }, + "writing_phase": { + "title": "The Future of Sustainable Investing: A Guide to ESG Strategies", + "content": "Comprehensive blog post with introduction, main sections, and conclusion...", + "word_count": 1850 + }, + "editing_phase": { + "improvements": "Enhanced clarity, improved flow, corrected grammar", + "readability_score": "Grade 8 level - accessible to general audience", + "final_content": "Polished blog post ready for publication..." + }, + "seo_optimization": { + "target_keywords": ["sustainable investing", "ESG funds", "green finance"], + "meta_description": "Discover the future of sustainable investing...", + "optimized_content": "SEO-optimized version with strategic keyword placement" + } + }, + "metadata": { + "auto_selection": { + "selected_swarm_type": "SequentialWorkflow", + "reasoning": "Task requires step-by-step content creation process where each phase builds on the previous", + "analysis": { + "task_complexity": "Medium-High", + "sequential_dependencies": true, + "parallel_opportunities": false, + "collaboration_needs": "Low" + } + }, + "generated_agents": [ + "Research Specialist", + "Content Writer", + "Editor", + "SEO Optimizer" + ], + "execution_time_seconds": 43.2, + "billing_info": { + "total_cost": 0.087 + } + } +} +``` + +### Advanced Auto Usage + +You can provide additional context to help the Auto selection: + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Auto Business Analysis", + "description": "Automatic swarm selection for business analysis", + "swarm_type": "auto", + "task": "Analyze market opportunities for a new AI startup in healthcare", + "rules": "Need multiple perspectives from different business functions, time-sensitive analysis required", + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + swarm_config = { + "name": "Auto Business Analysis", + "description": "Automatic swarm selection for business analysis", + "swarm_type": "auto", + "task": "Analyze market opportunities for a new AI startup in healthcare", + "rules": "Need multiple perspectives from different business functions, time-sensitive analysis required", + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print(f"Auto selected: {result['metadata']['auto_selection']['selected_swarm_type']}") + print(f"Reasoning: {result['metadata']['auto_selection']['reasoning']}") + ``` + +## Selection Logic + +The Auto swarm type analyzes various factors to make its selection: + +| Factor | Consideration | +|--------|---------------| +| **Task Complexity** | Simple → Single agent, Complex → Multi-agent | +| **Sequential Dependencies** | Dependencies → SequentialWorkflow | +| **Parallel Opportunities** | Independent subtasks → ConcurrentWorkflow | +| **Collaboration Needs** | Discussion required → GroupChat | +| **Expertise Diversity** | Multiple domains → MixtureOfAgents | +| **Management Needs** | Oversight required → HierarchicalSwarm | +| **Routing Requirements** | Task distribution → MultiAgentRouter | + +## Best Practices + +- Provide detailed task descriptions for better selection +- Use `rules` parameter to guide selection criteria +- Review the selected architecture in response metadata +- Ideal for users new to swarm architectures + +## Related Swarm Types + +Since Auto can select any swarm type, it's related to all architectures: +- [AutoSwarmBuilder](auto_swarm_builder.md) - For automatic agent generation +- [SequentialWorkflow](sequential_workflow.md) - Often selected for linear tasks +- [ConcurrentWorkflow](concurrent_workflow.md) - For parallel processing needs +- [MixtureOfAgents](mixture_of_agents.md) - For diverse expertise requirements \ No newline at end of file diff --git a/docs/swarms_cloud/auto_swarm_builder.md b/docs/swarms_cloud/auto_swarm_builder.md new file mode 100644 index 00000000..86799e1e --- /dev/null +++ b/docs/swarms_cloud/auto_swarm_builder.md @@ -0,0 +1,195 @@ +# AutoSwarmBuilder + +*Automatically configures optimal swarm architectures based on task requirements* + +**Swarm Type**: `AutoSwarmBuilder` + +## Overview + +The AutoSwarmBuilder automatically configures optimal agent architectures based on task requirements and performance metrics, simplifying swarm creation. This intelligent system analyzes the given task and automatically generates the most suitable agent configuration, eliminating the need for manual swarm design. + +Key features: +- **Intelligent Configuration**: Automatically designs optimal swarm structures +- **Task-Adaptive**: Adapts architecture based on specific task requirements +- **Performance Optimization**: Selects configurations for maximum efficiency +- **Simplified Setup**: Eliminates manual agent configuration complexity + +## Use Cases + +- Quick prototyping and experimentation +- Unknown or complex task requirements +- Automated swarm optimization +- Simplified swarm creation for non-experts + +## API Usage + +### Basic AutoSwarmBuilder Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Auto Marketing Campaign", + "description": "Automatically build optimal swarm for marketing campaign creation", + "swarm_type": "AutoSwarmBuilder", + "task": "Create a comprehensive digital marketing campaign for a new sustainable fashion brand targeting Gen Z consumers", + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Auto Marketing Campaign", + "description": "Automatically build optimal swarm for marketing campaign creation", + "swarm_type": "AutoSwarmBuilder", + "task": "Create a comprehensive digital marketing campaign for a new sustainable fashion brand targeting Gen Z consumers", + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("AutoSwarmBuilder completed successfully!") + print(f"Generated swarm architecture: {result['metadata']['generated_architecture']}") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Campaign output: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "auto-marketing-campaign", + "swarm_type": "AutoSwarmBuilder", + "task": "Create a comprehensive digital marketing campaign for a new sustainable fashion brand targeting Gen Z consumers", + "output": { + "campaign_strategy": { + "brand_positioning": "Authentic, sustainable fashion for conscious Gen Z consumers", + "key_messaging": "Style that makes a difference - fashion with purpose", + "target_demographics": "Ages 18-26, environmentally conscious, social media active" + }, + "content_strategy": { + "social_platforms": ["TikTok", "Instagram", "Pinterest"], + "content_pillars": ["Sustainability education", "Style inspiration", "Behind-the-scenes"], + "posting_schedule": "Daily posts across platforms with peak engagement timing" + }, + "influencer_strategy": { + "tier_1": "Micro-influencers (10K-100K followers) focused on sustainability", + "tier_2": "Fashion nano-influencers (1K-10K followers) for authentic engagement", + "collaboration_types": ["Product partnerships", "Brand ambassador programs"] + }, + "paid_advertising": { + "platforms": ["Instagram Ads", "TikTok Ads", "Google Ads"], + "budget_allocation": "40% social media, 30% search, 30% video content", + "targeting_strategy": "Interest-based and lookalike audiences" + }, + "metrics_and_kpis": { + "awareness": "Brand mention volume, reach, impressions", + "engagement": "Comments, shares, saves, time spent", + "conversion": "Website traffic, email signups, sales" + } + }, + "metadata": { + "generated_architecture": { + "selected_swarm_type": "MixtureOfAgents", + "generated_agents": [ + "Brand Strategy Expert", + "Gen Z Marketing Specialist", + "Social Media Content Creator", + "Influencer Marketing Manager", + "Digital Advertising Strategist" + ], + "reasoning": "Complex marketing campaign requires diverse expertise working collaboratively" + }, + "auto_optimization": { + "task_complexity": "High", + "required_expertise_areas": 5, + "optimal_architecture": "Collaborative with specialized agents" + }, + "execution_time_seconds": 28.6, + "billing_info": { + "total_cost": 0.071 + } + } +} +``` + +### Advanced Configuration + +You can provide additional guidance to the AutoSwarmBuilder: + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Auto Research Project", + "description": "Auto-build research swarm with specific constraints", + "swarm_type": "AutoSwarmBuilder", + "task": "Conduct comprehensive research on the impact of AI on healthcare outcomes", + "rules": "Focus on peer-reviewed sources, include cost-benefit analysis, ensure balanced perspective on risks and benefits", + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + swarm_config = { + "name": "Auto Research Project", + "description": "Auto-build research swarm with specific constraints", + "swarm_type": "AutoSwarmBuilder", + "task": "Conduct comprehensive research on the impact of AI on healthcare outcomes", + "rules": "Focus on peer-reviewed sources, include cost-benefit analysis, ensure balanced perspective on risks and benefits", + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + ``` + +## Configuration Options + +| Parameter | Type | Description | Default | +|-----------|------|-------------|---------| +| `task` | string | Task description for automatic optimization | Required | +| `rules` | string | Additional constraints and guidelines | None | +| `max_loops` | integer | Maximum execution rounds | 1 | + +## Best Practices + +- Provide detailed, specific task descriptions for better optimization +- Use `rules` parameter to guide the automatic configuration +- Ideal for rapid prototyping and experimentation +- Review generated architecture in response metadata + +## Related Swarm Types + +- [Auto](auto.md) - For automatic swarm type selection +- [MixtureOfAgents](mixture_of_agents.md) - Often selected by AutoSwarmBuilder +- [HierarchicalSwarm](hierarchical_swarm.md) - For complex structured tasks \ No newline at end of file diff --git a/docs/swarms_cloud/concurrent_workflow.md b/docs/swarms_cloud/concurrent_workflow.md new file mode 100644 index 00000000..289deb84 --- /dev/null +++ b/docs/swarms_cloud/concurrent_workflow.md @@ -0,0 +1,198 @@ +# ConcurrentWorkflow + +*Runs independent tasks in parallel for faster processing* + +**Swarm Type**: `ConcurrentWorkflow` + +## Overview + +The ConcurrentWorkflow swarm type runs independent tasks in parallel, significantly reducing processing time for complex operations. This architecture is ideal for tasks that can be processed simultaneously without dependencies, allowing multiple agents to work on different aspects of a problem at the same time. + +Key features: +- **Parallel Execution**: Multiple agents work simultaneously +- **Reduced Processing Time**: Faster completion through parallelization +- **Independent Tasks**: Agents work on separate, non-dependent subtasks +- **Scalable Performance**: Performance scales with the number of agents + +## Use Cases + +- Independent data analysis tasks +- Parallel content generation +- Multi-source research projects +- Distributed problem solving + +## API Usage + +### Basic ConcurrentWorkflow Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Market Research Concurrent", + "description": "Parallel market research across different sectors", + "swarm_type": "ConcurrentWorkflow", + "task": "Research and analyze market opportunities in AI, healthcare, fintech, and e-commerce sectors", + "agents": [ + { + "agent_name": "AI Market Analyst", + "description": "Analyzes AI market trends and opportunities", + "system_prompt": "You are an AI market analyst. Focus on artificial intelligence market trends, opportunities, key players, and growth projections.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Healthcare Market Analyst", + "description": "Analyzes healthcare market trends", + "system_prompt": "You are a healthcare market analyst. Focus on healthcare market trends, digital health opportunities, regulatory landscape, and growth areas.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Fintech Market Analyst", + "description": "Analyzes fintech market opportunities", + "system_prompt": "You are a fintech market analyst. Focus on financial technology trends, digital payment systems, blockchain opportunities, and regulatory developments.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "E-commerce Market Analyst", + "description": "Analyzes e-commerce market trends", + "system_prompt": "You are an e-commerce market analyst. Focus on online retail trends, marketplace opportunities, consumer behavior, and emerging platforms.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + } + ], + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Market Research Concurrent", + "description": "Parallel market research across different sectors", + "swarm_type": "ConcurrentWorkflow", + "task": "Research and analyze market opportunities in AI, healthcare, fintech, and e-commerce sectors", + "agents": [ + { + "agent_name": "AI Market Analyst", + "description": "Analyzes AI market trends and opportunities", + "system_prompt": "You are an AI market analyst. Focus on artificial intelligence market trends, opportunities, key players, and growth projections.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Healthcare Market Analyst", + "description": "Analyzes healthcare market trends", + "system_prompt": "You are a healthcare market analyst. Focus on healthcare market trends, digital health opportunities, regulatory landscape, and growth areas.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Fintech Market Analyst", + "description": "Analyzes fintech market opportunities", + "system_prompt": "You are a fintech market analyst. Focus on financial technology trends, digital payment systems, blockchain opportunities, and regulatory developments.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "E-commerce Market Analyst", + "description": "Analyzes e-commerce market trends", + "system_prompt": "You are an e-commerce market analyst. Focus on online retail trends, marketplace opportunities, consumer behavior, and emerging platforms.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + } + ], + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("ConcurrentWorkflow swarm completed successfully!") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Parallel results: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "market-research-concurrent", + "swarm_type": "ConcurrentWorkflow", + "task": "Research and analyze market opportunities in AI, healthcare, fintech, and e-commerce sectors", + "output": { + "ai_market_analysis": { + "market_size": "$150B by 2025", + "growth_rate": "25% CAGR", + "key_opportunities": ["Generative AI", "Edge AI", "AI Infrastructure"] + }, + "healthcare_analysis": { + "market_size": "$350B by 2025", + "growth_rate": "12% CAGR", + "key_opportunities": ["Telemedicine", "AI Diagnostics", "Digital Therapeutics"] + }, + "fintech_analysis": { + "market_size": "$200B by 2025", + "growth_rate": "18% CAGR", + "key_opportunities": ["DeFi", "Digital Banking", "Payment Infrastructure"] + }, + "ecommerce_analysis": { + "market_size": "$8T by 2025", + "growth_rate": "14% CAGR", + "key_opportunities": ["Social Commerce", "B2B Marketplaces", "Sustainable Commerce"] + } + }, + "metadata": { + "parallel_execution": true, + "agents_completed_simultaneously": 4, + "execution_time_seconds": 12.8, + "billing_info": { + "total_cost": 0.052 + } + } +} +``` + +## Best Practices + +- Design independent tasks that don't require sequential dependencies +- Use for tasks that can be parallelized effectively +- Ensure agents have distinct, non-overlapping responsibilities +- Ideal for time-sensitive analysis requiring multiple perspectives + +## Related Swarm Types + +- [SequentialWorkflow](sequential_workflow.md) - For ordered execution +- [MixtureOfAgents](mixture_of_agents.md) - For collaborative analysis +- [MultiAgentRouter](multi_agent_router.md) - For intelligent task distribution \ No newline at end of file diff --git a/docs/swarms_cloud/group_chat.md b/docs/swarms_cloud/group_chat.md new file mode 100644 index 00000000..e3410e1c --- /dev/null +++ b/docs/swarms_cloud/group_chat.md @@ -0,0 +1,204 @@ +# GroupChat + +*Enables dynamic collaboration through chat-based interaction* + +**Swarm Type**: `GroupChat` + +## Overview + +The GroupChat swarm type enables dynamic collaboration between agents through a chat-based interface, facilitating real-time information sharing and decision-making. Agents participate in a conversational workflow where they can build upon each other's contributions, debate ideas, and reach consensus through natural dialogue. + +Key features: +- **Interactive Dialogue**: Agents communicate through natural conversation +- **Dynamic Collaboration**: Real-time information sharing and building upon ideas +- **Consensus Building**: Agents can debate and reach decisions collectively +- **Flexible Participation**: Agents can contribute when relevant to the discussion + +## Use Cases + +- Brainstorming and ideation sessions +- Multi-perspective problem analysis +- Collaborative decision-making processes +- Creative content development + +## API Usage + +### Basic GroupChat Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Product Strategy Discussion", + "description": "Collaborative chat to develop product strategy", + "swarm_type": "GroupChat", + "task": "Discuss and develop a go-to-market strategy for a new AI-powered productivity tool targeting small businesses", + "agents": [ + { + "agent_name": "Product Manager", + "description": "Leads product strategy and development", + "system_prompt": "You are a senior product manager. Focus on product positioning, features, user needs, and market fit. Ask probing questions and build on others ideas.", + "model_name": "gpt-4o", + "max_loops": 3, + "temperature": 0.6 + }, + { + "agent_name": "Marketing Strategist", + "description": "Develops marketing and positioning strategy", + "system_prompt": "You are a marketing strategist. Focus on target audience, messaging, channels, and competitive positioning. Contribute marketing insights to the discussion.", + "model_name": "gpt-4o", + "max_loops": 3, + "temperature": 0.7 + }, + { + "agent_name": "Sales Director", + "description": "Provides sales and customer perspective", + "system_prompt": "You are a sales director with small business experience. Focus on pricing, sales process, customer objections, and market adoption. Share practical sales insights.", + "model_name": "gpt-4o", + "max_loops": 3, + "temperature": 0.5 + }, + { + "agent_name": "UX Researcher", + "description": "Represents user experience and research insights", + "system_prompt": "You are a UX researcher specializing in small business tools. Focus on user behavior, usability, adoption barriers, and design considerations.", + "model_name": "gpt-4o", + "max_loops": 3, + "temperature": 0.4 + } + ], + "max_loops": 3 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Product Strategy Discussion", + "description": "Collaborative chat to develop product strategy", + "swarm_type": "GroupChat", + "task": "Discuss and develop a go-to-market strategy for a new AI-powered productivity tool targeting small businesses", + "agents": [ + { + "agent_name": "Product Manager", + "description": "Leads product strategy and development", + "system_prompt": "You are a senior product manager. Focus on product positioning, features, user needs, and market fit. Ask probing questions and build on others ideas.", + "model_name": "gpt-4o", + "max_loops": 3, + "temperature": 0.6 + }, + { + "agent_name": "Marketing Strategist", + "description": "Develops marketing and positioning strategy", + "system_prompt": "You are a marketing strategist. Focus on target audience, messaging, channels, and competitive positioning. Contribute marketing insights to the discussion.", + "model_name": "gpt-4o", + "max_loops": 3, + "temperature": 0.7 + }, + { + "agent_name": "Sales Director", + "description": "Provides sales and customer perspective", + "system_prompt": "You are a sales director with small business experience. Focus on pricing, sales process, customer objections, and market adoption. Share practical sales insights.", + "model_name": "gpt-4o", + "max_loops": 3, + "temperature": 0.5 + }, + { + "agent_name": "UX Researcher", + "description": "Represents user experience and research insights", + "system_prompt": "You are a UX researcher specializing in small business tools. Focus on user behavior, usability, adoption barriers, and design considerations.", + "model_name": "gpt-4o", + "max_loops": 3, + "temperature": 0.4 + } + ], + "max_loops": 3 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("GroupChat swarm completed successfully!") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Chat discussion: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "product-strategy-discussion", + "swarm_type": "GroupChat", + "task": "Discuss and develop a go-to-market strategy for a new AI-powered productivity tool targeting small businesses", + "output": { + "chat_transcript": [ + { + "agent": "Product Manager", + "message": "Let's start by defining our target user. What specific pain points do small businesses have with productivity tools?" + }, + { + "agent": "UX Researcher", + "message": "From our research, small businesses struggle with tool complexity and time to value. They need something that works immediately without extensive setup." + }, + { + "agent": "Sales Director", + "message": "I agree. SMBs have limited time and resources. They typically abandon tools that require more than a week to see value. Pricing is also critical - they're very cost-conscious." + }, + { + "agent": "Marketing Strategist", + "message": "This suggests we should focus on 'instant productivity gains' messaging. We could position against complex enterprise tools that overwhelm small teams." + } + ], + "key_decisions": [ + "Target: Small businesses with 5-50 employees", + "Positioning: Simple, immediate productivity gains", + "Pricing: Freemium model with low-cost paid tiers", + "GTM: Self-serve with strong onboarding" + ], + "final_strategy": "Launch with freemium model targeting productivity-focused small businesses through content marketing and self-serve channels..." + }, + "metadata": { + "conversation_rounds": 3, + "total_messages": 12, + "consensus_reached": true, + "execution_time_seconds": 38.7, + "billing_info": { + "total_cost": 0.095 + } + } +} +``` + +## Best Practices + +- Set clear discussion goals and objectives +- Use diverse agent personalities for richer dialogue +- Allow multiple conversation rounds for idea development +- Encourage agents to build upon each other's contributions + +## Related Swarm Types + +- [MixtureOfAgents](mixture_of_agents.md) - For complementary expertise +- [MajorityVoting](majority_voting.md) - For consensus decision-making +- [AutoSwarmBuilder](auto_swarm_builder.md) - For automatic discussion setup \ No newline at end of file diff --git a/docs/swarms_cloud/hierarchical_swarm.md b/docs/swarms_cloud/hierarchical_swarm.md new file mode 100644 index 00000000..0cd6ec21 --- /dev/null +++ b/docs/swarms_cloud/hierarchical_swarm.md @@ -0,0 +1,241 @@ +# HierarchicalSwarm + +*Implements structured, multi-level task management with clear authority* + +**Swarm Type**: `HierarchicalSwarm` + +## Overview + +The HierarchicalSwarm implements a structured, multi-level approach to task management with clear lines of authority and delegation. This architecture organizes agents in a hierarchical structure where manager agents coordinate and oversee worker agents, enabling efficient task distribution and quality control. + +Key features: +- **Structured Hierarchy**: Clear organizational structure with managers and workers +- **Delegated Authority**: Manager agents distribute tasks to specialized workers +- **Quality Oversight**: Multi-level review and validation processes +- **Scalable Organization**: Efficient coordination of large agent teams + +## Use Cases + +- Complex projects requiring management oversight +- Large-scale content production workflows +- Multi-stage validation and review processes +- Enterprise-level task coordination + +## API Usage + +### Basic HierarchicalSwarm Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Software Development Hierarchy", + "description": "Hierarchical software development team with project manager oversight", + "swarm_type": "HierarchicalSwarm", + "task": "Design and plan a new mobile app for expense tracking targeting freelancers", + "agents": [ + { + "agent_name": "Project Manager", + "description": "Oversees project planning and coordinates team efforts", + "system_prompt": "You are a senior project manager. Coordinate the team, break down tasks, ensure quality, and synthesize outputs. Delegate specific tasks to team members.", + "model_name": "gpt-4o", + "role": "manager", + "max_loops": 2, + "temperature": 0.4 + }, + { + "agent_name": "UX Designer", + "description": "Designs user experience and interface", + "system_prompt": "You are a UX designer specializing in mobile apps. Focus on user flows, wireframes, and interface design. Report findings to the project manager.", + "model_name": "gpt-4o", + "role": "worker", + "max_loops": 1, + "temperature": 0.6 + }, + { + "agent_name": "Technical Architect", + "description": "Designs technical architecture and system requirements", + "system_prompt": "You are a technical architect. Focus on system design, technology stack, database design, and technical requirements. Provide technical guidance.", + "model_name": "gpt-4o", + "role": "worker", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Business Analyst", + "description": "Analyzes business requirements and market fit", + "system_prompt": "You are a business analyst. Focus on requirements gathering, market analysis, feature prioritization, and business logic.", + "model_name": "gpt-4o", + "role": "worker", + "max_loops": 1, + "temperature": 0.4 + }, + { + "agent_name": "QA Specialist", + "description": "Ensures quality and validates deliverables", + "system_prompt": "You are a QA specialist. Review all outputs for quality, completeness, and consistency. Identify gaps and suggest improvements.", + "model_name": "gpt-4o", + "role": "worker", + "max_loops": 1, + "temperature": 0.2 + } + ], + "max_loops": 2 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Software Development Hierarchy", + "description": "Hierarchical software development team with project manager oversight", + "swarm_type": "HierarchicalSwarm", + "task": "Design and plan a new mobile app for expense tracking targeting freelancers", + "agents": [ + { + "agent_name": "Project Manager", + "description": "Oversees project planning and coordinates team efforts", + "system_prompt": "You are a senior project manager. Coordinate the team, break down tasks, ensure quality, and synthesize outputs. Delegate specific tasks to team members.", + "model_name": "gpt-4o", + "role": "manager", + "max_loops": 2, + "temperature": 0.4 + }, + { + "agent_name": "UX Designer", + "description": "Designs user experience and interface", + "system_prompt": "You are a UX designer specializing in mobile apps. Focus on user flows, wireframes, and interface design. Report findings to the project manager.", + "model_name": "gpt-4o", + "role": "worker", + "max_loops": 1, + "temperature": 0.6 + }, + { + "agent_name": "Technical Architect", + "description": "Designs technical architecture and system requirements", + "system_prompt": "You are a technical architect. Focus on system design, technology stack, database design, and technical requirements. Provide technical guidance.", + "model_name": "gpt-4o", + "role": "worker", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Business Analyst", + "description": "Analyzes business requirements and market fit", + "system_prompt": "You are a business analyst. Focus on requirements gathering, market analysis, feature prioritization, and business logic.", + "model_name": "gpt-4o", + "role": "worker", + "max_loops": 1, + "temperature": 0.4 + }, + { + "agent_name": "QA Specialist", + "description": "Ensures quality and validates deliverables", + "system_prompt": "You are a QA specialist. Review all outputs for quality, completeness, and consistency. Identify gaps and suggest improvements.", + "model_name": "gpt-4o", + "role": "worker", + "max_loops": 1, + "temperature": 0.2 + } + ], + "max_loops": 2 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("HierarchicalSwarm completed successfully!") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Project plan: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "software-development-hierarchy", + "swarm_type": "HierarchicalSwarm", + "task": "Design and plan a new mobile app for expense tracking targeting freelancers", + "output": { + "project_overview": { + "manager_synthesis": "Comprehensive project plan for freelancer expense tracking app...", + "timeline": "16-week development cycle", + "key_deliverables": ["UX Design", "Technical Architecture", "Business Requirements", "QA Framework"] + }, + "ux_design": { + "user_flows": "Streamlined expense entry and categorization flows...", + "wireframes": "Mobile-first design with dashboard and reporting views...", + "usability_considerations": "One-tap expense entry, photo receipt capture..." + }, + "technical_architecture": { + "tech_stack": "React Native, Node.js, PostgreSQL, AWS", + "system_design": "Microservices architecture with offline capability...", + "security_requirements": "End-to-end encryption, secure authentication..." + }, + "business_requirements": { + "target_market": "Freelancers and independent contractors", + "core_features": ["Expense tracking", "Receipt scanning", "Tax reporting"], + "monetization": "Freemium model with premium reporting features" + }, + "qa_framework": { + "testing_strategy": "Automated testing for core functions...", + "quality_metrics": "Performance, usability, and security benchmarks...", + "validation_checkpoints": "Weekly reviews and milestone validations" + } + }, + "metadata": { + "hierarchy_structure": { + "managers": ["Project Manager"], + "workers": ["UX Designer", "Technical Architect", "Business Analyst", "QA Specialist"] + }, + "coordination_rounds": 2, + "task_delegation": "Manager coordinated 4 specialized work streams", + "execution_time_seconds": 52.4, + "billing_info": { + "total_cost": 0.128 + } + } +} +``` + +## Configuration Options + +| Parameter | Type | Description | Default | +|-----------|------|-------------|---------| +| `role` | string | Agent role: "manager" or "worker" | "worker" | +| `agents` | Array | Mix of manager and worker agents | Required | +| `max_loops` | integer | Coordination rounds for managers | 1 | + +## Best Practices + +- Clearly define manager and worker roles using the `role` parameter +- Give managers higher `max_loops` for coordination activities +- Design worker agents with specialized, focused responsibilities +- Use for complex projects requiring oversight and coordination + +## Related Swarm Types + +- [SequentialWorkflow](sequential_workflow.md) - For linear task progression +- [MultiAgentRouter](multi_agent_router.md) - For intelligent task routing +- [AutoSwarmBuilder](auto_swarm_builder.md) - For automatic hierarchy creation \ No newline at end of file diff --git a/docs/swarms_cloud/index.md b/docs/swarms_cloud/index.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/swarms_cloud/majority_voting.md b/docs/swarms_cloud/majority_voting.md new file mode 100644 index 00000000..63f39439 --- /dev/null +++ b/docs/swarms_cloud/majority_voting.md @@ -0,0 +1,240 @@ +# MajorityVoting + +*Implements robust decision-making through consensus and voting* + +**Swarm Type**: `MajorityVoting` + +## Overview + +The MajorityVoting swarm type implements robust decision-making through consensus mechanisms, ideal for tasks requiring collective intelligence or verification. Multiple agents independently analyze the same problem and vote on the best solution, ensuring high-quality, well-validated outcomes through democratic consensus. + +Key features: +- **Consensus-Based Decisions**: Multiple agents vote on the best solution +- **Quality Assurance**: Reduces individual agent bias through collective input +- **Democratic Process**: Fair and transparent decision-making mechanism +- **Robust Validation**: Multiple perspectives ensure thorough analysis + +## Use Cases + +- Critical decision-making requiring validation +- Quality assurance and verification tasks +- Complex problem solving with multiple viable solutions +- Risk assessment and evaluation scenarios + +## API Usage + +### Basic MajorityVoting Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Investment Decision Voting", + "description": "Multiple financial experts vote on investment recommendations", + "swarm_type": "MajorityVoting", + "task": "Evaluate whether to invest $1M in a renewable energy startup. Consider market potential, financial projections, team strength, and competitive landscape.", + "agents": [ + { + "agent_name": "Growth Investor", + "description": "Focuses on growth potential and market opportunity", + "system_prompt": "You are a growth-focused venture capitalist. Evaluate investments based on market size, scalability, and growth potential. Provide a recommendation with confidence score.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Financial Analyst", + "description": "Analyzes financial metrics and projections", + "system_prompt": "You are a financial analyst specializing in startups. Evaluate financial projections, revenue models, and unit economics. Provide a recommendation with confidence score.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Technical Due Diligence", + "description": "Evaluates technology and product viability", + "system_prompt": "You are a technical due diligence expert. Assess technology viability, intellectual property, product-market fit, and technical risks. Provide a recommendation with confidence score.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Market Analyst", + "description": "Analyzes market conditions and competition", + "system_prompt": "You are a market research analyst. Evaluate market dynamics, competitive landscape, regulatory environment, and market timing. Provide a recommendation with confidence score.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Risk Assessor", + "description": "Identifies and evaluates investment risks", + "system_prompt": "You are a risk assessment specialist. Identify potential risks, evaluate mitigation strategies, and assess overall risk profile. Provide a recommendation with confidence score.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + } + ], + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Investment Decision Voting", + "description": "Multiple financial experts vote on investment recommendations", + "swarm_type": "MajorityVoting", + "task": "Evaluate whether to invest $1M in a renewable energy startup. Consider market potential, financial projections, team strength, and competitive landscape.", + "agents": [ + { + "agent_name": "Growth Investor", + "description": "Focuses on growth potential and market opportunity", + "system_prompt": "You are a growth-focused venture capitalist. Evaluate investments based on market size, scalability, and growth potential. Provide a recommendation with confidence score.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Financial Analyst", + "description": "Analyzes financial metrics and projections", + "system_prompt": "You are a financial analyst specializing in startups. Evaluate financial projections, revenue models, and unit economics. Provide a recommendation with confidence score.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Technical Due Diligence", + "description": "Evaluates technology and product viability", + "system_prompt": "You are a technical due diligence expert. Assess technology viability, intellectual property, product-market fit, and technical risks. Provide a recommendation with confidence score.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Market Analyst", + "description": "Analyzes market conditions and competition", + "system_prompt": "You are a market research analyst. Evaluate market dynamics, competitive landscape, regulatory environment, and market timing. Provide a recommendation with confidence score.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Risk Assessor", + "description": "Identifies and evaluates investment risks", + "system_prompt": "You are a risk assessment specialist. Identify potential risks, evaluate mitigation strategies, and assess overall risk profile. Provide a recommendation with confidence score.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + } + ], + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("MajorityVoting completed successfully!") + print(f"Final decision: {result['output']['consensus_decision']}") + print(f"Vote breakdown: {result['metadata']['vote_breakdown']}") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "investment-decision-voting", + "swarm_type": "MajorityVoting", + "task": "Evaluate whether to invest $1M in a renewable energy startup. Consider market potential, financial projections, team strength, and competitive landscape.", + "output": { + "individual_recommendations": [ + { + "agent": "Growth Investor", + "recommendation": "INVEST", + "confidence": 0.8, + "reasoning": "Strong market growth potential in renewable energy sector, scalable technology platform" + }, + { + "agent": "Financial Analyst", + "recommendation": "INVEST", + "confidence": 0.7, + "reasoning": "Solid financial projections, reasonable burn rate, clear path to profitability" + }, + { + "agent": "Technical Due Diligence", + "recommendation": "INVEST", + "confidence": 0.75, + "reasoning": "Innovative technology with strong IP portfolio, experienced technical team" + }, + { + "agent": "Market Analyst", + "recommendation": "WAIT", + "confidence": 0.6, + "reasoning": "Highly competitive market, regulatory uncertainties may impact timeline" + }, + { + "agent": "Risk Assessor", + "recommendation": "INVEST", + "confidence": 0.65, + "reasoning": "Manageable risks with strong mitigation strategies, experienced leadership team" + } + ], + "consensus_decision": "INVEST", + "consensus_confidence": 0.72, + "consensus_reasoning": "4 out of 5 experts recommend investment with strong market potential and solid fundamentals, despite some market uncertainties" + }, + "metadata": { + "vote_breakdown": { + "INVEST": 4, + "WAIT": 1, + "REJECT": 0 + }, + "vote_percentage": { + "INVEST": "80%", + "WAIT": "20%", + "REJECT": "0%" + }, + "average_confidence": 0.70, + "consensus_threshold": "Simple majority (50%+)", + "execution_time_seconds": 25.8, + "billing_info": { + "total_cost": 0.063 + } + } +} +``` + +## Best Practices + +- Use odd numbers of agents to avoid tie votes +- Design agents with different perspectives for robust evaluation +- Include confidence scores in agent prompts for weighted decisions +- Ideal for high-stakes decisions requiring validation + +## Related Swarm Types + +- [GroupChat](group_chat.md) - For discussion-based consensus +- [MixtureOfAgents](mixture_of_agents.md) - For diverse expertise collaboration +- [HierarchicalSwarm](hierarchical_swarm.md) - For structured decision-making \ No newline at end of file diff --git a/docs/swarms_cloud/malt.md b/docs/swarms_cloud/malt.md new file mode 100644 index 00000000..7539ed58 --- /dev/null +++ b/docs/swarms_cloud/malt.md @@ -0,0 +1,248 @@ +# MALT + +*Specialized framework for complex language-based tasks and processing* + +**Swarm Type**: `MALT` + +## Overview + +MALT (Multi-Agent Language Task) is a specialized framework optimized for complex language-based tasks, optimizing agent collaboration for sophisticated language processing operations. This architecture excels at tasks requiring deep linguistic analysis, natural language understanding, and complex text generation workflows. + +Key features: +- **Language Optimization**: Specifically designed for natural language tasks +- **Linguistic Collaboration**: Agents work together on complex language operations +- **Text Processing Pipeline**: Structured approach to language task workflows +- **Advanced NLP**: Optimized for sophisticated language understanding tasks + +## Use Cases + +- Complex document analysis and processing +- Multi-language translation and localization +- Advanced content generation and editing +- Linguistic research and analysis tasks + +## API Usage + +### Basic MALT Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Legal Document Analysis MALT", + "description": "Advanced linguistic analysis of legal documents using MALT framework", + "swarm_type": "MALT", + "task": "Perform comprehensive linguistic analysis of a complex legal contract including sentiment analysis, risk identification, clause categorization, and language complexity assessment", + "agents": [ + { + "agent_name": "Syntactic Analyzer", + "description": "Analyzes sentence structure and grammar", + "system_prompt": "You are a syntactic analysis expert. Analyze sentence structure, grammatical patterns, and linguistic complexity in legal texts.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Semantic Analyzer", + "description": "Analyzes meaning and semantic relationships", + "system_prompt": "You are a semantic analysis expert. Extract meaning, identify semantic relationships, and analyze conceptual content in legal documents.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Pragmatic Analyzer", + "description": "Analyzes context and implied meanings", + "system_prompt": "You are a pragmatic analysis expert. Analyze contextual meaning, implied obligations, and pragmatic implications in legal language.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.4 + }, + { + "agent_name": "Discourse Analyzer", + "description": "Analyzes document structure and flow", + "system_prompt": "You are a discourse analysis expert. Analyze document structure, logical flow, and coherence in legal texts.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Risk Language Detector", + "description": "Identifies risk-related language patterns", + "system_prompt": "You are a legal risk language expert. Identify risk indicators, liability language, and potential legal concerns in contract language.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + } + ], + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Legal Document Analysis MALT", + "description": "Advanced linguistic analysis of legal documents using MALT framework", + "swarm_type": "MALT", + "task": "Perform comprehensive linguistic analysis of a complex legal contract including sentiment analysis, risk identification, clause categorization, and language complexity assessment", + "agents": [ + { + "agent_name": "Syntactic Analyzer", + "description": "Analyzes sentence structure and grammar", + "system_prompt": "You are a syntactic analysis expert. Analyze sentence structure, grammatical patterns, and linguistic complexity in legal texts.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Semantic Analyzer", + "description": "Analyzes meaning and semantic relationships", + "system_prompt": "You are a semantic analysis expert. Extract meaning, identify semantic relationships, and analyze conceptual content in legal documents.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Pragmatic Analyzer", + "description": "Analyzes context and implied meanings", + "system_prompt": "You are a pragmatic analysis expert. Analyze contextual meaning, implied obligations, and pragmatic implications in legal language.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.4 + }, + { + "agent_name": "Discourse Analyzer", + "description": "Analyzes document structure and flow", + "system_prompt": "You are a discourse analysis expert. Analyze document structure, logical flow, and coherence in legal texts.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Risk Language Detector", + "description": "Identifies risk-related language patterns", + "system_prompt": "You are a legal risk language expert. Identify risk indicators, liability language, and potential legal concerns in contract language.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + } + ], + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("MALT framework completed successfully!") + print(f"Linguistic analysis: {result['output']['linguistic_analysis']}") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "legal-document-analysis-malt", + "swarm_type": "MALT", + "task": "Perform comprehensive linguistic analysis of a complex legal contract including sentiment analysis, risk identification, clause categorization, and language complexity assessment", + "output": { + "linguistic_analysis": { + "syntactic_analysis": { + "complexity_score": 8.2, + "sentence_structure": "Predominantly complex and compound-complex sentences", + "grammatical_patterns": "Heavy use of passive voice, subordinate clauses, and technical terminology", + "readability": "Graduate level (16+ years of education required)" + }, + "semantic_analysis": { + "key_concepts": ["liability", "indemnification", "force majeure", "intellectual property"], + "semantic_relationships": "Strong hierarchical concept relationships with clear definitional structures", + "conceptual_density": "High - 3.2 legal concepts per sentence average", + "ambiguity_indicators": ["potentially", "reasonable efforts", "material adverse effect"] + }, + "pragmatic_analysis": { + "implied_obligations": [ + "Good faith performance expected", + "Timely notice requirements implied", + "Mutual cooperation assumed" + ], + "power_dynamics": "Balanced with slight advantage to service provider", + "speech_acts": "Predominantly commissives (commitments) and directives (obligations)" + }, + "discourse_analysis": { + "document_structure": "Well-organized with clear section hierarchy", + "logical_flow": "Sequential with appropriate cross-references", + "coherence_score": 8.5, + "transition_patterns": "Formal legal transitions with clause numbering" + }, + "risk_language": { + "high_risk_terms": ["unlimited liability", "personal guarantee", "joint and several"], + "risk_mitigation_language": ["subject to", "limited to", "except as provided"], + "liability_indicators": 23, + "risk_level": "Medium-High" + } + }, + "comprehensive_summary": { + "language_complexity": "High complexity legal document requiring specialized knowledge", + "risk_assessment": "Medium-high risk with standard legal protections", + "readability_concerns": "Requires legal expertise for full comprehension", + "recommendations": [ + "Consider plain language summary for key terms", + "Review unlimited liability clauses", + "Clarify ambiguous terms identified" + ] + } + }, + "metadata": { + "malt_framework": { + "linguistic_layers_analyzed": 5, + "language_processing_depth": "Advanced multi-layer analysis", + "specialized_nlp_operations": [ + "Syntactic parsing", + "Semantic role labeling", + "Pragmatic inference", + "Discourse segmentation", + "Risk pattern recognition" + ] + }, + "execution_time_seconds": 35.7, + "billing_info": { + "total_cost": 0.089 + } + } +} +``` + +## Best Practices + +- Use MALT for sophisticated language processing tasks +- Design agents with complementary linguistic analysis capabilities +- Ideal for tasks requiring deep language understanding +- Consider multiple levels of linguistic analysis (syntax, semantics, pragmatics) + +## Related Swarm Types + +- [SequentialWorkflow](sequential_workflow.md) - For ordered language processing +- [MixtureOfAgents](mixture_of_agents.md) - For diverse linguistic expertise +- [HierarchicalSwarm](hierarchical_swarm.md) - For structured language analysis \ No newline at end of file diff --git a/docs/swarms_cloud/mixture_of_agents.md b/docs/swarms_cloud/mixture_of_agents.md new file mode 100644 index 00000000..e02da9c7 --- /dev/null +++ b/docs/swarms_cloud/mixture_of_agents.md @@ -0,0 +1,187 @@ +# MixtureOfAgents + +*Builds diverse teams of specialized agents for complex problem solving* + +**Swarm Type**: `MixtureOfAgents` + +## Overview + +The MixtureOfAgents swarm type combines multiple agent types with different specializations to tackle diverse aspects of complex problems. Each agent contributes unique skills and perspectives, making this architecture ideal for tasks requiring multiple types of expertise working in harmony. + +Key features: +- **Diverse Expertise**: Combines agents with different specializations +- **Collaborative Problem Solving**: Agents work together leveraging their unique strengths +- **Comprehensive Coverage**: Ensures all aspects of complex tasks are addressed +- **Balanced Perspectives**: Multiple viewpoints for robust decision-making + +## Use Cases + +- Complex research projects requiring multiple disciplines +- Business analysis needing various functional perspectives +- Content creation requiring different expertise areas +- Strategic planning with multiple considerations + +## API Usage + +### Basic MixtureOfAgents Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Business Strategy Mixture", + "description": "Diverse team analyzing business strategy from multiple perspectives", + "swarm_type": "MixtureOfAgents", + "task": "Develop a comprehensive market entry strategy for a new AI product in the healthcare sector", + "agents": [ + { + "agent_name": "Market Research Analyst", + "description": "Analyzes market trends and opportunities", + "system_prompt": "You are a market research expert specializing in healthcare technology. Analyze market size, trends, and competitive landscape.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Financial Analyst", + "description": "Evaluates financial viability and projections", + "system_prompt": "You are a financial analyst expert. Assess financial implications, ROI, and cost structures for business strategies.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Regulatory Expert", + "description": "Analyzes compliance and regulatory requirements", + "system_prompt": "You are a healthcare regulatory expert. Analyze compliance requirements, regulatory pathways, and potential barriers.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.1 + }, + { + "agent_name": "Technology Strategist", + "description": "Evaluates technical feasibility and strategy", + "system_prompt": "You are a technology strategy expert. Assess technical requirements, implementation challenges, and scalability.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + } + ], + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Business Strategy Mixture", + "description": "Diverse team analyzing business strategy from multiple perspectives", + "swarm_type": "MixtureOfAgents", + "task": "Develop a comprehensive market entry strategy for a new AI product in the healthcare sector", + "agents": [ + { + "agent_name": "Market Research Analyst", + "description": "Analyzes market trends and opportunities", + "system_prompt": "You are a market research expert specializing in healthcare technology. Analyze market size, trends, and competitive landscape.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Financial Analyst", + "description": "Evaluates financial viability and projections", + "system_prompt": "You are a financial analyst expert. Assess financial implications, ROI, and cost structures for business strategies.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Regulatory Expert", + "description": "Analyzes compliance and regulatory requirements", + "system_prompt": "You are a healthcare regulatory expert. Analyze compliance requirements, regulatory pathways, and potential barriers.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.1 + }, + { + "agent_name": "Technology Strategist", + "description": "Evaluates technical feasibility and strategy", + "system_prompt": "You are a technology strategy expert. Assess technical requirements, implementation challenges, and scalability.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + } + ], + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("MixtureOfAgents swarm completed successfully!") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Output: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "business-strategy-mixture", + "swarm_type": "MixtureOfAgents", + "task": "Develop a comprehensive market entry strategy for a new AI product in the healthcare sector", + "output": { + "market_analysis": "Detailed market research findings...", + "financial_assessment": "Financial projections and ROI analysis...", + "regulatory_compliance": "Regulatory requirements and pathways...", + "technology_strategy": "Technical implementation roadmap...", + "integrated_strategy": "Comprehensive market entry strategy combining all perspectives..." + }, + "metadata": { + "agent_contributions": { + "Market Research Analyst": "Market size: $2.3B, Growth rate: 15% CAGR", + "Financial Analyst": "Break-even: 18 months, ROI: 35%", + "Regulatory Expert": "FDA pathway: 510(k), Timeline: 8-12 months", + "Technology Strategist": "MVP timeline: 6 months, Scalability: High" + }, + "execution_time_seconds": 22.1, + "billing_info": { + "total_cost": 0.067 + } + } +} +``` + +## Best Practices + +- Select agents with complementary and diverse expertise +- Ensure each agent has a clear, specialized role +- Use for complex problems requiring multiple perspectives +- Design tasks that benefit from collaborative analysis + +## Related Swarm Types + +- [ConcurrentWorkflow](concurrent_workflow.md) - For parallel task execution +- [GroupChat](group_chat.md) - For collaborative discussion +- [AutoSwarmBuilder](auto_swarm_builder.md) - For automatic team assembly \ No newline at end of file diff --git a/docs/swarms_cloud/multi_agent_router.md b/docs/swarms_cloud/multi_agent_router.md new file mode 100644 index 00000000..57f5516e --- /dev/null +++ b/docs/swarms_cloud/multi_agent_router.md @@ -0,0 +1,224 @@ +# MultiAgentRouter + +*Intelligent task dispatcher distributing work based on agent capabilities* + +**Swarm Type**: `MultiAgentRouter` + +## Overview + +The MultiAgentRouter acts as an intelligent task dispatcher, distributing work across agents based on their capabilities and current workload. This architecture analyzes incoming tasks and automatically routes them to the most suitable agents, optimizing both efficiency and quality of outcomes. + +Key features: +- **Intelligent Routing**: Automatically assigns tasks to best-suited agents +- **Capability Matching**: Matches task requirements with agent specializations +- **Load Balancing**: Distributes workload efficiently across available agents +- **Dynamic Assignment**: Adapts routing based on agent performance and availability + +## Use Cases + +- Customer service request routing +- Content categorization and processing +- Technical support ticket assignment +- Multi-domain question answering + +## API Usage + +### Basic MultiAgentRouter Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Customer Support Router", + "description": "Route customer inquiries to specialized support agents", + "swarm_type": "MultiAgentRouter", + "task": "Handle multiple customer inquiries: 1) Billing question about overcharge, 2) Technical issue with mobile app login, 3) Product recommendation for enterprise client, 4) Return policy question", + "agents": [ + { + "agent_name": "Billing Specialist", + "description": "Handles billing, payments, and account issues", + "system_prompt": "You are a billing specialist. Handle all billing inquiries, payment issues, refunds, and account-related questions with empathy and accuracy.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Technical Support", + "description": "Resolves technical issues and troubleshooting", + "system_prompt": "You are a technical support specialist. Diagnose and resolve technical issues, provide step-by-step troubleshooting, and escalate complex problems.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Sales Consultant", + "description": "Provides product recommendations and sales support", + "system_prompt": "You are a sales consultant. Provide product recommendations, explain features and benefits, and help customers find the right solutions.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.4 + }, + { + "agent_name": "Policy Advisor", + "description": "Explains company policies and procedures", + "system_prompt": "You are a policy advisor. Explain company policies, terms of service, return procedures, and compliance requirements clearly.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.1 + } + ], + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Customer Support Router", + "description": "Route customer inquiries to specialized support agents", + "swarm_type": "MultiAgentRouter", + "task": "Handle multiple customer inquiries: 1) Billing question about overcharge, 2) Technical issue with mobile app login, 3) Product recommendation for enterprise client, 4) Return policy question", + "agents": [ + { + "agent_name": "Billing Specialist", + "description": "Handles billing, payments, and account issues", + "system_prompt": "You are a billing specialist. Handle all billing inquiries, payment issues, refunds, and account-related questions with empathy and accuracy.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Technical Support", + "description": "Resolves technical issues and troubleshooting", + "system_prompt": "You are a technical support specialist. Diagnose and resolve technical issues, provide step-by-step troubleshooting, and escalate complex problems.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Sales Consultant", + "description": "Provides product recommendations and sales support", + "system_prompt": "You are a sales consultant. Provide product recommendations, explain features and benefits, and help customers find the right solutions.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.4 + }, + { + "agent_name": "Policy Advisor", + "description": "Explains company policies and procedures", + "system_prompt": "You are a policy advisor. Explain company policies, terms of service, return procedures, and compliance requirements clearly.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.1 + } + ], + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("MultiAgentRouter completed successfully!") + print(f"Routing decisions: {result['metadata']['routing_decisions']}") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Customer responses: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "customer-support-router", + "swarm_type": "MultiAgentRouter", + "task": "Handle multiple customer inquiries: 1) Billing question about overcharge, 2) Technical issue with mobile app login, 3) Product recommendation for enterprise client, 4) Return policy question", + "output": { + "inquiry_1_billing": { + "routed_to": "Billing Specialist", + "response": "I understand your concern about the overcharge. Let me review your account and identify the issue. I can see the duplicate charge and will process a refund within 3-5 business days...", + "resolution_status": "Resolved - Refund processed" + }, + "inquiry_2_technical": { + "routed_to": "Technical Support", + "response": "Let's troubleshoot the mobile app login issue. Please try these steps: 1) Clear app cache, 2) Update to latest version, 3) Reset password if needed...", + "resolution_status": "In Progress - Troubleshooting steps provided" + }, + "inquiry_3_sales": { + "routed_to": "Sales Consultant", + "response": "For enterprise clients, I recommend our Professional tier with advanced analytics, dedicated support, and custom integrations. This includes...", + "resolution_status": "Proposal sent - Follow-up scheduled" + }, + "inquiry_4_policy": { + "routed_to": "Policy Advisor", + "response": "Our return policy allows returns within 30 days of purchase for full refund. Items must be in original condition. Here's the complete process...", + "resolution_status": "Information provided - Customer satisfied" + } + }, + "metadata": { + "routing_decisions": [ + { + "inquiry": "Billing question about overcharge", + "routed_to": "Billing Specialist", + "confidence": 0.95, + "reasoning": "Billing-related inquiry requires specialized financial expertise" + }, + { + "inquiry": "Technical issue with mobile app login", + "routed_to": "Technical Support", + "confidence": 0.98, + "reasoning": "Technical troubleshooting requires technical specialist" + }, + { + "inquiry": "Product recommendation for enterprise client", + "routed_to": "Sales Consultant", + "confidence": 0.92, + "reasoning": "Enterprise sales requires specialized sales expertise" + }, + { + "inquiry": "Return policy question", + "routed_to": "Policy Advisor", + "confidence": 0.97, + "reasoning": "Policy questions require policy specialist knowledge" + } + ], + "routing_efficiency": "100% - All inquiries routed to optimal agents", + "execution_time_seconds": 16.4, + "billing_info": { + "total_cost": 0.042 + } + } +} +``` + +## Best Practices + +- Define agents with clear, distinct specializations +- Use descriptive agent names and descriptions for better routing +- Ideal for handling diverse task types that require different expertise +- Monitor routing decisions to optimize agent configurations + +## Related Swarm Types + +- [HierarchicalSwarm](hierarchical_swarm.md) - For structured task management +- [ConcurrentWorkflow](concurrent_workflow.md) - For parallel task processing +- [AutoSwarmBuilder](auto_swarm_builder.md) - For automatic routing setup \ No newline at end of file diff --git a/docs/swarms_cloud/sequential_workflow.md b/docs/swarms_cloud/sequential_workflow.md new file mode 100644 index 00000000..db192e8c --- /dev/null +++ b/docs/swarms_cloud/sequential_workflow.md @@ -0,0 +1,192 @@ +# SequentialWorkflow + +*Executes tasks in a strict, predefined order for step-by-step processing* + +**Swarm Type**: `SequentialWorkflow` + +## Overview + +The SequentialWorkflow swarm type executes tasks in a strict, predefined order where each step depends on the completion of the previous one. This architecture is perfect for workflows that require a linear progression of tasks, ensuring that each agent builds upon the work of the previous agent. + +Key features: +- **Ordered Execution**: Agents execute in a specific, predefined sequence +- **Step Dependencies**: Each step builds upon previous results +- **Predictable Flow**: Clear, linear progression through the workflow +- **Quality Control**: Each agent can validate and enhance previous work + +## Use Cases + +- Document processing pipelines +- Multi-stage analysis workflows +- Content creation and editing processes +- Data transformation and validation pipelines + +## API Usage + +### Basic SequentialWorkflow Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Content Creation Pipeline", + "description": "Sequential content creation from research to final output", + "swarm_type": "SequentialWorkflow", + "task": "Create a comprehensive blog post about the future of renewable energy", + "agents": [ + { + "agent_name": "Research Specialist", + "description": "Conducts thorough research on the topic", + "system_prompt": "You are a research specialist. Gather comprehensive, accurate information on the given topic from reliable sources.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Content Writer", + "description": "Creates engaging written content", + "system_prompt": "You are a skilled content writer. Transform research into engaging, well-structured articles that are informative and readable.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.6 + }, + { + "agent_name": "Editor", + "description": "Reviews and polishes the content", + "system_prompt": "You are a professional editor. Review content for clarity, grammar, flow, and overall quality. Make improvements while maintaining the author's voice.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.4 + }, + { + "agent_name": "SEO Optimizer", + "description": "Optimizes content for search engines", + "system_prompt": "You are an SEO expert. Optimize content for search engines while maintaining readability and quality.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + } + ], + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Content Creation Pipeline", + "description": "Sequential content creation from research to final output", + "swarm_type": "SequentialWorkflow", + "task": "Create a comprehensive blog post about the future of renewable energy", + "agents": [ + { + "agent_name": "Research Specialist", + "description": "Conducts thorough research on the topic", + "system_prompt": "You are a research specialist. Gather comprehensive, accurate information on the given topic from reliable sources.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Content Writer", + "description": "Creates engaging written content", + "system_prompt": "You are a skilled content writer. Transform research into engaging, well-structured articles that are informative and readable.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.6 + }, + { + "agent_name": "Editor", + "description": "Reviews and polishes the content", + "system_prompt": "You are a professional editor. Review content for clarity, grammar, flow, and overall quality. Make improvements while maintaining the author's voice.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.4 + }, + { + "agent_name": "SEO Optimizer", + "description": "Optimizes content for search engines", + "system_prompt": "You are an SEO expert. Optimize content for search engines while maintaining readability and quality.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + } + ], + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("SequentialWorkflow swarm completed successfully!") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Final output: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "content-creation-pipeline", + "swarm_type": "SequentialWorkflow", + "task": "Create a comprehensive blog post about the future of renewable energy", + "output": { + "research_findings": "Comprehensive research on renewable energy trends...", + "draft_content": "Initial blog post draft...", + "edited_content": "Polished and refined article...", + "final_seo_optimized": "SEO-optimized final blog post ready for publication..." + }, + "metadata": { + "execution_sequence": [ + "Research Specialist", + "Content Writer", + "Editor", + "SEO Optimizer" + ], + "step_outputs": { + "step_1": "Research findings and data", + "step_2": "Draft article content", + "step_3": "Edited and refined content", + "step_4": "SEO-optimized final version" + }, + "execution_time_seconds": 45.3, + "billing_info": { + "total_cost": 0.089 + } + } +} +``` + +## Best Practices + +- Design agents with clear, sequential dependencies +- Ensure each agent builds meaningfully on the previous work +- Use for linear workflows where order matters +- Validate outputs at each step before proceeding + +## Related Swarm Types + +- [ConcurrentWorkflow](concurrent_workflow.md) - For parallel execution +- [AgentRearrange](agent_rearrange.md) - For dynamic sequencing +- [HierarchicalSwarm](hierarchical_swarm.md) - For structured workflows \ No newline at end of file diff --git a/docs/swarms_cloud/spreadsheet_swarm.md b/docs/swarms_cloud/spreadsheet_swarm.md new file mode 100644 index 00000000..538edb48 --- /dev/null +++ b/docs/swarms_cloud/spreadsheet_swarm.md @@ -0,0 +1,232 @@ +# SpreadSheetSwarm + +*Structured approach to data management and operations in spreadsheet-like format* + +**Swarm Type**: `SpreadSheetSwarm` + +## Overview + +The SpreadSheetSwarm provides a structured approach to data management and operations, ideal for tasks involving data analysis, transformation, and systematic processing in a spreadsheet-like structure. This architecture organizes agents to work on data in a tabular format with clear rows, columns, and processing workflows. + +Key features: +- **Structured Data Processing**: Organizes work in spreadsheet-like rows and columns +- **Systematic Operations**: Sequential and methodical data handling +- **Data Transformation**: Efficient processing of structured datasets +- **Collaborative Analysis**: Multiple agents working on different data aspects + +## Use Cases + +- Financial data analysis and reporting +- Customer data processing and segmentation +- Inventory management and tracking +- Research data compilation and analysis + +## API Usage + +### Basic SpreadSheetSwarm Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Financial Analysis Spreadsheet", + "description": "Systematic financial data analysis using spreadsheet structure", + "swarm_type": "SpreadSheetSwarm", + "task": "Analyze quarterly financial performance data for a retail company with multiple product lines and create comprehensive insights", + "agents": [ + { + "agent_name": "Data Validator", + "description": "Validates and cleans financial data", + "system_prompt": "You are a data validation specialist. Clean, validate, and structure financial data ensuring accuracy and consistency.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Revenue Analyst", + "description": "Analyzes revenue trends and patterns", + "system_prompt": "You are a revenue analyst. Focus on revenue trends, growth patterns, and seasonal variations across product lines.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Cost Analyst", + "description": "Analyzes cost structures and margins", + "system_prompt": "You are a cost analyst. Examine cost structures, margin analysis, and expense categorization.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Performance Calculator", + "description": "Calculates KPIs and financial metrics", + "system_prompt": "You are a financial metrics specialist. Calculate KPIs, ratios, and performance indicators from the analyzed data.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.1 + }, + { + "agent_name": "Report Generator", + "description": "Creates structured financial reports", + "system_prompt": "You are a report generator. Create comprehensive, well-structured financial reports with insights and recommendations.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.4 + } + ], + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Financial Analysis Spreadsheet", + "description": "Systematic financial data analysis using spreadsheet structure", + "swarm_type": "SpreadSheetSwarm", + "task": "Analyze quarterly financial performance data for a retail company with multiple product lines and create comprehensive insights", + "agents": [ + { + "agent_name": "Data Validator", + "description": "Validates and cleans financial data", + "system_prompt": "You are a data validation specialist. Clean, validate, and structure financial data ensuring accuracy and consistency.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.2 + }, + { + "agent_name": "Revenue Analyst", + "description": "Analyzes revenue trends and patterns", + "system_prompt": "You are a revenue analyst. Focus on revenue trends, growth patterns, and seasonal variations across product lines.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Cost Analyst", + "description": "Analyzes cost structures and margins", + "system_prompt": "You are a cost analyst. Examine cost structures, margin analysis, and expense categorization.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Performance Calculator", + "description": "Calculates KPIs and financial metrics", + "system_prompt": "You are a financial metrics specialist. Calculate KPIs, ratios, and performance indicators from the analyzed data.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.1 + }, + { + "agent_name": "Report Generator", + "description": "Creates structured financial reports", + "system_prompt": "You are a report generator. Create comprehensive, well-structured financial reports with insights and recommendations.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.4 + } + ], + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("SpreadSheetSwarm completed successfully!") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Structured analysis: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "status": "success", + "swarm_name": "financial-analysis-spreadsheet", + "swarm_type": "SpreadSheetSwarm", + "task": "Analyze quarterly financial performance data for a retail company with multiple product lines and create comprehensive insights", + "output": { + "data_validation": { + "data_quality": "95% accuracy after cleaning", + "missing_values": "Identified and filled 3% missing entries", + "data_structure": "Standardized format across all product lines" + }, + "revenue_analysis": { + "q4_revenue": "$2.4M total revenue", + "growth_rate": "12% quarter-over-quarter growth", + "top_performers": ["Product Line A: +18%", "Product Line C: +15%"], + "seasonal_trends": "Strong holiday season performance" + }, + "cost_analysis": { + "total_costs": "$1.8M operational costs", + "cost_breakdown": "60% COGS, 25% Marketing, 15% Operations", + "margin_analysis": "25% gross margin, 15% net margin", + "cost_optimization": "Identified 8% potential savings in supply chain" + }, + "performance_metrics": { + "roi": "22% return on investment", + "customer_acquisition_cost": "$45 per customer", + "lifetime_value": "$320 average CLV", + "inventory_turnover": "6.2x annual turnover" + }, + "comprehensive_report": { + "executive_summary": "Strong Q4 performance with 12% growth...", + "recommendations": ["Expand Product Line A", "Optimize supply chain", "Increase marketing for underperformers"], + "forecast": "Projected 15% growth for Q1 based on trends" + } + }, + "metadata": { + "processing_structure": { + "rows_processed": 1250, + "columns_analyzed": 18, + "calculations_performed": 47 + }, + "data_pipeline": [ + "Data Validation", + "Revenue Analysis", + "Cost Analysis", + "Performance Calculation", + "Report Generation" + ], + "execution_time_seconds": 34.2, + "billing_info": { + "total_cost": 0.078 + } + } +} +``` + +## Best Practices + +- Structure data in clear, logical formats before processing +- Use systematic, step-by-step analysis approaches +- Ideal for quantitative analysis and reporting tasks +- Ensure data validation before proceeding with analysis + +## Related Swarm Types + +- [SequentialWorkflow](sequential_workflow.md) - For ordered data processing +- [ConcurrentWorkflow](concurrent_workflow.md) - For parallel data analysis +- [HierarchicalSwarm](hierarchical_swarm.md) - For complex data projects \ No newline at end of file diff --git a/docs/swarms_cloud/swarm_types.md b/docs/swarms_cloud/swarm_types.md index 2e69466d..8ab22abd 100644 --- a/docs/swarms_cloud/swarm_types.md +++ b/docs/swarms_cloud/swarm_types.md @@ -4,18 +4,18 @@ Each multi-agent architecture type is designed for specific use cases and can be | Swarm Type | Description | Learn More | |----------------------|------------------------------------------------------------------------------|------------| -| AgentRearrange | Dynamically reorganizes agents to optimize task performance and efficiency. Useful when agent effectiveness depends on their sequence or arrangement. | [Learn More](swarms_api.md#agentrearrange) | -| MixtureOfAgents | Builds diverse teams of specialized agents, each contributing unique skills to solve complex problems. Excels at tasks requiring multiple types of expertise. | [Learn More](swarms_api.md#mixtureofagents) | -| SpreadSheetSwarm | Provides a structured approach to data management and operations, ideal for tasks involving data analysis, transformation, and systematic processing in a spreadsheet-like structure. | [Learn More](swarms_api.md#spreadsheetswarm) | -| SequentialWorkflow | Executes tasks in a strict, predefined order. Perfect for workflows where each step depends on the completion of the previous one. | [Learn More](swarms_api.md#sequentialworkflow) | -| ConcurrentWorkflow | Runs independent tasks in parallel, significantly reducing processing time for complex operations. Ideal for tasks that can be processed simultaneously. | [Learn More](swarms_api.md#concurrentworkflow) | -| GroupChat | Enables dynamic collaboration between agents through a chat-based interface, facilitating real-time information sharing and decision-making. | [Learn More](swarms_api.md#groupchat) | -| MultiAgentRouter | Acts as an intelligent task dispatcher, distributing work across agents based on their capabilities and current workload. | [Learn More](swarms_api.md#multiagentrouter) | -| AutoSwarmBuilder | Automatically configures agent architectures based on task requirements and performance metrics, simplifying swarm creation. | [Learn More](swarms_api.md#autoswarmbuilder) | -| HierarchicalSwarm | Implements a structured, multi-level approach to task management, with clear lines of authority and delegation. | [Learn More](swarms_api.md#hierarchicalswarm) | -| Auto | Intelligently selects the most effective swarm architecture for a given task based on context. | [Learn More](swarms_api.md#auto) | -| MajorityVoting | Implements robust decision-making through consensus, ideal for tasks requiring collective intelligence or verification. | [Learn More](swarms_api_tools.md#majorityvoting) | -| MALT | Specialized framework for language-based tasks, optimizing agent collaboration for complex language processing operations. | [Learn More](swarms_api_tools.md#malt) | +| AgentRearrange | Dynamically reorganizes agents to optimize task performance and efficiency. Useful when agent effectiveness depends on their sequence or arrangement. | [Learn More](agent_rearrange.md) | +| MixtureOfAgents | Builds diverse teams of specialized agents, each contributing unique skills to solve complex problems. Excels at tasks requiring multiple types of expertise. | [Learn More](mixture_of_agents.md) | +| SpreadSheetSwarm | Provides a structured approach to data management and operations, ideal for tasks involving data analysis, transformation, and systematic processing in a spreadsheet-like structure. | [Learn More](spreadsheet_swarm.md) | +| SequentialWorkflow | Executes tasks in a strict, predefined order. Perfect for workflows where each step depends on the completion of the previous one. | [Learn More](sequential_workflow.md) | +| ConcurrentWorkflow | Runs independent tasks in parallel, significantly reducing processing time for complex operations. Ideal for tasks that can be processed simultaneously. | [Learn More](concurrent_workflow.md) | +| GroupChat | Enables dynamic collaboration between agents through a chat-based interface, facilitating real-time information sharing and decision-making. | [Learn More](group_chat.md) | +| MultiAgentRouter | Acts as an intelligent task dispatcher, distributing work across agents based on their capabilities and current workload. | [Learn More](multi_agent_router.md) | +| AutoSwarmBuilder | Automatically configures agent architectures based on task requirements and performance metrics, simplifying swarm creation. | [Learn More](auto_swarm_builder.md) | +| HierarchicalSwarm | Implements a structured, multi-level approach to task management, with clear lines of authority and delegation. | [Learn More](hierarchical_swarm.md) | +| Auto | Intelligently selects the most effective swarm architecture for a given task based on context. | [Learn More](auto.md) | +| MajorityVoting | Implements robust decision-making through consensus, ideal for tasks requiring collective intelligence or verification. | [Learn More](majority_voting.md) | +| MALT | Specialized framework for language-based tasks, optimizing agent collaboration for complex language processing operations. | [Learn More](malt.md) | # Learn More From cfc7c11d2c9057ccce8d0dc283797038d3f784e2 Mon Sep 17 00:00:00 2001 From: harshalmore31 Date: Fri, 1 Aug 2025 20:08:27 +0530 Subject: [PATCH 3/6] fixes and cleanup ! --- docs/mkdocs.yml | 12 +- docs/swarms_cloud/agent_rearrange.md | 66 ++++--- docs/swarms_cloud/auto.md | 150 +--------------- docs/swarms_cloud/auto_swarm_builder.md | 151 +--------------- docs/swarms_cloud/concurrent_workflow.md | 82 +++++---- docs/swarms_cloud/group_chat.md | 166 ------------------ docs/swarms_cloud/hierarchical_swarm.md | 195 --------------------- docs/swarms_cloud/majority_voting.md | 123 +++++++------- docs/swarms_cloud/malt.md | 208 ----------------------- docs/swarms_cloud/mixture_of_agents.md | 79 ++++++--- docs/swarms_cloud/multi_agent_router.md | 101 +++++------ docs/swarms_cloud/sequential_workflow.md | 74 +++++--- docs/swarms_cloud/spreadsheet_swarm.md | 191 --------------------- docs/swarms_cloud/swarm_types.md | 12 +- 14 files changed, 325 insertions(+), 1285 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index a371119c..e6fe1aff 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -449,16 +449,16 @@ nav: - Swarm Types: - AgentRearrange: "swarms_cloud/agent_rearrange.md" - MixtureOfAgents: "swarms_cloud/mixture_of_agents.md" - - SpreadSheetSwarm: "swarms_cloud/spreadsheet_swarm.md" + # - SpreadSheetSwarm: "swarms_cloud/spreadsheet_swarm.md" - SequentialWorkflow: "swarms_cloud/sequential_workflow.md" - ConcurrentWorkflow: "swarms_cloud/concurrent_workflow.md" - - GroupChat: "swarms_cloud/group_chat.md" + # - GroupChat: "swarms_cloud/group_chat.md" - MultiAgentRouter: "swarms_cloud/multi_agent_router.md" - - AutoSwarmBuilder: "swarms_cloud/auto_swarm_builder.md" - - HierarchicalSwarm: "swarms_cloud/hierarchical_swarm.md" - - Auto: "swarms_cloud/auto.md" + # - AutoSwarmBuilder: "swarms_cloud/auto_swarm_builder.md" + # - HierarchicalSwarm: "swarms_cloud/hierarchical_swarm.md" + # - Auto: "swarms_cloud/auto.md" - MajorityVoting: "swarms_cloud/majority_voting.md" - - MALT: "swarms_cloud/malt.md" + # - MALT: "swarms_cloud/malt.md" - Examples: - Medical Swarm: "swarms/examples/swarms_api_medical.md" - Finance Swarm: "swarms/examples/swarms_api_finance.md" diff --git a/docs/swarms_cloud/agent_rearrange.md b/docs/swarms_cloud/agent_rearrange.md index 15c05125..73293d90 100644 --- a/docs/swarms_cloud/agent_rearrange.md +++ b/docs/swarms_cloud/agent_rearrange.md @@ -61,7 +61,7 @@ Key features: "temperature": 0.4 } ], - "rearrange_flow": "Optimize agent sequence based on document complexity and required output quality", + "rearrange_flow": "Summarizer -> Legal Expert -> Document Analyzer", "max_loops": 1 }' ``` @@ -110,7 +110,7 @@ Key features: "temperature": 0.4 } ], - "rearrange_flow": "Optimize agent sequence based on document complexity and required output quality", + "rearrange_flow": "Summarizer -> Legal Expert -> Document Analyzer", "max_loops": 1 } @@ -133,24 +133,52 @@ Key features: **Example Response**: ```json { - "status": "success", - "swarm_name": "document-processing-rearrange", - "swarm_type": "AgentRearrange", - "task": "Analyze this legal document and extract key insights, then summarize findings and identify action items", - "output": { - "analysis": "Document analysis results...", - "legal_insights": "Legal implications and risks...", - "summary": "Concise summary of findings...", - "action_items": ["Action 1", "Action 2", "Action 3"] - }, - "metadata": { - "agent_sequence": ["Legal Expert", "Document Analyzer", "Summarizer"], - "rearrangement_reason": "Optimized for legal document analysis workflow", - "execution_time_seconds": 18.2, - "billing_info": { - "total_cost": 0.045 + "job_id": "swarms-Uc8R7UcepLmNNPwcU7JC6YPy5wiI", + "status": "success", + "swarm_name": "Document Processing Rearrange", + "description": "Process documents with dynamic agent reorganization", + "swarm_type": "AgentRearrange", + "output": [ + { + "role": "Summarizer", + "content": "\"Of course! Please provide the legal document you would like me to analyze, and I'll help extract key insights, summarize findings, and identify any action items.\"" + }, + { + "role": "Legal Expert", + "content": "\"\"Absolutely! Please upload or describe the legal document you need assistance with, and I'll provide an analysis that highlights key insights, summarizes the findings, and identifies any action items that may be necessary.\"\"" + }, + { + "role": "Document Analyzer", + "content": "\"Of course! Please provide the legal document you would like me to analyze, and I'll help extract key insights, summarize findings, and identify any action items.\"" + } + ], + "number_of_agents": 3, + "service_tier": "standard", + "execution_time": 7.898931264877319, + "usage": { + "input_tokens": 22, + "output_tokens": 144, + "total_tokens": 166, + "billing_info": { + "cost_breakdown": { + "agent_cost": 0.03, + "input_token_cost": 0.000066, + "output_token_cost": 0.00216, + "token_counts": { + "total_input_tokens": 22, + "total_output_tokens": 144, + "total_tokens": 166 + }, + "num_agents": 3, + "service_tier": "standard", + "night_time_discount_applied": true + }, + "total_cost": 0.032226, + "discount_active": true, + "discount_type": "night_time", + "discount_percentage": 75 + } } - } } ``` diff --git a/docs/swarms_cloud/auto.md b/docs/swarms_cloud/auto.md index 262797a1..e5e30df7 100644 --- a/docs/swarms_cloud/auto.md +++ b/docs/swarms_cloud/auto.md @@ -23,155 +23,7 @@ Key features: ## API Usage -### Basic Auto Example - -=== "Shell (curl)" - ```bash - curl -X POST "https://api.swarms.world/v1/swarm/completions" \ - -H "x-api-key: $SWARMS_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "name": "Auto Content Creation", - "description": "Let the system choose the best approach for content creation", - "swarm_type": "auto", - "task": "Create a comprehensive blog post about sustainable investing, including research, writing, editing, and SEO optimization", - "max_loops": 1 - }' - ``` - -=== "Python (requests)" - ```python - import requests - import json - - API_BASE_URL = "https://api.swarms.world" - API_KEY = "your_api_key_here" - - headers = { - "x-api-key": API_KEY, - "Content-Type": "application/json" - } - - swarm_config = { - "name": "Auto Content Creation", - "description": "Let the system choose the best approach for content creation", - "swarm_type": "auto", - "task": "Create a comprehensive blog post about sustainable investing, including research, writing, editing, and SEO optimization", - "max_loops": 1 - } - - response = requests.post( - f"{API_BASE_URL}/v1/swarm/completions", - headers=headers, - json=swarm_config - ) - - if response.status_code == 200: - result = response.json() - print("Auto swarm completed successfully!") - print(f"Selected architecture: {result['metadata']['selected_swarm_type']}") - print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") - print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") - print(f"Content: {result['output']}") - else: - print(f"Error: {response.status_code} - {response.text}") - ``` - -**Example Response**: -```json -{ - "status": "success", - "swarm_name": "auto-content-creation", - "swarm_type": "SequentialWorkflow", - "task": "Create a comprehensive blog post about sustainable investing, including research, writing, editing, and SEO optimization", - "output": { - "research_phase": { - "key_findings": "Sustainable investing has grown 42% in the past two years...", - "market_trends": "ESG funds outperformed traditional funds by 3.2%...", - "statistics": "Global sustainable investment assets reached $35.3 trillion..." - }, - "writing_phase": { - "title": "The Future of Sustainable Investing: A Guide to ESG Strategies", - "content": "Comprehensive blog post with introduction, main sections, and conclusion...", - "word_count": 1850 - }, - "editing_phase": { - "improvements": "Enhanced clarity, improved flow, corrected grammar", - "readability_score": "Grade 8 level - accessible to general audience", - "final_content": "Polished blog post ready for publication..." - }, - "seo_optimization": { - "target_keywords": ["sustainable investing", "ESG funds", "green finance"], - "meta_description": "Discover the future of sustainable investing...", - "optimized_content": "SEO-optimized version with strategic keyword placement" - } - }, - "metadata": { - "auto_selection": { - "selected_swarm_type": "SequentialWorkflow", - "reasoning": "Task requires step-by-step content creation process where each phase builds on the previous", - "analysis": { - "task_complexity": "Medium-High", - "sequential_dependencies": true, - "parallel_opportunities": false, - "collaboration_needs": "Low" - } - }, - "generated_agents": [ - "Research Specialist", - "Content Writer", - "Editor", - "SEO Optimizer" - ], - "execution_time_seconds": 43.2, - "billing_info": { - "total_cost": 0.087 - } - } -} -``` - -### Advanced Auto Usage - -You can provide additional context to help the Auto selection: - -=== "Shell (curl)" - ```bash - curl -X POST "https://api.swarms.world/v1/swarm/completions" \ - -H "x-api-key: $SWARMS_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "name": "Auto Business Analysis", - "description": "Automatic swarm selection for business analysis", - "swarm_type": "auto", - "task": "Analyze market opportunities for a new AI startup in healthcare", - "rules": "Need multiple perspectives from different business functions, time-sensitive analysis required", - "max_loops": 1 - }' - ``` - -=== "Python (requests)" - ```python - swarm_config = { - "name": "Auto Business Analysis", - "description": "Automatic swarm selection for business analysis", - "swarm_type": "auto", - "task": "Analyze market opportunities for a new AI startup in healthcare", - "rules": "Need multiple perspectives from different business functions, time-sensitive analysis required", - "max_loops": 1 - } - - response = requests.post( - f"{API_BASE_URL}/v1/swarm/completions", - headers=headers, - json=swarm_config - ) - - if response.status_code == 200: - result = response.json() - print(f"Auto selected: {result['metadata']['auto_selection']['selected_swarm_type']}") - print(f"Reasoning: {result['metadata']['auto_selection']['reasoning']}") - ``` + ## Selection Logic diff --git a/docs/swarms_cloud/auto_swarm_builder.md b/docs/swarms_cloud/auto_swarm_builder.md index 86799e1e..895a6f77 100644 --- a/docs/swarms_cloud/auto_swarm_builder.md +++ b/docs/swarms_cloud/auto_swarm_builder.md @@ -1,4 +1,4 @@ -# AutoSwarmBuilder +# AutoSwarmBuilder [ Needs an Fix ] *Automatically configures optimal swarm architectures based on task requirements* @@ -23,155 +23,6 @@ Key features: ## API Usage -### Basic AutoSwarmBuilder Example - -=== "Shell (curl)" - ```bash - curl -X POST "https://api.swarms.world/v1/swarm/completions" \ - -H "x-api-key: $SWARMS_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "name": "Auto Marketing Campaign", - "description": "Automatically build optimal swarm for marketing campaign creation", - "swarm_type": "AutoSwarmBuilder", - "task": "Create a comprehensive digital marketing campaign for a new sustainable fashion brand targeting Gen Z consumers", - "max_loops": 1 - }' - ``` - -=== "Python (requests)" - ```python - import requests - import json - - API_BASE_URL = "https://api.swarms.world" - API_KEY = "your_api_key_here" - - headers = { - "x-api-key": API_KEY, - "Content-Type": "application/json" - } - - swarm_config = { - "name": "Auto Marketing Campaign", - "description": "Automatically build optimal swarm for marketing campaign creation", - "swarm_type": "AutoSwarmBuilder", - "task": "Create a comprehensive digital marketing campaign for a new sustainable fashion brand targeting Gen Z consumers", - "max_loops": 1 - } - - response = requests.post( - f"{API_BASE_URL}/v1/swarm/completions", - headers=headers, - json=swarm_config - ) - - if response.status_code == 200: - result = response.json() - print("AutoSwarmBuilder completed successfully!") - print(f"Generated swarm architecture: {result['metadata']['generated_architecture']}") - print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") - print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") - print(f"Campaign output: {result['output']}") - else: - print(f"Error: {response.status_code} - {response.text}") - ``` - -**Example Response**: -```json -{ - "status": "success", - "swarm_name": "auto-marketing-campaign", - "swarm_type": "AutoSwarmBuilder", - "task": "Create a comprehensive digital marketing campaign for a new sustainable fashion brand targeting Gen Z consumers", - "output": { - "campaign_strategy": { - "brand_positioning": "Authentic, sustainable fashion for conscious Gen Z consumers", - "key_messaging": "Style that makes a difference - fashion with purpose", - "target_demographics": "Ages 18-26, environmentally conscious, social media active" - }, - "content_strategy": { - "social_platforms": ["TikTok", "Instagram", "Pinterest"], - "content_pillars": ["Sustainability education", "Style inspiration", "Behind-the-scenes"], - "posting_schedule": "Daily posts across platforms with peak engagement timing" - }, - "influencer_strategy": { - "tier_1": "Micro-influencers (10K-100K followers) focused on sustainability", - "tier_2": "Fashion nano-influencers (1K-10K followers) for authentic engagement", - "collaboration_types": ["Product partnerships", "Brand ambassador programs"] - }, - "paid_advertising": { - "platforms": ["Instagram Ads", "TikTok Ads", "Google Ads"], - "budget_allocation": "40% social media, 30% search, 30% video content", - "targeting_strategy": "Interest-based and lookalike audiences" - }, - "metrics_and_kpis": { - "awareness": "Brand mention volume, reach, impressions", - "engagement": "Comments, shares, saves, time spent", - "conversion": "Website traffic, email signups, sales" - } - }, - "metadata": { - "generated_architecture": { - "selected_swarm_type": "MixtureOfAgents", - "generated_agents": [ - "Brand Strategy Expert", - "Gen Z Marketing Specialist", - "Social Media Content Creator", - "Influencer Marketing Manager", - "Digital Advertising Strategist" - ], - "reasoning": "Complex marketing campaign requires diverse expertise working collaboratively" - }, - "auto_optimization": { - "task_complexity": "High", - "required_expertise_areas": 5, - "optimal_architecture": "Collaborative with specialized agents" - }, - "execution_time_seconds": 28.6, - "billing_info": { - "total_cost": 0.071 - } - } -} -``` - -### Advanced Configuration - -You can provide additional guidance to the AutoSwarmBuilder: - -=== "Shell (curl)" - ```bash - curl -X POST "https://api.swarms.world/v1/swarm/completions" \ - -H "x-api-key: $SWARMS_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "name": "Auto Research Project", - "description": "Auto-build research swarm with specific constraints", - "swarm_type": "AutoSwarmBuilder", - "task": "Conduct comprehensive research on the impact of AI on healthcare outcomes", - "rules": "Focus on peer-reviewed sources, include cost-benefit analysis, ensure balanced perspective on risks and benefits", - "max_loops": 1 - }' - ``` - -=== "Python (requests)" - ```python - swarm_config = { - "name": "Auto Research Project", - "description": "Auto-build research swarm with specific constraints", - "swarm_type": "AutoSwarmBuilder", - "task": "Conduct comprehensive research on the impact of AI on healthcare outcomes", - "rules": "Focus on peer-reviewed sources, include cost-benefit analysis, ensure balanced perspective on risks and benefits", - "max_loops": 1 - } - - response = requests.post( - f"{API_BASE_URL}/v1/swarm/completions", - headers=headers, - json=swarm_config - ) - ``` ## Configuration Options diff --git a/docs/swarms_cloud/concurrent_workflow.md b/docs/swarms_cloud/concurrent_workflow.md index 289deb84..aac81991 100644 --- a/docs/swarms_cloud/concurrent_workflow.md +++ b/docs/swarms_cloud/concurrent_workflow.md @@ -147,40 +147,56 @@ Key features: **Example Response**: ```json { - "status": "success", - "swarm_name": "market-research-concurrent", - "swarm_type": "ConcurrentWorkflow", - "task": "Research and analyze market opportunities in AI, healthcare, fintech, and e-commerce sectors", - "output": { - "ai_market_analysis": { - "market_size": "$150B by 2025", - "growth_rate": "25% CAGR", - "key_opportunities": ["Generative AI", "Edge AI", "AI Infrastructure"] - }, - "healthcare_analysis": { - "market_size": "$350B by 2025", - "growth_rate": "12% CAGR", - "key_opportunities": ["Telemedicine", "AI Diagnostics", "Digital Therapeutics"] - }, - "fintech_analysis": { - "market_size": "$200B by 2025", - "growth_rate": "18% CAGR", - "key_opportunities": ["DeFi", "Digital Banking", "Payment Infrastructure"] - }, - "ecommerce_analysis": { - "market_size": "$8T by 2025", - "growth_rate": "14% CAGR", - "key_opportunities": ["Social Commerce", "B2B Marketplaces", "Sustainable Commerce"] - } - }, - "metadata": { - "parallel_execution": true, - "agents_completed_simultaneously": 4, - "execution_time_seconds": 12.8, - "billing_info": { - "total_cost": 0.052 + "job_id": "swarms-S17nZFDesmLHxCRoeyF3NVYvPaXk", + "status": "success", + "swarm_name": "Market Research Concurrent", + "description": "Parallel market research across different sectors", + "swarm_type": "ConcurrentWorkflow", + "output": [ + { + "role": "E-commerce Market Analyst", + "content": "To analyze market opportunities in the AI, healthcare, fintech, and e-commerce sectors, we can break down each sector's current trends, consumer behavior, and emerging platforms. Here's an overview of each sector with a focus on e-commerce....." + }, + { + "role": "AI Market Analyst", + "content": "The artificial intelligence (AI) landscape presents numerous opportunities across various sectors, particularly in healthcare, fintech, and e-commerce. Here's a detailed analysis of each sector:\n\n### Healthcare....." + }, + { + "role": "Healthcare Market Analyst", + "content": "As a Healthcare Market Analyst, I will focus on analyzing market opportunities within the healthcare sector, particularly in the realm of AI and digital health. The intersection of healthcare with fintech and e-commerce also presents unique opportunities. Here's an overview of key trends and growth areas:...." + }, + { + "role": "Fintech Market Analyst", + "content": "Certainly! Let's break down the market opportunities in the fintech sector, focusing on financial technology trends, digital payment systems, blockchain opportunities, and regulatory developments:\n\n### 1. Financial Technology Trends....." + } + ], + "number_of_agents": 4, + "service_tier": "standard", + "execution_time": 23.360230922698975, + "usage": { + "input_tokens": 35, + "output_tokens": 2787, + "total_tokens": 2822, + "billing_info": { + "cost_breakdown": { + "agent_cost": 0.04, + "input_token_cost": 0.000105, + "output_token_cost": 0.041805, + "token_counts": { + "total_input_tokens": 35, + "total_output_tokens": 2787, + "total_tokens": 2822 + }, + "num_agents": 4, + "service_tier": "standard", + "night_time_discount_applied": true + }, + "total_cost": 0.08191, + "discount_active": true, + "discount_type": "night_time", + "discount_percentage": 75 + } } - } } ``` diff --git a/docs/swarms_cloud/group_chat.md b/docs/swarms_cloud/group_chat.md index e3410e1c..fa6cab9d 100644 --- a/docs/swarms_cloud/group_chat.md +++ b/docs/swarms_cloud/group_chat.md @@ -23,172 +23,6 @@ Key features: ## API Usage -### Basic GroupChat Example - -=== "Shell (curl)" - ```bash - curl -X POST "https://api.swarms.world/v1/swarm/completions" \ - -H "x-api-key: $SWARMS_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "name": "Product Strategy Discussion", - "description": "Collaborative chat to develop product strategy", - "swarm_type": "GroupChat", - "task": "Discuss and develop a go-to-market strategy for a new AI-powered productivity tool targeting small businesses", - "agents": [ - { - "agent_name": "Product Manager", - "description": "Leads product strategy and development", - "system_prompt": "You are a senior product manager. Focus on product positioning, features, user needs, and market fit. Ask probing questions and build on others ideas.", - "model_name": "gpt-4o", - "max_loops": 3, - "temperature": 0.6 - }, - { - "agent_name": "Marketing Strategist", - "description": "Develops marketing and positioning strategy", - "system_prompt": "You are a marketing strategist. Focus on target audience, messaging, channels, and competitive positioning. Contribute marketing insights to the discussion.", - "model_name": "gpt-4o", - "max_loops": 3, - "temperature": 0.7 - }, - { - "agent_name": "Sales Director", - "description": "Provides sales and customer perspective", - "system_prompt": "You are a sales director with small business experience. Focus on pricing, sales process, customer objections, and market adoption. Share practical sales insights.", - "model_name": "gpt-4o", - "max_loops": 3, - "temperature": 0.5 - }, - { - "agent_name": "UX Researcher", - "description": "Represents user experience and research insights", - "system_prompt": "You are a UX researcher specializing in small business tools. Focus on user behavior, usability, adoption barriers, and design considerations.", - "model_name": "gpt-4o", - "max_loops": 3, - "temperature": 0.4 - } - ], - "max_loops": 3 - }' - ``` - -=== "Python (requests)" - ```python - import requests - import json - - API_BASE_URL = "https://api.swarms.world" - API_KEY = "your_api_key_here" - - headers = { - "x-api-key": API_KEY, - "Content-Type": "application/json" - } - - swarm_config = { - "name": "Product Strategy Discussion", - "description": "Collaborative chat to develop product strategy", - "swarm_type": "GroupChat", - "task": "Discuss and develop a go-to-market strategy for a new AI-powered productivity tool targeting small businesses", - "agents": [ - { - "agent_name": "Product Manager", - "description": "Leads product strategy and development", - "system_prompt": "You are a senior product manager. Focus on product positioning, features, user needs, and market fit. Ask probing questions and build on others ideas.", - "model_name": "gpt-4o", - "max_loops": 3, - "temperature": 0.6 - }, - { - "agent_name": "Marketing Strategist", - "description": "Develops marketing and positioning strategy", - "system_prompt": "You are a marketing strategist. Focus on target audience, messaging, channels, and competitive positioning. Contribute marketing insights to the discussion.", - "model_name": "gpt-4o", - "max_loops": 3, - "temperature": 0.7 - }, - { - "agent_name": "Sales Director", - "description": "Provides sales and customer perspective", - "system_prompt": "You are a sales director with small business experience. Focus on pricing, sales process, customer objections, and market adoption. Share practical sales insights.", - "model_name": "gpt-4o", - "max_loops": 3, - "temperature": 0.5 - }, - { - "agent_name": "UX Researcher", - "description": "Represents user experience and research insights", - "system_prompt": "You are a UX researcher specializing in small business tools. Focus on user behavior, usability, adoption barriers, and design considerations.", - "model_name": "gpt-4o", - "max_loops": 3, - "temperature": 0.4 - } - ], - "max_loops": 3 - } - - response = requests.post( - f"{API_BASE_URL}/v1/swarm/completions", - headers=headers, - json=swarm_config - ) - - if response.status_code == 200: - result = response.json() - print("GroupChat swarm completed successfully!") - print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") - print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") - print(f"Chat discussion: {result['output']}") - else: - print(f"Error: {response.status_code} - {response.text}") - ``` - -**Example Response**: -```json -{ - "status": "success", - "swarm_name": "product-strategy-discussion", - "swarm_type": "GroupChat", - "task": "Discuss and develop a go-to-market strategy for a new AI-powered productivity tool targeting small businesses", - "output": { - "chat_transcript": [ - { - "agent": "Product Manager", - "message": "Let's start by defining our target user. What specific pain points do small businesses have with productivity tools?" - }, - { - "agent": "UX Researcher", - "message": "From our research, small businesses struggle with tool complexity and time to value. They need something that works immediately without extensive setup." - }, - { - "agent": "Sales Director", - "message": "I agree. SMBs have limited time and resources. They typically abandon tools that require more than a week to see value. Pricing is also critical - they're very cost-conscious." - }, - { - "agent": "Marketing Strategist", - "message": "This suggests we should focus on 'instant productivity gains' messaging. We could position against complex enterprise tools that overwhelm small teams." - } - ], - "key_decisions": [ - "Target: Small businesses with 5-50 employees", - "Positioning: Simple, immediate productivity gains", - "Pricing: Freemium model with low-cost paid tiers", - "GTM: Self-serve with strong onboarding" - ], - "final_strategy": "Launch with freemium model targeting productivity-focused small businesses through content marketing and self-serve channels..." - }, - "metadata": { - "conversation_rounds": 3, - "total_messages": 12, - "consensus_reached": true, - "execution_time_seconds": 38.7, - "billing_info": { - "total_cost": 0.095 - } - } -} -``` ## Best Practices diff --git a/docs/swarms_cloud/hierarchical_swarm.md b/docs/swarms_cloud/hierarchical_swarm.md index 0cd6ec21..f65c7a46 100644 --- a/docs/swarms_cloud/hierarchical_swarm.md +++ b/docs/swarms_cloud/hierarchical_swarm.md @@ -23,201 +23,6 @@ Key features: ## API Usage -### Basic HierarchicalSwarm Example - -=== "Shell (curl)" - ```bash - curl -X POST "https://api.swarms.world/v1/swarm/completions" \ - -H "x-api-key: $SWARMS_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "name": "Software Development Hierarchy", - "description": "Hierarchical software development team with project manager oversight", - "swarm_type": "HierarchicalSwarm", - "task": "Design and plan a new mobile app for expense tracking targeting freelancers", - "agents": [ - { - "agent_name": "Project Manager", - "description": "Oversees project planning and coordinates team efforts", - "system_prompt": "You are a senior project manager. Coordinate the team, break down tasks, ensure quality, and synthesize outputs. Delegate specific tasks to team members.", - "model_name": "gpt-4o", - "role": "manager", - "max_loops": 2, - "temperature": 0.4 - }, - { - "agent_name": "UX Designer", - "description": "Designs user experience and interface", - "system_prompt": "You are a UX designer specializing in mobile apps. Focus on user flows, wireframes, and interface design. Report findings to the project manager.", - "model_name": "gpt-4o", - "role": "worker", - "max_loops": 1, - "temperature": 0.6 - }, - { - "agent_name": "Technical Architect", - "description": "Designs technical architecture and system requirements", - "system_prompt": "You are a technical architect. Focus on system design, technology stack, database design, and technical requirements. Provide technical guidance.", - "model_name": "gpt-4o", - "role": "worker", - "max_loops": 1, - "temperature": 0.3 - }, - { - "agent_name": "Business Analyst", - "description": "Analyzes business requirements and market fit", - "system_prompt": "You are a business analyst. Focus on requirements gathering, market analysis, feature prioritization, and business logic.", - "model_name": "gpt-4o", - "role": "worker", - "max_loops": 1, - "temperature": 0.4 - }, - { - "agent_name": "QA Specialist", - "description": "Ensures quality and validates deliverables", - "system_prompt": "You are a QA specialist. Review all outputs for quality, completeness, and consistency. Identify gaps and suggest improvements.", - "model_name": "gpt-4o", - "role": "worker", - "max_loops": 1, - "temperature": 0.2 - } - ], - "max_loops": 2 - }' - ``` - -=== "Python (requests)" - ```python - import requests - import json - - API_BASE_URL = "https://api.swarms.world" - API_KEY = "your_api_key_here" - - headers = { - "x-api-key": API_KEY, - "Content-Type": "application/json" - } - - swarm_config = { - "name": "Software Development Hierarchy", - "description": "Hierarchical software development team with project manager oversight", - "swarm_type": "HierarchicalSwarm", - "task": "Design and plan a new mobile app for expense tracking targeting freelancers", - "agents": [ - { - "agent_name": "Project Manager", - "description": "Oversees project planning and coordinates team efforts", - "system_prompt": "You are a senior project manager. Coordinate the team, break down tasks, ensure quality, and synthesize outputs. Delegate specific tasks to team members.", - "model_name": "gpt-4o", - "role": "manager", - "max_loops": 2, - "temperature": 0.4 - }, - { - "agent_name": "UX Designer", - "description": "Designs user experience and interface", - "system_prompt": "You are a UX designer specializing in mobile apps. Focus on user flows, wireframes, and interface design. Report findings to the project manager.", - "model_name": "gpt-4o", - "role": "worker", - "max_loops": 1, - "temperature": 0.6 - }, - { - "agent_name": "Technical Architect", - "description": "Designs technical architecture and system requirements", - "system_prompt": "You are a technical architect. Focus on system design, technology stack, database design, and technical requirements. Provide technical guidance.", - "model_name": "gpt-4o", - "role": "worker", - "max_loops": 1, - "temperature": 0.3 - }, - { - "agent_name": "Business Analyst", - "description": "Analyzes business requirements and market fit", - "system_prompt": "You are a business analyst. Focus on requirements gathering, market analysis, feature prioritization, and business logic.", - "model_name": "gpt-4o", - "role": "worker", - "max_loops": 1, - "temperature": 0.4 - }, - { - "agent_name": "QA Specialist", - "description": "Ensures quality and validates deliverables", - "system_prompt": "You are a QA specialist. Review all outputs for quality, completeness, and consistency. Identify gaps and suggest improvements.", - "model_name": "gpt-4o", - "role": "worker", - "max_loops": 1, - "temperature": 0.2 - } - ], - "max_loops": 2 - } - - response = requests.post( - f"{API_BASE_URL}/v1/swarm/completions", - headers=headers, - json=swarm_config - ) - - if response.status_code == 200: - result = response.json() - print("HierarchicalSwarm completed successfully!") - print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") - print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") - print(f"Project plan: {result['output']}") - else: - print(f"Error: {response.status_code} - {response.text}") - ``` - -**Example Response**: -```json -{ - "status": "success", - "swarm_name": "software-development-hierarchy", - "swarm_type": "HierarchicalSwarm", - "task": "Design and plan a new mobile app for expense tracking targeting freelancers", - "output": { - "project_overview": { - "manager_synthesis": "Comprehensive project plan for freelancer expense tracking app...", - "timeline": "16-week development cycle", - "key_deliverables": ["UX Design", "Technical Architecture", "Business Requirements", "QA Framework"] - }, - "ux_design": { - "user_flows": "Streamlined expense entry and categorization flows...", - "wireframes": "Mobile-first design with dashboard and reporting views...", - "usability_considerations": "One-tap expense entry, photo receipt capture..." - }, - "technical_architecture": { - "tech_stack": "React Native, Node.js, PostgreSQL, AWS", - "system_design": "Microservices architecture with offline capability...", - "security_requirements": "End-to-end encryption, secure authentication..." - }, - "business_requirements": { - "target_market": "Freelancers and independent contractors", - "core_features": ["Expense tracking", "Receipt scanning", "Tax reporting"], - "monetization": "Freemium model with premium reporting features" - }, - "qa_framework": { - "testing_strategy": "Automated testing for core functions...", - "quality_metrics": "Performance, usability, and security benchmarks...", - "validation_checkpoints": "Weekly reviews and milestone validations" - } - }, - "metadata": { - "hierarchy_structure": { - "managers": ["Project Manager"], - "workers": ["UX Designer", "Technical Architect", "Business Analyst", "QA Specialist"] - }, - "coordination_rounds": 2, - "task_delegation": "Manager coordinated 4 specialized work streams", - "execution_time_seconds": 52.4, - "billing_info": { - "total_cost": 0.128 - } - } -} -``` ## Configuration Options diff --git a/docs/swarms_cloud/majority_voting.md b/docs/swarms_cloud/majority_voting.md index 63f39439..5a95dfa0 100644 --- a/docs/swarms_cloud/majority_voting.md +++ b/docs/swarms_cloud/majority_voting.md @@ -164,65 +164,74 @@ Key features: **Example Response**: ```json { - "status": "success", - "swarm_name": "investment-decision-voting", - "swarm_type": "MajorityVoting", - "task": "Evaluate whether to invest $1M in a renewable energy startup. Consider market potential, financial projections, team strength, and competitive landscape.", - "output": { - "individual_recommendations": [ - { - "agent": "Growth Investor", - "recommendation": "INVEST", - "confidence": 0.8, - "reasoning": "Strong market growth potential in renewable energy sector, scalable technology platform" - }, - { - "agent": "Financial Analyst", - "recommendation": "INVEST", - "confidence": 0.7, - "reasoning": "Solid financial projections, reasonable burn rate, clear path to profitability" - }, - { - "agent": "Technical Due Diligence", - "recommendation": "INVEST", - "confidence": 0.75, - "reasoning": "Innovative technology with strong IP portfolio, experienced technical team" - }, - { - "agent": "Market Analyst", - "recommendation": "WAIT", - "confidence": 0.6, - "reasoning": "Highly competitive market, regulatory uncertainties may impact timeline" - }, - { - "agent": "Risk Assessor", - "recommendation": "INVEST", - "confidence": 0.65, - "reasoning": "Manageable risks with strong mitigation strategies, experienced leadership team" - } + "job_id": "swarms-1WFsSJU2KcvY11lxRMjdQNWFHArI", + "status": "success", + "swarm_name": "Investment Decision Voting", + "description": "Multiple financial experts vote on investment recommendations", + "swarm_type": "MajorityVoting", + "output": [ + { + "role": "Financial Analyst", + "content": [ + "To evaluate the potential investment in a renewable energy startup, we will assess the technology viability, intellectual property, product-market fit, and technical risks, along with the additional factors of market ....." + ] + }, + { + "role": "Technical Due Diligence", + "content": [ + "To evaluate the potential investment in a renewable energy startup, we will analyze the relevant market dynamics, competitive landscape, regulatory environment, and market timing. Here's the breakdown of the assessment......." + ] + }, + { + "role": "Market Analyst", + "content": [ + "To evaluate the potential investment in a renewable energy startup, let's break down the key factors:\n\n1. **Market Potential........" + ] + }, + { + "role": "Growth Investor", + "content": [ + "To evaluate the potential investment in a renewable energy startup, we need to assess various risk factors and mitigation strategies across several key areas: market potential, financial projections, team strength, and competitive landscape.\n\n### 1. Market Potential\n**Risks:**\n- **Regulatory Changes................" + ] + }, + { + "role": "Risk Assessor", + "content": [ + "To provide a comprehensive evaluation of whether to invest $1M in the renewable energy startup, let's break down the key areas.........." + ] + }, + { + "role": "Risk Assessor", + "content": "To evaluate the potential investment in a renewable energy startup, we need to assess various risk factors and mitigation strategies across several key areas....." + } ], - "consensus_decision": "INVEST", - "consensus_confidence": 0.72, - "consensus_reasoning": "4 out of 5 experts recommend investment with strong market potential and solid fundamentals, despite some market uncertainties" - }, - "metadata": { - "vote_breakdown": { - "INVEST": 4, - "WAIT": 1, - "REJECT": 0 - }, - "vote_percentage": { - "INVEST": "80%", - "WAIT": "20%", - "REJECT": "0%" - }, - "average_confidence": 0.70, - "consensus_threshold": "Simple majority (50%+)", - "execution_time_seconds": 25.8, - "billing_info": { - "total_cost": 0.063 + "number_of_agents": 5, + "service_tier": "standard", + "execution_time": 61.74853563308716, + "usage": { + "input_tokens": 39, + "output_tokens": 8468, + "total_tokens": 8507, + "billing_info": { + "cost_breakdown": { + "agent_cost": 0.05, + "input_token_cost": 0.000117, + "output_token_cost": 0.12702, + "token_counts": { + "total_input_tokens": 39, + "total_output_tokens": 8468, + "total_tokens": 8507 + }, + "num_agents": 5, + "service_tier": "standard", + "night_time_discount_applied": false + }, + "total_cost": 0.177137, + "discount_active": false, + "discount_type": "none", + "discount_percentage": 0 + } } - } } ``` diff --git a/docs/swarms_cloud/malt.md b/docs/swarms_cloud/malt.md index 7539ed58..3247e854 100644 --- a/docs/swarms_cloud/malt.md +++ b/docs/swarms_cloud/malt.md @@ -23,215 +23,7 @@ Key features: ## API Usage -### Basic MALT Example -=== "Shell (curl)" - ```bash - curl -X POST "https://api.swarms.world/v1/swarm/completions" \ - -H "x-api-key: $SWARMS_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "name": "Legal Document Analysis MALT", - "description": "Advanced linguistic analysis of legal documents using MALT framework", - "swarm_type": "MALT", - "task": "Perform comprehensive linguistic analysis of a complex legal contract including sentiment analysis, risk identification, clause categorization, and language complexity assessment", - "agents": [ - { - "agent_name": "Syntactic Analyzer", - "description": "Analyzes sentence structure and grammar", - "system_prompt": "You are a syntactic analysis expert. Analyze sentence structure, grammatical patterns, and linguistic complexity in legal texts.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.2 - }, - { - "agent_name": "Semantic Analyzer", - "description": "Analyzes meaning and semantic relationships", - "system_prompt": "You are a semantic analysis expert. Extract meaning, identify semantic relationships, and analyze conceptual content in legal documents.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.3 - }, - { - "agent_name": "Pragmatic Analyzer", - "description": "Analyzes context and implied meanings", - "system_prompt": "You are a pragmatic analysis expert. Analyze contextual meaning, implied obligations, and pragmatic implications in legal language.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.4 - }, - { - "agent_name": "Discourse Analyzer", - "description": "Analyzes document structure and flow", - "system_prompt": "You are a discourse analysis expert. Analyze document structure, logical flow, and coherence in legal texts.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.3 - }, - { - "agent_name": "Risk Language Detector", - "description": "Identifies risk-related language patterns", - "system_prompt": "You are a legal risk language expert. Identify risk indicators, liability language, and potential legal concerns in contract language.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.2 - } - ], - "max_loops": 1 - }' - ``` - -=== "Python (requests)" - ```python - import requests - import json - - API_BASE_URL = "https://api.swarms.world" - API_KEY = "your_api_key_here" - - headers = { - "x-api-key": API_KEY, - "Content-Type": "application/json" - } - - swarm_config = { - "name": "Legal Document Analysis MALT", - "description": "Advanced linguistic analysis of legal documents using MALT framework", - "swarm_type": "MALT", - "task": "Perform comprehensive linguistic analysis of a complex legal contract including sentiment analysis, risk identification, clause categorization, and language complexity assessment", - "agents": [ - { - "agent_name": "Syntactic Analyzer", - "description": "Analyzes sentence structure and grammar", - "system_prompt": "You are a syntactic analysis expert. Analyze sentence structure, grammatical patterns, and linguistic complexity in legal texts.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.2 - }, - { - "agent_name": "Semantic Analyzer", - "description": "Analyzes meaning and semantic relationships", - "system_prompt": "You are a semantic analysis expert. Extract meaning, identify semantic relationships, and analyze conceptual content in legal documents.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.3 - }, - { - "agent_name": "Pragmatic Analyzer", - "description": "Analyzes context and implied meanings", - "system_prompt": "You are a pragmatic analysis expert. Analyze contextual meaning, implied obligations, and pragmatic implications in legal language.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.4 - }, - { - "agent_name": "Discourse Analyzer", - "description": "Analyzes document structure and flow", - "system_prompt": "You are a discourse analysis expert. Analyze document structure, logical flow, and coherence in legal texts.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.3 - }, - { - "agent_name": "Risk Language Detector", - "description": "Identifies risk-related language patterns", - "system_prompt": "You are a legal risk language expert. Identify risk indicators, liability language, and potential legal concerns in contract language.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.2 - } - ], - "max_loops": 1 - } - - response = requests.post( - f"{API_BASE_URL}/v1/swarm/completions", - headers=headers, - json=swarm_config - ) - - if response.status_code == 200: - result = response.json() - print("MALT framework completed successfully!") - print(f"Linguistic analysis: {result['output']['linguistic_analysis']}") - print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") - print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") - else: - print(f"Error: {response.status_code} - {response.text}") - ``` - -**Example Response**: -```json -{ - "status": "success", - "swarm_name": "legal-document-analysis-malt", - "swarm_type": "MALT", - "task": "Perform comprehensive linguistic analysis of a complex legal contract including sentiment analysis, risk identification, clause categorization, and language complexity assessment", - "output": { - "linguistic_analysis": { - "syntactic_analysis": { - "complexity_score": 8.2, - "sentence_structure": "Predominantly complex and compound-complex sentences", - "grammatical_patterns": "Heavy use of passive voice, subordinate clauses, and technical terminology", - "readability": "Graduate level (16+ years of education required)" - }, - "semantic_analysis": { - "key_concepts": ["liability", "indemnification", "force majeure", "intellectual property"], - "semantic_relationships": "Strong hierarchical concept relationships with clear definitional structures", - "conceptual_density": "High - 3.2 legal concepts per sentence average", - "ambiguity_indicators": ["potentially", "reasonable efforts", "material adverse effect"] - }, - "pragmatic_analysis": { - "implied_obligations": [ - "Good faith performance expected", - "Timely notice requirements implied", - "Mutual cooperation assumed" - ], - "power_dynamics": "Balanced with slight advantage to service provider", - "speech_acts": "Predominantly commissives (commitments) and directives (obligations)" - }, - "discourse_analysis": { - "document_structure": "Well-organized with clear section hierarchy", - "logical_flow": "Sequential with appropriate cross-references", - "coherence_score": 8.5, - "transition_patterns": "Formal legal transitions with clause numbering" - }, - "risk_language": { - "high_risk_terms": ["unlimited liability", "personal guarantee", "joint and several"], - "risk_mitigation_language": ["subject to", "limited to", "except as provided"], - "liability_indicators": 23, - "risk_level": "Medium-High" - } - }, - "comprehensive_summary": { - "language_complexity": "High complexity legal document requiring specialized knowledge", - "risk_assessment": "Medium-high risk with standard legal protections", - "readability_concerns": "Requires legal expertise for full comprehension", - "recommendations": [ - "Consider plain language summary for key terms", - "Review unlimited liability clauses", - "Clarify ambiguous terms identified" - ] - } - }, - "metadata": { - "malt_framework": { - "linguistic_layers_analyzed": 5, - "language_processing_depth": "Advanced multi-layer analysis", - "specialized_nlp_operations": [ - "Syntactic parsing", - "Semantic role labeling", - "Pragmatic inference", - "Discourse segmentation", - "Risk pattern recognition" - ] - }, - "execution_time_seconds": 35.7, - "billing_info": { - "total_cost": 0.089 - } - } -} ``` ## Best Practices diff --git a/docs/swarms_cloud/mixture_of_agents.md b/docs/swarms_cloud/mixture_of_agents.md index e02da9c7..d90e225b 100644 --- a/docs/swarms_cloud/mixture_of_agents.md +++ b/docs/swarms_cloud/mixture_of_agents.md @@ -147,29 +147,64 @@ Key features: **Example Response**: ```json { - "status": "success", - "swarm_name": "business-strategy-mixture", - "swarm_type": "MixtureOfAgents", - "task": "Develop a comprehensive market entry strategy for a new AI product in the healthcare sector", - "output": { - "market_analysis": "Detailed market research findings...", - "financial_assessment": "Financial projections and ROI analysis...", - "regulatory_compliance": "Regulatory requirements and pathways...", - "technology_strategy": "Technical implementation roadmap...", - "integrated_strategy": "Comprehensive market entry strategy combining all perspectives..." - }, - "metadata": { - "agent_contributions": { - "Market Research Analyst": "Market size: $2.3B, Growth rate: 15% CAGR", - "Financial Analyst": "Break-even: 18 months, ROI: 35%", - "Regulatory Expert": "FDA pathway: 510(k), Timeline: 8-12 months", - "Technology Strategist": "MVP timeline: 6 months, Scalability: High" - }, - "execution_time_seconds": 22.1, - "billing_info": { - "total_cost": 0.067 + "job_id": "swarms-kBZaJg1uGTkRbLCAsGztL2jrp5Mj", + "status": "success", + "swarm_name": "Business Strategy Mixture", + "description": "Diverse team analyzing business strategy from multiple perspectives", + "swarm_type": "MixtureOfAgents", + "output": [ + { + "role": "System", + "content": "Team Name: Business Strategy Mixture\nTeam Description: Diverse team analyzing business strategy from multiple perspectives\nThese are the agents in your team. Each agent has a specific role and expertise to contribute to the team's objectives.\nTotal Agents: 4\n\nBelow is a summary of your team members and their primary responsibilities:\n| Agent Name | Description |\n|------------|-------------|\n| Market Research Analyst | Analyzes market trends and opportunities |\n| Financial Analyst | Evaluates financial viability and projections |\n| Regulatory Expert | Analyzes compliance and regulatory requirements |\n| Technology Strategist | Evaluates technical feasibility and strategy |\n\nEach agent is designed to handle tasks within their area of expertise. Collaborate effectively by assigning tasks according to these roles." + }, + { + "role": "Market Research Analyst", + "content": "To develop a comprehensive market entry strategy for a new AI product in the healthcare sector, we will leverage the expertise of each team member to cover all critical aspects of the strategy. Here's how each agent will contribute......." + }, + { + "role": "Technology Strategist", + "content": "To develop a comprehensive market entry strategy for a new AI product in the healthcare sector, we'll need to collaborate effectively with the team, leveraging each member's expertise. Here's how each agent can contribute to the strategy, along with a focus on the technical requirements, implementation challenges, and scalability from the technology strategist's perspective....." + }, + { + "role": "Financial Analyst", + "content": "Developing a comprehensive market entry strategy for a new AI product in the healthcare sector involves a multidisciplinary approach. Each agent in the Business Strategy Mixture team will play a crucial role in ensuring a successful market entry. Here's how the team can collaborate........" + }, + { + "role": "Regulatory Expert", + "content": "To develop a comprehensive market entry strategy for a new AI product in the healthcare sector, we need to leverage the expertise of each agent in the Business Strategy Mixture team. Below is an outline of how each team member can contribute to this strategy......" + }, + { + "role": "Aggregator Agent", + "content": "As the Aggregator Agent, I've observed and analyzed the responses from the Business Strategy Mixture team regarding the development of a comprehensive market entry strategy for a new AI product in the healthcare sector. Here's a summary of the key points ......" + } + ], + "number_of_agents": 4, + "service_tier": "standard", + "execution_time": 30.230480670928955, + "usage": { + "input_tokens": 30, + "output_tokens": 3401, + "total_tokens": 3431, + "billing_info": { + "cost_breakdown": { + "agent_cost": 0.04, + "input_token_cost": 0.00009, + "output_token_cost": 0.051015, + "token_counts": { + "total_input_tokens": 30, + "total_output_tokens": 3401, + "total_tokens": 3431 + }, + "num_agents": 4, + "service_tier": "standard", + "night_time_discount_applied": true + }, + "total_cost": 0.091105, + "discount_active": true, + "discount_type": "night_time", + "discount_percentage": 75 + } } - } } ``` diff --git a/docs/swarms_cloud/multi_agent_router.md b/docs/swarms_cloud/multi_agent_router.md index 57f5516e..b69641a1 100644 --- a/docs/swarms_cloud/multi_agent_router.md +++ b/docs/swarms_cloud/multi_agent_router.md @@ -148,65 +148,52 @@ Key features: **Example Response**: ```json { - "status": "success", - "swarm_name": "customer-support-router", - "swarm_type": "MultiAgentRouter", - "task": "Handle multiple customer inquiries: 1) Billing question about overcharge, 2) Technical issue with mobile app login, 3) Product recommendation for enterprise client, 4) Return policy question", - "output": { - "inquiry_1_billing": { - "routed_to": "Billing Specialist", - "response": "I understand your concern about the overcharge. Let me review your account and identify the issue. I can see the duplicate charge and will process a refund within 3-5 business days...", - "resolution_status": "Resolved - Refund processed" - }, - "inquiry_2_technical": { - "routed_to": "Technical Support", - "response": "Let's troubleshoot the mobile app login issue. Please try these steps: 1) Clear app cache, 2) Update to latest version, 3) Reset password if needed...", - "resolution_status": "In Progress - Troubleshooting steps provided" - }, - "inquiry_3_sales": { - "routed_to": "Sales Consultant", - "response": "For enterprise clients, I recommend our Professional tier with advanced analytics, dedicated support, and custom integrations. This includes...", - "resolution_status": "Proposal sent - Follow-up scheduled" - }, - "inquiry_4_policy": { - "routed_to": "Policy Advisor", - "response": "Our return policy allows returns within 30 days of purchase for full refund. Items must be in original condition. Here's the complete process...", - "resolution_status": "Information provided - Customer satisfied" - } - }, - "metadata": { - "routing_decisions": [ - { - "inquiry": "Billing question about overcharge", - "routed_to": "Billing Specialist", - "confidence": 0.95, - "reasoning": "Billing-related inquiry requires specialized financial expertise" - }, - { - "inquiry": "Technical issue with mobile app login", - "routed_to": "Technical Support", - "confidence": 0.98, - "reasoning": "Technical troubleshooting requires technical specialist" - }, - { - "inquiry": "Product recommendation for enterprise client", - "routed_to": "Sales Consultant", - "confidence": 0.92, - "reasoning": "Enterprise sales requires specialized sales expertise" - }, - { - "inquiry": "Return policy question", - "routed_to": "Policy Advisor", - "confidence": 0.97, - "reasoning": "Policy questions require policy specialist knowledge" - } + "job_id": "swarms-OvOZHubprE3thzLmRdNBZAxA6om4", + "status": "success", + "swarm_name": "Customer Support Router", + "description": "Route customer inquiries to specialized support agents", + "swarm_type": "MultiAgentRouter", + "output": [ + { + "role": "user", + "content": "Handle multiple customer inquiries: 1) Billing question about overcharge, 2) Technical issue with mobile app login, 3) Product recommendation for enterprise client, 4) Return policy question" + }, + { + "role": "Agent Router", + "content": "selected_agent='Billing Specialist' reasoning='The task involves multiple inquiries, but the first one is about a billing question regarding an overcharge. Billing issues often require immediate attention to ensure customer satisfaction and prevent further complications. Therefore, the Billing Specialist is the most appropriate agent to handle this task. They can address the billing question directly and potentially coordinate with other agents for the remaining inquiries.' modified_task='Billing question about overcharge'" + }, + { + "role": "Billing Specialist", + "content": "Of course, I'd be happy to help you with your billing question regarding an overcharge. Could you please provide me with more details about the charge in question, such as the date it occurred and the amount? This information will help me look into your account and resolve the issue as quickly as possible." + } ], - "routing_efficiency": "100% - All inquiries routed to optimal agents", - "execution_time_seconds": 16.4, - "billing_info": { - "total_cost": 0.042 + "number_of_agents": 4, + "service_tier": "standard", + "execution_time": 7.800086975097656, + "usage": { + "input_tokens": 28, + "output_tokens": 221, + "total_tokens": 249, + "billing_info": { + "cost_breakdown": { + "agent_cost": 0.04, + "input_token_cost": 0.000084, + "output_token_cost": 0.003315, + "token_counts": { + "total_input_tokens": 28, + "total_output_tokens": 221, + "total_tokens": 249 + }, + "num_agents": 4, + "service_tier": "standard", + "night_time_discount_applied": true + }, + "total_cost": 0.043399, + "discount_active": true, + "discount_type": "night_time", + "discount_percentage": 75 + } } - } } ``` diff --git a/docs/swarms_cloud/sequential_workflow.md b/docs/swarms_cloud/sequential_workflow.md index db192e8c..1754e6ca 100644 --- a/docs/swarms_cloud/sequential_workflow.md +++ b/docs/swarms_cloud/sequential_workflow.md @@ -147,34 +147,56 @@ Key features: **Example Response**: ```json { - "status": "success", - "swarm_name": "content-creation-pipeline", - "swarm_type": "SequentialWorkflow", - "task": "Create a comprehensive blog post about the future of renewable energy", - "output": { - "research_findings": "Comprehensive research on renewable energy trends...", - "draft_content": "Initial blog post draft...", - "edited_content": "Polished and refined article...", - "final_seo_optimized": "SEO-optimized final blog post ready for publication..." - }, - "metadata": { - "execution_sequence": [ - "Research Specialist", - "Content Writer", - "Editor", - "SEO Optimizer" + "job_id": "swarms-pbM8wqUwxq8afGeROV2A4xAcncd1", + "status": "success", + "swarm_name": "Content Creation Pipeline", + "description": "Sequential content creation from research to final output", + "swarm_type": "SequentialWorkflow", + "output": [ + { + "role": "Research Specialist", + "content": "\"**Title: The Future of Renewable Energy: Charting a Sustainable Path Forward**\n\nAs we navigate the complexities of the 21st century, the transition to renewable energy stands out as a critical endeavor to ensure a sustainable future......" + }, + { + "role": "SEO Optimizer", + "content": "\"**Title: The Future of Renewable Energy: Charting a Sustainable Path Forward**\n\nThe transition to renewable energy is crucial as we face the challenges of the 21st century, including climate change and dwindling fossil fuel resources......." + }, + { + "role": "Editor", + "content": "\"**Title: The Future of Renewable Energy: Charting a Sustainable Path Forward**\n\nAs we confront the challenges of the 21st century, transitioning to renewable energy is essential for a sustainable future. With climate change concerns escalating and fossil fuel reserves depleting, renewable energy is not just an option but a necessity...." + }, + { + "role": "Content Writer", + "content": "\"**Title: The Future of Renewable Energy: Charting a Sustainable Path Forward**\n\nAs we face the multifaceted challenges of the 21st century, transitioning to renewable energy emerges as not just an option but an essential step toward a sustainable future...." + } ], - "step_outputs": { - "step_1": "Research findings and data", - "step_2": "Draft article content", - "step_3": "Edited and refined content", - "step_4": "SEO-optimized final version" - }, - "execution_time_seconds": 45.3, - "billing_info": { - "total_cost": 0.089 + "number_of_agents": 4, + "service_tier": "standard", + "execution_time": 72.23084282875061, + "usage": { + "input_tokens": 28, + "output_tokens": 3012, + "total_tokens": 3040, + "billing_info": { + "cost_breakdown": { + "agent_cost": 0.04, + "input_token_cost": 0.000084, + "output_token_cost": 0.04518, + "token_counts": { + "total_input_tokens": 28, + "total_output_tokens": 3012, + "total_tokens": 3040 + }, + "num_agents": 4, + "service_tier": "standard", + "night_time_discount_applied": true + }, + "total_cost": 0.085264, + "discount_active": true, + "discount_type": "night_time", + "discount_percentage": 75 + } } - } } ``` diff --git a/docs/swarms_cloud/spreadsheet_swarm.md b/docs/swarms_cloud/spreadsheet_swarm.md index 538edb48..47beafaf 100644 --- a/docs/swarms_cloud/spreadsheet_swarm.md +++ b/docs/swarms_cloud/spreadsheet_swarm.md @@ -25,198 +25,7 @@ Key features: ### Basic SpreadSheetSwarm Example -=== "Shell (curl)" - ```bash - curl -X POST "https://api.swarms.world/v1/swarm/completions" \ - -H "x-api-key: $SWARMS_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "name": "Financial Analysis Spreadsheet", - "description": "Systematic financial data analysis using spreadsheet structure", - "swarm_type": "SpreadSheetSwarm", - "task": "Analyze quarterly financial performance data for a retail company with multiple product lines and create comprehensive insights", - "agents": [ - { - "agent_name": "Data Validator", - "description": "Validates and cleans financial data", - "system_prompt": "You are a data validation specialist. Clean, validate, and structure financial data ensuring accuracy and consistency.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.2 - }, - { - "agent_name": "Revenue Analyst", - "description": "Analyzes revenue trends and patterns", - "system_prompt": "You are a revenue analyst. Focus on revenue trends, growth patterns, and seasonal variations across product lines.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.3 - }, - { - "agent_name": "Cost Analyst", - "description": "Analyzes cost structures and margins", - "system_prompt": "You are a cost analyst. Examine cost structures, margin analysis, and expense categorization.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.3 - }, - { - "agent_name": "Performance Calculator", - "description": "Calculates KPIs and financial metrics", - "system_prompt": "You are a financial metrics specialist. Calculate KPIs, ratios, and performance indicators from the analyzed data.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.1 - }, - { - "agent_name": "Report Generator", - "description": "Creates structured financial reports", - "system_prompt": "You are a report generator. Create comprehensive, well-structured financial reports with insights and recommendations.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.4 - } - ], - "max_loops": 1 - }' - ``` -=== "Python (requests)" - ```python - import requests - import json - - API_BASE_URL = "https://api.swarms.world" - API_KEY = "your_api_key_here" - - headers = { - "x-api-key": API_KEY, - "Content-Type": "application/json" - } - - swarm_config = { - "name": "Financial Analysis Spreadsheet", - "description": "Systematic financial data analysis using spreadsheet structure", - "swarm_type": "SpreadSheetSwarm", - "task": "Analyze quarterly financial performance data for a retail company with multiple product lines and create comprehensive insights", - "agents": [ - { - "agent_name": "Data Validator", - "description": "Validates and cleans financial data", - "system_prompt": "You are a data validation specialist. Clean, validate, and structure financial data ensuring accuracy and consistency.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.2 - }, - { - "agent_name": "Revenue Analyst", - "description": "Analyzes revenue trends and patterns", - "system_prompt": "You are a revenue analyst. Focus on revenue trends, growth patterns, and seasonal variations across product lines.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.3 - }, - { - "agent_name": "Cost Analyst", - "description": "Analyzes cost structures and margins", - "system_prompt": "You are a cost analyst. Examine cost structures, margin analysis, and expense categorization.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.3 - }, - { - "agent_name": "Performance Calculator", - "description": "Calculates KPIs and financial metrics", - "system_prompt": "You are a financial metrics specialist. Calculate KPIs, ratios, and performance indicators from the analyzed data.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.1 - }, - { - "agent_name": "Report Generator", - "description": "Creates structured financial reports", - "system_prompt": "You are a report generator. Create comprehensive, well-structured financial reports with insights and recommendations.", - "model_name": "gpt-4o", - "max_loops": 1, - "temperature": 0.4 - } - ], - "max_loops": 1 - } - - response = requests.post( - f"{API_BASE_URL}/v1/swarm/completions", - headers=headers, - json=swarm_config - ) - - if response.status_code == 200: - result = response.json() - print("SpreadSheetSwarm completed successfully!") - print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") - print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") - print(f"Structured analysis: {result['output']}") - else: - print(f"Error: {response.status_code} - {response.text}") - ``` - -**Example Response**: -```json -{ - "status": "success", - "swarm_name": "financial-analysis-spreadsheet", - "swarm_type": "SpreadSheetSwarm", - "task": "Analyze quarterly financial performance data for a retail company with multiple product lines and create comprehensive insights", - "output": { - "data_validation": { - "data_quality": "95% accuracy after cleaning", - "missing_values": "Identified and filled 3% missing entries", - "data_structure": "Standardized format across all product lines" - }, - "revenue_analysis": { - "q4_revenue": "$2.4M total revenue", - "growth_rate": "12% quarter-over-quarter growth", - "top_performers": ["Product Line A: +18%", "Product Line C: +15%"], - "seasonal_trends": "Strong holiday season performance" - }, - "cost_analysis": { - "total_costs": "$1.8M operational costs", - "cost_breakdown": "60% COGS, 25% Marketing, 15% Operations", - "margin_analysis": "25% gross margin, 15% net margin", - "cost_optimization": "Identified 8% potential savings in supply chain" - }, - "performance_metrics": { - "roi": "22% return on investment", - "customer_acquisition_cost": "$45 per customer", - "lifetime_value": "$320 average CLV", - "inventory_turnover": "6.2x annual turnover" - }, - "comprehensive_report": { - "executive_summary": "Strong Q4 performance with 12% growth...", - "recommendations": ["Expand Product Line A", "Optimize supply chain", "Increase marketing for underperformers"], - "forecast": "Projected 15% growth for Q1 based on trends" - } - }, - "metadata": { - "processing_structure": { - "rows_processed": 1250, - "columns_analyzed": 18, - "calculations_performed": 47 - }, - "data_pipeline": [ - "Data Validation", - "Revenue Analysis", - "Cost Analysis", - "Performance Calculation", - "Report Generation" - ], - "execution_time_seconds": 34.2, - "billing_info": { - "total_cost": 0.078 - } - } -} -``` ## Best Practices diff --git a/docs/swarms_cloud/swarm_types.md b/docs/swarms_cloud/swarm_types.md index 8ab22abd..f61277b9 100644 --- a/docs/swarms_cloud/swarm_types.md +++ b/docs/swarms_cloud/swarm_types.md @@ -6,16 +6,16 @@ Each multi-agent architecture type is designed for specific use cases and can be |----------------------|------------------------------------------------------------------------------|------------| | AgentRearrange | Dynamically reorganizes agents to optimize task performance and efficiency. Useful when agent effectiveness depends on their sequence or arrangement. | [Learn More](agent_rearrange.md) | | MixtureOfAgents | Builds diverse teams of specialized agents, each contributing unique skills to solve complex problems. Excels at tasks requiring multiple types of expertise. | [Learn More](mixture_of_agents.md) | -| SpreadSheetSwarm | Provides a structured approach to data management and operations, ideal for tasks involving data analysis, transformation, and systematic processing in a spreadsheet-like structure. | [Learn More](spreadsheet_swarm.md) | + | SequentialWorkflow | Executes tasks in a strict, predefined order. Perfect for workflows where each step depends on the completion of the previous one. | [Learn More](sequential_workflow.md) | | ConcurrentWorkflow | Runs independent tasks in parallel, significantly reducing processing time for complex operations. Ideal for tasks that can be processed simultaneously. | [Learn More](concurrent_workflow.md) | -| GroupChat | Enables dynamic collaboration between agents through a chat-based interface, facilitating real-time information sharing and decision-making. | [Learn More](group_chat.md) | + | MultiAgentRouter | Acts as an intelligent task dispatcher, distributing work across agents based on their capabilities and current workload. | [Learn More](multi_agent_router.md) | -| AutoSwarmBuilder | Automatically configures agent architectures based on task requirements and performance metrics, simplifying swarm creation. | [Learn More](auto_swarm_builder.md) | -| HierarchicalSwarm | Implements a structured, multi-level approach to task management, with clear lines of authority and delegation. | [Learn More](hierarchical_swarm.md) | -| Auto | Intelligently selects the most effective swarm architecture for a given task based on context. | [Learn More](auto.md) | + + | MajorityVoting | Implements robust decision-making through consensus, ideal for tasks requiring collective intelligence or verification. | [Learn More](majority_voting.md) | -| MALT | Specialized framework for language-based tasks, optimizing agent collaboration for complex language processing operations. | [Learn More](malt.md) | + # Learn More From 224e8eb58d0bcaf6cab6d124991bfd9c2c2149fc Mon Sep 17 00:00:00 2001 From: harshalmore31 Date: Fri, 1 Aug 2025 20:10:34 +0530 Subject: [PATCH 4/6] updates! --- docs/swarms_cloud/swarm_types.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/swarms_cloud/swarm_types.md b/docs/swarms_cloud/swarm_types.md index f61277b9..e28bace4 100644 --- a/docs/swarms_cloud/swarm_types.md +++ b/docs/swarms_cloud/swarm_types.md @@ -6,15 +6,15 @@ Each multi-agent architecture type is designed for specific use cases and can be |----------------------|------------------------------------------------------------------------------|------------| | AgentRearrange | Dynamically reorganizes agents to optimize task performance and efficiency. Useful when agent effectiveness depends on their sequence or arrangement. | [Learn More](agent_rearrange.md) | | MixtureOfAgents | Builds diverse teams of specialized agents, each contributing unique skills to solve complex problems. Excels at tasks requiring multiple types of expertise. | [Learn More](mixture_of_agents.md) | - | SequentialWorkflow | Executes tasks in a strict, predefined order. Perfect for workflows where each step depends on the completion of the previous one. | [Learn More](sequential_workflow.md) | | ConcurrentWorkflow | Runs independent tasks in parallel, significantly reducing processing time for complex operations. Ideal for tasks that can be processed simultaneously. | [Learn More](concurrent_workflow.md) | - | MultiAgentRouter | Acts as an intelligent task dispatcher, distributing work across agents based on their capabilities and current workload. | [Learn More](multi_agent_router.md) | +| MajorityVoting | Implements robust decision-making through consensus, ideal for tasks requiring collective intelligence or verification. | [Learn More](majority_voting.md) | + + -| MajorityVoting | Implements robust decision-making through consensus, ideal for tasks requiring collective intelligence or verification. | [Learn More](majority_voting.md) | # Learn More From 1444a719c43c9f38b1a2d60085e2d2e2860c2b16 Mon Sep 17 00:00:00 2001 From: harshalmore31 Date: Fri, 1 Aug 2025 21:27:39 +0530 Subject: [PATCH 5/6] fixes !! --- docs/mkdocs.yml | 2 +- docs/swarms_cloud/group_chat.md | 151 +++++++++++++++++++++++++++++++ docs/swarms_cloud/swarm_types.md | 4 +- 3 files changed, 155 insertions(+), 2 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index e6fe1aff..729dd70c 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -452,7 +452,7 @@ nav: # - SpreadSheetSwarm: "swarms_cloud/spreadsheet_swarm.md" - SequentialWorkflow: "swarms_cloud/sequential_workflow.md" - ConcurrentWorkflow: "swarms_cloud/concurrent_workflow.md" - # - GroupChat: "swarms_cloud/group_chat.md" + - GroupChat: "swarms_cloud/group_chat.md" - MultiAgentRouter: "swarms_cloud/multi_agent_router.md" # - AutoSwarmBuilder: "swarms_cloud/auto_swarm_builder.md" # - HierarchicalSwarm: "swarms_cloud/hierarchical_swarm.md" diff --git a/docs/swarms_cloud/group_chat.md b/docs/swarms_cloud/group_chat.md index fa6cab9d..3c3ee17c 100644 --- a/docs/swarms_cloud/group_chat.md +++ b/docs/swarms_cloud/group_chat.md @@ -23,6 +23,157 @@ Key features: ## API Usage +### Basic GroupChat Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Product Strategy Discussion", + "description": "Collaborative chat to develop product strategy", + "swarm_type": "GroupChat", + "task": "Discuss and develop a go-to-market strategy for a new AI-powered productivity tool targeting small businesses", + "agents": [ + { + "agent_name": "Product Manager", + "description": "Leads product strategy and development", + "system_prompt": "You are a senior product manager. Focus on product positioning, features, user needs, and market fit. Ask probing questions and build on others ideas.", + "model_name": "gpt-4o", + "max_loops": 3, + }, + { + "agent_name": "Marketing Strategist", + "description": "Develops marketing and positioning strategy", + "system_prompt": "You are a marketing strategist. Focus on target audience, messaging, channels, and competitive positioning. Contribute marketing insights to the discussion.", + "model_name": "gpt-4o", + "max_loops": 3, + }, + { + "agent_name": "Sales Director", + "description": "Provides sales and customer perspective", + "system_prompt": "You are a sales director with small business experience. Focus on pricing, sales process, customer objections, and market adoption. Share practical sales insights.", + "model_name": "gpt-4o", + "max_loops": 3, + }, + { + "agent_name": "UX Researcher", + "description": "Represents user experience and research insights", + "system_prompt": "You are a UX researcher specializing in small business tools. Focus on user behavior, usability, adoption barriers, and design considerations.", + "model_name": "gpt-4o", + "max_loops": 3, + } + ], + "max_loops": 3 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Product Strategy Discussion", + "description": "Collaborative chat to develop product strategy", + "swarm_type": "GroupChat", + "task": "Discuss and develop a go-to-market strategy for a new AI-powered productivity tool targeting small businesses", + "agents": [ + { + "agent_name": "Product Manager", + "description": "Leads product strategy and development", + "system_prompt": "You are a senior product manager. Focus on product positioning, features, user needs, and market fit. Ask probing questions and build on others ideas.", + "model_name": "gpt-4o", + "max_loops": 3, + }, + { + "agent_name": "Marketing Strategist", + "description": "Develops marketing and positioning strategy", + "system_prompt": "You are a marketing strategist. Focus on target audience, messaging, channels, and competitive positioning. Contribute marketing insights to the discussion.", + "model_name": "gpt-4o", + "max_loops": 3, + }, + { + "agent_name": "Sales Director", + "description": "Provides sales and customer perspective", + "system_prompt": "You are a sales director with small business experience. Focus on pricing, sales process, customer objections, and market adoption. Share practical sales insights.", + "model_name": "gpt-4o", + "max_loops": 3, + }, + { + "agent_name": "UX Researcher", + "description": "Represents user experience and research insights", + "system_prompt": "You are a UX researcher specializing in small business tools. Focus on user behavior, usability, adoption barriers, and design considerations.", + "model_name": "gpt-4o", + "max_loops": 3, + } + ], + "max_loops": 3 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("GroupChat swarm completed successfully!") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Chat discussion: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "job_id": "swarms-2COVtf3k0Fz7jU1BOOHF3b5nuL2x", + "status": "success", + "swarm_name": "Product Strategy Discussion", + "description": "Collaborative chat to develop product strategy", + "swarm_type": "GroupChat", + "output": "User: \n\nSystem: \n Group Chat Name: Product Strategy Discussion\nGroup Chat Description: Collaborative chat to develop product strategy\n Agents in your Group Chat: Available Agents for Team: None\n\n\n\n[Agent 1]\nName: Product Manager\nDescription: Leads product strategy and development\nRole.....", + "number_of_agents": 4, + "service_tier": "standard", + "execution_time": 47.36732482910156, + "usage": { + "input_tokens": 30, + "output_tokens": 1633, + "total_tokens": 1663, + "billing_info": { + "cost_breakdown": { + "agent_cost": 0.04, + "input_token_cost": 0.00009, + "output_token_cost": 0.024495, + "token_counts": { + "total_input_tokens": 30, + "total_output_tokens": 1633, + "total_tokens": 1663 + }, + "num_agents": 4, + "service_tier": "standard", + "night_time_discount_applied": false + }, + "total_cost": 0.064585, + "discount_active": false, + "discount_type": "none", + "discount_percentage": 0 + } + } +} +``` ## Best Practices diff --git a/docs/swarms_cloud/swarm_types.md b/docs/swarms_cloud/swarm_types.md index e28bace4..d964ce0c 100644 --- a/docs/swarms_cloud/swarm_types.md +++ b/docs/swarms_cloud/swarm_types.md @@ -8,10 +8,12 @@ Each multi-agent architecture type is designed for specific use cases and can be | MixtureOfAgents | Builds diverse teams of specialized agents, each contributing unique skills to solve complex problems. Excels at tasks requiring multiple types of expertise. | [Learn More](mixture_of_agents.md) | | SequentialWorkflow | Executes tasks in a strict, predefined order. Perfect for workflows where each step depends on the completion of the previous one. | [Learn More](sequential_workflow.md) | | ConcurrentWorkflow | Runs independent tasks in parallel, significantly reducing processing time for complex operations. Ideal for tasks that can be processed simultaneously. | [Learn More](concurrent_workflow.md) | +| GroupChat | Enables dynamic collaboration between agents through a chat-based interface, facilitating real-time information sharing and decision-making. | [Learn More](group_chat.md) | | MultiAgentRouter | Acts as an intelligent task dispatcher, distributing work across agents based on their capabilities and current workload. | [Learn More](multi_agent_router.md) | | MajorityVoting | Implements robust decision-making through consensus, ideal for tasks requiring collective intelligence or verification. | [Learn More](majority_voting.md) | + - + From cf7357fd8e2eb4e15d7a683c445fe5bd67ea4f51 Mon Sep 17 00:00:00 2001 From: harshalmore31 Date: Fri, 1 Aug 2025 23:14:53 +0530 Subject: [PATCH 6/6] fixed HiearchicalSwarm & cleanups ! --- docs/mkdocs.yml | 6 +- docs/swarms_cloud/hierarchical_swarm.md | 212 +++++++++++++++++++++++- docs/swarms_cloud/malt.md | 40 ----- docs/swarms_cloud/spreadsheet_swarm.md | 41 ----- docs/swarms_cloud/swarm_types.md | 5 +- 5 files changed, 213 insertions(+), 91 deletions(-) delete mode 100644 docs/swarms_cloud/malt.md delete mode 100644 docs/swarms_cloud/spreadsheet_swarm.md diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 729dd70c..0fad0e31 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -449,16 +449,14 @@ nav: - Swarm Types: - AgentRearrange: "swarms_cloud/agent_rearrange.md" - MixtureOfAgents: "swarms_cloud/mixture_of_agents.md" - # - SpreadSheetSwarm: "swarms_cloud/spreadsheet_swarm.md" - SequentialWorkflow: "swarms_cloud/sequential_workflow.md" - ConcurrentWorkflow: "swarms_cloud/concurrent_workflow.md" - GroupChat: "swarms_cloud/group_chat.md" - MultiAgentRouter: "swarms_cloud/multi_agent_router.md" + - HierarchicalSwarm: "swarms_cloud/hierarchical_swarm.md" + - MajorityVoting: "swarms_cloud/majority_voting.md" # - AutoSwarmBuilder: "swarms_cloud/auto_swarm_builder.md" - # - HierarchicalSwarm: "swarms_cloud/hierarchical_swarm.md" # - Auto: "swarms_cloud/auto.md" - - MajorityVoting: "swarms_cloud/majority_voting.md" - # - MALT: "swarms_cloud/malt.md" - Examples: - Medical Swarm: "swarms/examples/swarms_api_medical.md" - Finance Swarm: "swarms/examples/swarms_api_finance.md" diff --git a/docs/swarms_cloud/hierarchical_swarm.md b/docs/swarms_cloud/hierarchical_swarm.md index f65c7a46..70c8792e 100644 --- a/docs/swarms_cloud/hierarchical_swarm.md +++ b/docs/swarms_cloud/hierarchical_swarm.md @@ -1,12 +1,12 @@ -# HierarchicalSwarm +# HiearchicalSwarm *Implements structured, multi-level task management with clear authority* -**Swarm Type**: `HierarchicalSwarm` +**Swarm Type**: `HiearchicalSwarm` ## Overview -The HierarchicalSwarm implements a structured, multi-level approach to task management with clear lines of authority and delegation. This architecture organizes agents in a hierarchical structure where manager agents coordinate and oversee worker agents, enabling efficient task distribution and quality control. +The HiearchicalSwarm implements a structured, multi-level approach to task management with clear lines of authority and delegation. This architecture organizes agents in a hierarchical structure where manager agents coordinate and oversee worker agents, enabling efficient task distribution and quality control. Key features: - **Structured Hierarchy**: Clear organizational structure with managers and workers @@ -23,6 +23,212 @@ Key features: ## API Usage +### Basic HiearchicalSwarm Example + +=== "Shell (curl)" + ```bash + curl -X POST "https://api.swarms.world/v1/swarm/completions" \ + -H "x-api-key: $SWARMS_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "name": "Market Research ", + "description": "Parallel market research across different sectors", + "swarm_type": "HiearchicalSwarm", + "task": "Research and analyze market opportunities in AI, healthcare, fintech, and e-commerce sectors", + "agents": [ + { + "agent_name": "AI Market Analyst", + "description": "Analyzes AI market trends and opportunities", + "system_prompt": "You are an AI market analyst. Focus on artificial intelligence market trends, opportunities, key players, and growth projections.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Healthcare Market Analyst", + "description": "Analyzes healthcare market trends", + "system_prompt": "You are a healthcare market analyst. Focus on healthcare market trends, digital health opportunities, regulatory landscape, and growth areas.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Fintech Market Analyst", + "description": "Analyzes fintech market opportunities", + "system_prompt": "You are a fintech market analyst. Focus on financial technology trends, digital payment systems, blockchain opportunities, and regulatory developments.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "E-commerce Market Analyst", + "description": "Analyzes e-commerce market trends", + "system_prompt": "You are an e-commerce market analyst. Focus on online retail trends, marketplace opportunities, consumer behavior, and emerging platforms.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + } + ], + "max_loops": 1 + }' + ``` + +=== "Python (requests)" + ```python + import requests + import json + + API_BASE_URL = "https://api.swarms.world" + API_KEY = "your_api_key_here" + + headers = { + "x-api-key": API_KEY, + "Content-Type": "application/json" + } + + swarm_config = { + "name": "Market Research ", + "description": "Parallel market research across different sectors", + "swarm_type": "HiearchicalSwarm", + "task": "Research and analyze market opportunities in AI, healthcare, fintech, and e-commerce sectors", + "agents": [ + { + "agent_name": "AI Market Analyst", + "description": "Analyzes AI market trends and opportunities", + "system_prompt": "You are an AI market analyst. Focus on artificial intelligence market trends, opportunities, key players, and growth projections.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Healthcare Market Analyst", + "description": "Analyzes healthcare market trends", + "system_prompt": "You are a healthcare market analyst. Focus on healthcare market trends, digital health opportunities, regulatory landscape, and growth areas.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "Fintech Market Analyst", + "description": "Analyzes fintech market opportunities", + "system_prompt": "You are a fintech market analyst. Focus on financial technology trends, digital payment systems, blockchain opportunities, and regulatory developments.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + }, + { + "agent_name": "E-commerce Market Analyst", + "description": "Analyzes e-commerce market trends", + "system_prompt": "You are an e-commerce market analyst. Focus on online retail trends, marketplace opportunities, consumer behavior, and emerging platforms.", + "model_name": "gpt-4o", + "max_loops": 1, + "temperature": 0.3 + } + ], + "max_loops": 1 + } + + response = requests.post( + f"{API_BASE_URL}/v1/swarm/completions", + headers=headers, + json=swarm_config + ) + + if response.status_code == 200: + result = response.json() + print("HiearchicalSwarm completed successfully!") + print(f"Cost: ${result['metadata']['billing_info']['total_cost']}") + print(f"Execution time: {result['metadata']['execution_time_seconds']} seconds") + print(f"Project plan: {result['output']}") + else: + print(f"Error: {response.status_code} - {response.text}") + ``` + +**Example Response**: +```json +{ + "job_id": "swarms-JIrcIAfs2d75xrXGaAL94uWyYJ8V", + "status": "success", + "swarm_name": "Market Research Auto", + "description": "Parallel market research across different sectors", + "swarm_type": "HiearchicalSwarm", + "output": [ + { + "role": "System", + "content": "These are the agents in your team. Each agent has a specific role and expertise to contribute to the team's objectives.\nTotal Agents: 4\n\nBelow is a summary of your team members and their primary responsibilities:\n| Agent Name | Description |\n|------------|-------------|\n| AI Market Analyst | Analyzes AI market trends and opportunities |\n| Healthcare Market Analyst | Analyzes healthcare market trends |\n| Fintech Market Analyst | Analyzes fintech market opportunities |\n| E-commerce Market Analyst | Analyzes e-commerce market trends |\n\nEach agent is designed to handle tasks within their area of expertise. Collaborate effectively by assigning tasks according to these roles." + }, + { + "role": "Director", + "content": [ + { + "role": "Director", + "content": [ + { + "function": { + "arguments": "{\"plan\":\"Conduct a comprehensive analysis of market opportunities in the AI, healthcare, fintech, and e-commerce sectors. Each market analyst will focus on their respective sector, gathering data on current trends, growth opportunities, and potential challenges. The findings will be compiled into a report for strategic decision-making.\",\"orders\":[{\"agent_name\":\"AI Market Analyst\",\"task\":\"Research current trends in the AI market, identify growth opportunities, and analyze potential challenges.\"},{\"agent_name\":\"Healthcare Market Analyst\",\"task\":\"Analyze the healthcare market for emerging trends, growth opportunities, and possible challenges.\"},{\"agent_name\":\"Fintech Market Analyst\",\"task\":\"Investigate the fintech sector for current trends, identify opportunities for growth, and assess challenges.\"},{\"agent_name\":\"E-commerce Market Analyst\",\"task\":\"Examine e-commerce market trends, identify growth opportunities, and analyze potential challenges.\"}]}", + "name": "ModelMetaclass" + }, + "id": "call_GxiyzIRb2oGQXokbbkeaeVry", + "type": "function" + } + ] + } + ] + }, + { + "role": "AI Market Analyst", + "content": "### AI Market Analysis: Trends, Opportunities, and Challenges\n\n#### Current Trends in the AI Market:\n\n1. **Increased Adoption Across Industries**..." + }, + { + "role": "Healthcare Market Analyst", + "content": "### Healthcare Market Analysis: Trends, Opportunities, and Challenges\n\n#### Current Trends in the Healthcare Market:\n\n1. **Telehealth Expansion**..." + }, + { + "role": "Fintech Market Analyst", + "content": "### Fintech Market Analysis: Trends, Opportunities, and Challenges\n\n#### Current Trends in the Fintech Market:\n\n1. **Digital Payments Proliferation**...." + }, + { + "role": "E-commerce Market Analyst", + "content": "### E-commerce Market Analysis: Trends, Opportunities, and Challenges\n\n#### Current Trends in the E-commerce Market:\n\n1. **Omnichannel Retailing**...." + }, + { + "role": "Director", + "content": "### Feedback for Worker Agents\n\n#### AI Market Analyst\n\n**Strengths:**\n- Comprehensive coverage of current trends, growth opportunities, and challenges in the AI market.\n- Clear categorization of insights, making it easy to follow and understand.\n\n**Weaknesses....." + }, + { + "role": "System", + "content": "--- Loop 1/1 completed ---" + } + ], + "number_of_agents": 4, + "service_tier": "standard", + "execution_time": 94.07934331893921, + "usage": { + "input_tokens": 35, + "output_tokens": 3827, + "total_tokens": 3862, + "billing_info": { + "cost_breakdown": { + "agent_cost": 0.04, + "input_token_cost": 0.000105, + "output_token_cost": 0.057405, + "token_counts": { + "total_input_tokens": 35, + "total_output_tokens": 3827, + "total_tokens": 3862 + }, + "num_agents": 4, + "service_tier": "standard", + "night_time_discount_applied": false + }, + "total_cost": 0.09751, + "discount_active": false, + "discount_type": "none", + "discount_percentage": 0 + } + } +} +``` ## Configuration Options diff --git a/docs/swarms_cloud/malt.md b/docs/swarms_cloud/malt.md deleted file mode 100644 index 3247e854..00000000 --- a/docs/swarms_cloud/malt.md +++ /dev/null @@ -1,40 +0,0 @@ -# MALT - -*Specialized framework for complex language-based tasks and processing* - -**Swarm Type**: `MALT` - -## Overview - -MALT (Multi-Agent Language Task) is a specialized framework optimized for complex language-based tasks, optimizing agent collaboration for sophisticated language processing operations. This architecture excels at tasks requiring deep linguistic analysis, natural language understanding, and complex text generation workflows. - -Key features: -- **Language Optimization**: Specifically designed for natural language tasks -- **Linguistic Collaboration**: Agents work together on complex language operations -- **Text Processing Pipeline**: Structured approach to language task workflows -- **Advanced NLP**: Optimized for sophisticated language understanding tasks - -## Use Cases - -- Complex document analysis and processing -- Multi-language translation and localization -- Advanced content generation and editing -- Linguistic research and analysis tasks - -## API Usage - - -``` - -## Best Practices - -- Use MALT for sophisticated language processing tasks -- Design agents with complementary linguistic analysis capabilities -- Ideal for tasks requiring deep language understanding -- Consider multiple levels of linguistic analysis (syntax, semantics, pragmatics) - -## Related Swarm Types - -- [SequentialWorkflow](sequential_workflow.md) - For ordered language processing -- [MixtureOfAgents](mixture_of_agents.md) - For diverse linguistic expertise -- [HierarchicalSwarm](hierarchical_swarm.md) - For structured language analysis \ No newline at end of file diff --git a/docs/swarms_cloud/spreadsheet_swarm.md b/docs/swarms_cloud/spreadsheet_swarm.md deleted file mode 100644 index 47beafaf..00000000 --- a/docs/swarms_cloud/spreadsheet_swarm.md +++ /dev/null @@ -1,41 +0,0 @@ -# SpreadSheetSwarm - -*Structured approach to data management and operations in spreadsheet-like format* - -**Swarm Type**: `SpreadSheetSwarm` - -## Overview - -The SpreadSheetSwarm provides a structured approach to data management and operations, ideal for tasks involving data analysis, transformation, and systematic processing in a spreadsheet-like structure. This architecture organizes agents to work on data in a tabular format with clear rows, columns, and processing workflows. - -Key features: -- **Structured Data Processing**: Organizes work in spreadsheet-like rows and columns -- **Systematic Operations**: Sequential and methodical data handling -- **Data Transformation**: Efficient processing of structured datasets -- **Collaborative Analysis**: Multiple agents working on different data aspects - -## Use Cases - -- Financial data analysis and reporting -- Customer data processing and segmentation -- Inventory management and tracking -- Research data compilation and analysis - -## API Usage - -### Basic SpreadSheetSwarm Example - - - -## Best Practices - -- Structure data in clear, logical formats before processing -- Use systematic, step-by-step analysis approaches -- Ideal for quantitative analysis and reporting tasks -- Ensure data validation before proceeding with analysis - -## Related Swarm Types - -- [SequentialWorkflow](sequential_workflow.md) - For ordered data processing -- [ConcurrentWorkflow](concurrent_workflow.md) - For parallel data analysis -- [HierarchicalSwarm](hierarchical_swarm.md) - For complex data projects \ No newline at end of file diff --git a/docs/swarms_cloud/swarm_types.md b/docs/swarms_cloud/swarm_types.md index d964ce0c..5773237b 100644 --- a/docs/swarms_cloud/swarm_types.md +++ b/docs/swarms_cloud/swarm_types.md @@ -9,15 +9,14 @@ Each multi-agent architecture type is designed for specific use cases and can be | SequentialWorkflow | Executes tasks in a strict, predefined order. Perfect for workflows where each step depends on the completion of the previous one. | [Learn More](sequential_workflow.md) | | ConcurrentWorkflow | Runs independent tasks in parallel, significantly reducing processing time for complex operations. Ideal for tasks that can be processed simultaneously. | [Learn More](concurrent_workflow.md) | | GroupChat | Enables dynamic collaboration between agents through a chat-based interface, facilitating real-time information sharing and decision-making. | [Learn More](group_chat.md) | +| HierarchicalSwarm | Implements a structured, multi-level approach to task management, with clear lines of authority and delegation. | [Learn More](hierarchical_swarm.md) | | MultiAgentRouter | Acts as an intelligent task dispatcher, distributing work across agents based on their capabilities and current workload. | [Learn More](multi_agent_router.md) | | MajorityVoting | Implements robust decision-making through consensus, ideal for tasks requiring collective intelligence or verification. | [Learn More](majority_voting.md) | - - + # Learn More