You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/examples/new_spreadsheet_swarm_examples/financial_analysis/swarm_csv.py

35 lines
890 B

import os
from swarms import SpreadSheetSwarm
# Create the swarm
swarm = SpreadSheetSwarm(
name="Financial-Analysis-Swarm",
description="A swarm of agents performing concurrent financial analysis tasks",
max_loops=1,
workspace_dir="./workspace",
load_path="swarm.csv",
)
try:
# Ensure workspace directory exists
os.makedirs("./workspace", exist_ok=True)
# Load the financial analysts from CSV
swarm.load_from_csv()
print(f"Loaded {len(swarm.agents)} financial analysis agents")
print("\nStarting concurrent financial analysis tasks...")
# Run all agents concurrently with their configured tasks
results = swarm.run()
print(
"\nAnalysis complete! Results saved to:", swarm.save_file_path
)
print("\nSwarm execution metadata:")
print(results)
except Exception as e:
print(f"An error occurred: {str(e)}")