generated from The-Swarm-Corporation/Swarms-Example-1-Click-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Import the AgentRearrange class for coordinating multiple agents | ||
from swarms import AgentRearrange | ||
|
||
# Import specialized medical agents for different aspects of patient care | ||
from multi_agent_rag.agents import ( | ||
diagnostic_specialist, # Agent for diagnostic analysis | ||
medical_data_extractor, # Agent for extracting medical data | ||
patient_care_coordinator, # Agent for coordinating patient care | ||
specialist_consultant, # Agent for specialist consultation | ||
treatment_planner, # Agent for treatment planning | ||
) | ||
|
||
# Import database class for storing and retrieving medical documents | ||
from multi_agent_rag.pinecone_wrapper import PineconeManager | ||
|
||
# Initialize the SwarmRouter to coordinate the medical agents | ||
router = AgentRearrange( | ||
name="medical-diagnosis-treatment-swarm", | ||
description="Collaborative medical team for comprehensive patient diagnosis and treatment planning", | ||
max_loops=1, # Limit to one iteration through the agent flow | ||
agents=[ | ||
medical_data_extractor, # First agent to extract medical data | ||
diagnostic_specialist, # Second agent to analyze and diagnose | ||
treatment_planner, # Third agent to plan treatment | ||
specialist_consultant, # Fourth agent to provide specialist input | ||
patient_care_coordinator, # Final agent to coordinate care plan | ||
], | ||
# Configure the document storage and retrieval system | ||
memory_system=PineconeManager(api_key="", index_name="", environment="") | ||
# Define the sequential flow of information between agents | ||
flow=f"{medical_data_extractor.agent_name} -> {diagnostic_specialist.agent_name} -> {treatment_planner.agent_name} -> {specialist_consultant.agent_name} -> {patient_care_coordinator.agent_name}", | ||
) | ||
|
||
# Example usage | ||
if __name__ == "__main__": | ||
# Run a comprehensive medical analysis task for patient Lucas Brown | ||
router.run( | ||
"Analyze this Lucas Brown's medical data to provide a diagnosis and treatment plan" | ||
) |