diff --git a/api/main.py b/api/main.py index 6b73a940f..b210a29cd 100644 --- a/api/main.py +++ b/api/main.py @@ -29,8 +29,6 @@ from swarms.structs.agent import Agent -# Original API, drafting OpenTelemetry Integrations in this directory - # Load environment variables load_dotenv() diff --git a/api/skypilot.yaml b/api/skypilot.yaml index 5e1026c4a..d0c558ec8 100644 --- a/api/skypilot.yaml +++ b/api/skypilot.yaml @@ -1,3 +1,5 @@ +name: agentapi + service: readiness_probe: path: /docs @@ -11,14 +13,19 @@ service: upscale_delay_seconds: 180 downscale_delay_seconds: 600 + +envs: + WORKSPACE_DIR: "agent_workspace" + OPENAI_API_KEY: "" + resources: ports: 8000 # FastAPI default port cpus: 16 memory: 64 - disk_size: 100 + disk_size: 50 use_spot: true -workdir: /app +workdir: . setup: | git clone https://github.com/kyegomez/swarms.git @@ -27,7 +34,6 @@ setup: | pip install swarms run: | - cd swarms/api uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4 # env: diff --git a/api/tests.py b/api/tests.py index 06490f129..89d17dd51 100644 --- a/api/tests.py +++ b/api/tests.py @@ -1,12 +1,11 @@ import asyncio import json -import uuid -from datetime import datetime -import aiohttp +import os import sys -from typing import Dict, Any, Optional +from typing import Any, Dict + +import aiohttp from loguru import logger -import os # Configure loguru LOG_PATH = "api_tests.log" @@ -17,7 +16,7 @@ level="DEBUG" ) -BASE_URL = "https://dev.api.swarms.ai/v1" # Change this to match your server URL +BASE_URL = "https://api.swarms.ai/v1" # Change this to match your server URL async def log_request_details(method: str, url: str, headers: dict, data: Any = None): """Log request details before sending.""" @@ -249,7 +248,7 @@ def main(): asyncio.run(run_tests()) except KeyboardInterrupt: logger.warning("Test execution interrupted by user.") - except Exception as e: + except Exception: logger.exception("Fatal error in test execution:") finally: logger.info("Test suite shutdown complete.") diff --git a/docs/swarms/structs/group_chat.md b/docs/swarms/structs/group_chat.md index 4bd1a04ad..ffd632afb 100644 --- a/docs/swarms/structs/group_chat.md +++ b/docs/swarms/structs/group_chat.md @@ -29,7 +29,7 @@ A production-grade multi-agent system enabling sophisticated group conversations | description | str | "" | Purpose description | | agents | List[Agent] | [] | Participating agents | | speaker_fn | Callable | round_robin | Speaker selection function | -| max_turns | int | 10 | Maximum conversation turns | +| max_loops | int | 10 | Maximum conversation turns | ## Table of Contents @@ -272,7 +272,7 @@ analysis_team = GroupChat( description="Comprehensive market analysis group", agents=[data_analyst, market_expert, strategy_advisor], speaker_fn=expertise_based, - max_turns=15 + max_loops=15 ) # Run complex analysis diff --git a/new_features_examples/concurrent_mix.py b/new_features_examples/concurrent_examples/concurrent_mix.py similarity index 100% rename from new_features_examples/concurrent_mix.py rename to new_features_examples/concurrent_examples/concurrent_mix.py diff --git a/crypto_tax_swarm.py b/new_features_examples/groupchat_examples/crypto_tax_swarm.py similarity index 100% rename from crypto_tax_swarm.py rename to new_features_examples/groupchat_examples/crypto_tax_swarm.py diff --git a/new_features_examples/health_privacy_swarm.py b/new_features_examples/medical_analysis/health_privacy_swarm.py similarity index 100% rename from new_features_examples/health_privacy_swarm.py rename to new_features_examples/medical_analysis/health_privacy_swarm.py diff --git a/new_features_examples/health_privacy_swarm_two.py b/new_features_examples/medical_analysis/health_privacy_swarm_two.py similarity index 100% rename from new_features_examples/health_privacy_swarm_two.py rename to new_features_examples/medical_analysis/health_privacy_swarm_two.py diff --git a/new_features_examples/multi_tool_usage_agent.py b/new_features_examples/multi_tool_usage_agent.py index 1af421e25..c51596ad8 100644 --- a/new_features_examples/multi_tool_usage_agent.py +++ b/new_features_examples/multi_tool_usage_agent.py @@ -111,6 +111,9 @@ class ExecutionContext: history: List[Dict[str, Any]] = field(default_factory=list) +def func(): + pass + hints = get_type_hints(func) diff --git a/new_features_examples/sequential_worflow_test.py b/new_features_examples/sequential_workflow/sequential_worflow_test.py similarity index 100% rename from new_features_examples/sequential_worflow_test.py rename to new_features_examples/sequential_workflow/sequential_worflow_test.py diff --git a/new_features_examples/sequential_workflow.py b/new_features_examples/sequential_workflow/sequential_workflow.py similarity index 100% rename from new_features_examples/sequential_workflow.py rename to new_features_examples/sequential_workflow/sequential_workflow.py diff --git a/swarm_arange_demo.py b/new_features_examples/swarmarrange/swarm_arange_demo.py similarity index 100% rename from swarm_arange_demo.py rename to new_features_examples/swarmarrange/swarm_arange_demo.py diff --git a/swarms/structs/async_workflow.py b/swarms/structs/async_workflow.py index e10ad6a53..f42681cfd 100644 --- a/swarms/structs/async_workflow.py +++ b/swarms/structs/async_workflow.py @@ -63,7 +63,7 @@ class SpeakerMessage(BaseModel): class GroupChatConfig(BaseModel): - max_turns: int = 10 + max_loops: int = 10 timeout_per_turn: float = 30.0 require_all_speakers: bool = False allow_concurrent: bool = True @@ -309,7 +309,7 @@ async def run_group_chat( messages: List[SpeakerMessage] = [] current_turn = 0 - while current_turn < self.group_chat_config.max_turns: + while current_turn < self.group_chat_config.max_loops: turn_context = { "turn": current_turn, "history": messages, @@ -627,7 +627,7 @@ def create_default_workflow( verbose=True, enable_group_chat=enable_group_chat, group_chat_config=GroupChatConfig( - max_turns=5, + max_loops=5, allow_concurrent=True, require_all_speakers=False, ), diff --git a/swarms/structs/groupchat.py b/swarms/structs/groupchat.py index bac48e726..7428461b0 100644 --- a/swarms/structs/groupchat.py +++ b/swarms/structs/groupchat.py @@ -123,7 +123,7 @@ def __init__( description: str = "A group chat for multiple agents", agents: List[Agent] = [], speaker_fn: SpeakerFunction = round_robin, - max_turns: int = 10, + max_loops: int = 10, ): """ Initialize the GroupChat. @@ -133,13 +133,13 @@ def __init__( description (str): Description of the purpose of the group chat. agents (List[Agent]): A list of agents participating in the chat. speaker_fn (SpeakerFunction): The function to determine which agent should speak next. - max_turns (int): Maximum number of turns in the chat. + max_loops (int): Maximum number of turns in the chat. """ self.name = name self.description = description self.agents = agents self.speaker_fn = speaker_fn - self.max_turns = max_turns + self.max_loops = max_loops self.chat_history = ChatHistory( turns=[], total_messages=0, @@ -237,7 +237,7 @@ def run(self, task: str) -> ChatHistory: f"Starting chat '{self.name}' with task: {task}" ) - for turn in range(self.max_turns): + for turn in range(self.max_loops): current_turn = ChatTurn( turn_number=turn, responses=[], task=task ) diff --git a/test_agentrearrange.py b/tests/structs/test_agentrearrange.py similarity index 100% rename from test_agentrearrange.py rename to tests/structs/test_agentrearrange.py diff --git a/tests/structs/test_groupchat.py b/tests/structs/test_groupchat.py index 22cf1ef4b..08bceec58 100644 --- a/tests/structs/test_groupchat.py +++ b/tests/structs/test_groupchat.py @@ -63,12 +63,12 @@ def test_expertise_based_speaking(): assert first_response.agent_name == agent.agent_name -def test_max_turns_limit(): - max_turns = 3 - chat = GroupChat(agents=setup_test_agents(), max_turns=max_turns) +def test_max_loops_limit(): + max_loops = 3 + chat = GroupChat(agents=setup_test_agents(), max_loops=max_loops) history = chat.run("Test message") - assert len(history.turns) == max_turns + assert len(history.turns) == max_loops def test_error_handling(): @@ -106,7 +106,7 @@ def test_large_agent_group(): def test_long_conversations(): - chat = GroupChat(agents=setup_test_agents(), max_turns=50) + chat = GroupChat(agents=setup_test_agents(), max_loops=50) history = chat.run("Long conversation test") assert len(history.turns) == 50 @@ -130,7 +130,7 @@ def test_stress_batched_runs(): test_round_robin_speaking, test_concurrent_processing, test_expertise_based_speaking, - test_max_turns_limit, + test_max_loops_limit, test_error_handling, test_conversation_context, test_large_agent_group,