From c0949d00ab8c622b38e679f8aa413c8fc603bf90 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sun, 21 Sep 2025 22:34:17 -0700 Subject: [PATCH] example readme --- examples/demos/README.md | 85 ++++++++++ examples/deployment/README.md | 18 +++ examples/guides/README.md | 39 +++++ examples/mcp/README.md | 43 +++++ examples/multi_agent/README.md | 151 ++++++++++++++++++ .../_doda_majority_voting_example_new.py | 0 .../agent_config_example.csv | 0 ...un_id_02575aa12829486c91967c24b927100b.csv | 0 ...un_id_69f4c23f5a97477ab2b8114521c33fd4.csv | 0 ...un_id_b93a2946b074493f8fa34a47377b2625.csv | 0 .../spreadsheet_swarm_usage.py | 0 ...c23f5a97477ab2b8114521c33fd4-metadata.json | 0 ...2946b074493f8fa34a47377b2625-metadata.json | 0 examples/rag/README.md | 6 + examples/reasoning_agents/README.md | 12 ++ examples/single_agent/README.md | 115 +++++++++++++ examples/swarms_api_examples/README.md | 22 +++ examples/tools/README.md | 45 ++++++ examples/ui/README.md | 6 + examples/utils/README.md | 40 +++++ examples/workshops/README.md | 15 ++ 21 files changed, 597 insertions(+) create mode 100644 examples/demos/README.md create mode 100644 examples/deployment/README.md create mode 100644 examples/guides/README.md create mode 100644 examples/mcp/README.md create mode 100644 examples/multi_agent/README.md rename majority_voting_example.py => examples/multi_agent/majority_voting/_doda_majority_voting_example_new.py (100%) rename {spreadsheet_new_examples => examples/multi_agent/new_spreadsheet_new_examples}/agent_config_example.csv (100%) rename {spreadsheet_new_examples => examples/multi_agent/new_spreadsheet_new_examples}/spreadsheet_swarm_run_id_02575aa12829486c91967c24b927100b.csv (100%) rename {spreadsheet_new_examples => examples/multi_agent/new_spreadsheet_new_examples}/spreadsheet_swarm_run_id_69f4c23f5a97477ab2b8114521c33fd4.csv (100%) rename {spreadsheet_new_examples => examples/multi_agent/new_spreadsheet_new_examples}/spreadsheet_swarm_run_id_b93a2946b074493f8fa34a47377b2625.csv (100%) rename {spreadsheet_new_examples => examples/multi_agent/new_spreadsheet_new_examples}/spreadsheet_swarm_usage.py (100%) rename {spreadsheet_new_examples => examples/multi_agent/new_spreadsheet_new_examples}/swarm_outputs/Spreedsheet-Swarm-Financial-Analysis-Swarm/Financial-Analysis-Swarm/spreedsheet-swarm-69f4c23f5a97477ab2b8114521c33fd4-metadata.json (100%) rename {spreadsheet_new_examples => examples/multi_agent/new_spreadsheet_new_examples}/swarm_outputs/Spreedsheet-Swarm-Financial-Analysis-Swarm/Financial-Analysis-Swarm/spreedsheet-swarm-b93a2946b074493f8fa34a47377b2625-metadata.json (100%) create mode 100644 examples/rag/README.md create mode 100644 examples/reasoning_agents/README.md create mode 100644 examples/single_agent/README.md create mode 100644 examples/swarms_api_examples/README.md create mode 100644 examples/tools/README.md create mode 100644 examples/ui/README.md create mode 100644 examples/utils/README.md create mode 100644 examples/workshops/README.md diff --git a/examples/demos/README.md b/examples/demos/README.md new file mode 100644 index 00000000..1fbccc7d --- /dev/null +++ b/examples/demos/README.md @@ -0,0 +1,85 @@ +# Demo Examples + +This directory contains comprehensive demonstration examples showcasing various Swarms capabilities across different domains. + +## Apps +- [smart_database_swarm.py](apps/smart_database_swarm.py) - Intelligent database management swarm + +## Charts +- [chart_swarm.py](chart_swarm.py) - Data visualization and chart generation + +## Crypto +- [dao_swarm.py](crypto/dao_swarm.py) - Decentralized Autonomous Organization swarm +- [ethchain_agent.py](crypto/ethchain_agent.py) - Ethereum blockchain agent +- [htx_swarm.py](crypto/htx_swarm.py) - HTX exchange integration +- [swarms_coin_agent.py](crypto/swarms_coin_agent.py) - Swarms coin trading agent +- [swarms_coin_multimarket.py](crypto/swarms_coin_multimarket.py) - Multi-market trading + +## CUDA +- [cuda_swarm.py](cuda_swarm.py) - GPU-accelerated swarm processing + +## Finance +- [sentiment_news_analysis.py](finance/sentiment_news_analysis.py) - Financial sentiment analysis +- [swarms_of_vllm.py](finance/swarms_of_vllm.py) - VLLM-based financial swarms + +## Hackathon Examples +- [fraud.py](hackathon_feb16/fraud.py) - Fraud detection system +- [sarasowti.py](hackathon_feb16/sarasowti.py) - Sarasowti project implementation + +## Insurance +- [insurance_swarm.py](insurance/insurance_swarm.py) - Insurance processing swarm + +## Legal +- [legal_swarm.py](legal/legal_swarm.py) - Legal document processing swarm + +## Medical +- [health_privacy_swarm.py](medical/health_privacy_swarm.py) - Health privacy compliance swarm +- [health_privacy_swarm_two.py](medical/health_privacy_swarm_two.py) - Alternative health privacy implementation +- [medical_coder_agent.py](medical/medical_coder_agent.py) - Medical coding agent +- [new_medical_rearrange.py](medical/new_medical_rearrange.py) - Medical rearrangement system +- [ollama_demo.py](medical/ollama_demo.py) - Ollama integration demo + +### Medical Analysis Reports +- [medical_analysis_agent_rearrange.md](medical/medical_analysis_agent_rearrange.md) - Analysis report +- [medical_coding_report.md](medical/medical_coding_report.md) - Coding report +- [medical_diagnosis_report.md](medical/medical_diagnosis_report.md) - Diagnosis report + +### Rearrange Video Examples +- [term_sheet_swarm.py](medical/rearrange_video_examples/term_sheet_swarm.py) - Term sheet processing +- [reports/](medical/rearrange_video_examples/reports/) - Analysis reports + +## News +- [news_aggregator_summarizer.py](news_aggregator_summarizer.py) - News aggregation and summarization + +## Privacy +- [privacy_building.py](privacy_building.py) - Privacy-focused system building + +## Real Estate +- [morgtate_swarm.py](real_estate/morgtate_swarm.py) - Mortgage processing swarm +- [real_estate_agent.py](real_estate/real_estate_agent.py) - Real estate agent +- [realtor_agent.py](real_estate/realtor_agent.py) - Realtor agent +- [README_realtor.md](real_estate/README_realtor.md) - Realtor documentation + +## Science +- [materials_science_agents.py](science/materials_science_agents.py) - Materials science research agents +- [open_scientist.py](science/open_scientist.py) - Open science research agent +- [paper_idea_agent.py](science/paper_idea_agent.py) - Research paper idea generation +- [paper_idea_profile.py](science/paper_idea_profile.py) - Paper idea profiling + +## Spike Examples +- [agent_rearrange_test.py](spike/agent_rearrange_test.py) - Agent rearrangement testing +- [function_caller_example.py](spike/function_caller_example.py) - Function calling example +- [memory.py](spike/memory.py) - Memory management +- [test.py](spike/test.py) - Testing utilities +- [spike.zip](spike/spike.zip) - Spike examples archive + +## Synthetic Data +- [profession_sim/](synthetic_data/profession_sim/) - Professional persona simulation + - [convert_json_to_csv.py](synthetic_data/profession_sim/convert_json_to_csv.py) - Data format conversion + - [data.csv](synthetic_data/profession_sim/data.csv) - Sample data + - [format_prompt.py](synthetic_data/profession_sim/format_prompt.py) - Prompt formatting + - [profession_persona_generator.py](synthetic_data/profession_sim/profession_persona_generator.py) - Persona generation + - Various CSV and JSON files with generated personas and progress tracking + +## Additional Files +- [agent_with_fluidapi.py](agent_with_fluidapi.py) - FluidAPI integration example diff --git a/examples/deployment/README.md b/examples/deployment/README.md new file mode 100644 index 00000000..60f44a7e --- /dev/null +++ b/examples/deployment/README.md @@ -0,0 +1,18 @@ +# Deployment Examples + +This directory contains examples demonstrating various deployment strategies and patterns for Swarms applications. + +## Cron Job Examples +- [callback_cron_example.py](cron_job_examples/callback_cron_example.py) - Callback-based cron jobs +- [cron_job_example.py](cron_job_examples/cron_job_example.py) - Basic cron job implementation +- [cron_job_figma_stock_swarms_tools_example.py](cron_job_examples/cron_job_figma_stock_swarms_tools_example.py) - Figma stock tools cron job +- [crypto_concurrent_cron_example.py](cron_job_examples/crypto_concurrent_cron_example.py) - Concurrent crypto cron job +- [figma_stock_example.py](cron_job_examples/figma_stock_example.py) - Figma stock example +- [simple_callback_example.py](cron_job_examples/simple_callback_example.py) - Simple callback example +- [simple_concurrent_crypto_cron.py](cron_job_examples/simple_concurrent_crypto_cron.py) - Simple concurrent crypto cron +- [solana_price_tracker.py](cron_job_examples/solana_price_tracker.py) - Solana price tracking cron job + +## FastAPI +- [fastapi_agent_api_example.py](fastapi/fastapi_agent_api_example.py) - FastAPI agent API implementation +- [README.md](fastapi/README.md) - FastAPI documentation +- [requirements.txt](fastapi/requirements.txt) - FastAPI dependencies diff --git a/examples/guides/README.md b/examples/guides/README.md new file mode 100644 index 00000000..a01158c1 --- /dev/null +++ b/examples/guides/README.md @@ -0,0 +1,39 @@ +# Guides + +This directory contains comprehensive guides and tutorials for using Swarms effectively. + +## Generation Length Blog +- [longform_generator.py](generation_length_blog/longform_generator.py) - Long-form content generation +- [universal_api.py](generation_length_blog/universal_api.py) - Universal API implementation + +## Geo Guesser Agent +- [geo_guesser_agent.py](geo_guesser_agent/geo_guesser_agent.py) - Geographic location guessing agent +- [miami.jpg](geo_guesser_agent/miami.jpg) - Sample Miami image +- [README.md](geo_guesser_agent/README.md) - Geo guesser documentation + +## Graph Workflow Guide +- [comprehensive_demo.py](graphworkflow_guide/comprehensive_demo.py) - Comprehensive graph workflow demo +- [GETTING_STARTED.md](graphworkflow_guide/GETTING_STARTED.md) - Getting started guide +- [graph_workflow_technical_guide.md](graphworkflow_guide/graph_workflow_technical_guide.md) - Technical documentation +- [quick_start_guide.py](graphworkflow_guide/quick_start_guide.py) - Quick start implementation +- [README.md](graphworkflow_guide/README.md) - Main documentation +- [setup_and_test.py](graphworkflow_guide/setup_and_test.py) - Setup and testing utilities + +## Hierarchical Marketing Team +- [hiearchical_marketing_team.py](hiearchical_marketing_team.py) - Marketing team hierarchy example + +## Nano Banana Jarvis Agent +- [img_gen_nano_banana.py](nano_banana_jarvis_agent/img_gen_nano_banana.py) - Image generation with Nano Banana +- [jarvis_agent.py](nano_banana_jarvis_agent/jarvis_agent.py) - Jarvis AI assistant implementation +- [image.jpg](nano_banana_jarvis_agent/image.jpg) - Sample image +- [building.jpg](nano_banana_jarvis_agent/building.jpg) - Building image +- [hk.jpg](nano_banana_jarvis_agent/hk.jpg) - Hong Kong image +- [miami.jpg](nano_banana_jarvis_agent/miami.jpg) - Miami image +- [annotated_images/](nano_banana_jarvis_agent/annotated_images/) - Collection of annotated images for training/testing + +## Smart Database +- [README.md](smart_database/README.md) - Smart database documentation + +## Web Scraper Agents +- [batched_scraper_agent.py](web_scraper_agents/batched_scraper_agent.py) - Batch web scraping agent +- [web_scraper_agent.py](web_scraper_agents/web_scraper_agent.py) - Basic web scraping agent diff --git a/examples/mcp/README.md b/examples/mcp/README.md new file mode 100644 index 00000000..d6737c02 --- /dev/null +++ b/examples/mcp/README.md @@ -0,0 +1,43 @@ +# MCP (Model Context Protocol) Examples + +This directory contains examples demonstrating MCP integration and usage patterns in Swarms. + +## Agent Examples +- [agent_mcp_old.py](agent_examples/agent_mcp_old.py) - Legacy MCP agent implementation +- [agent_multi_mcp_connections.py](agent_examples/agent_multi_mcp_connections.py) - Multi-connection MCP agent +- [agent_tools_dict_example.py](agent_examples/agent_tools_dict_example.py) - Agent tools dictionary example +- [mcp_exampler.py](agent_examples/mcp_exampler.py) - MCP example implementation + +## MCP Agent Tool +- [mcp_agent_tool.py](mcp_agent_tool.py) - Core MCP agent tool implementation + +## MCP Utils +- [client.py](mcp_utils/client.py) - MCP client implementation +- [mcp_client_call.py](mcp_utils/mcp_client_call.py) - Client call examples +- [mcp_multiple_servers_example.py](mcp_utils/mcp_multiple_servers_example.py) - Multiple server connections +- [multiagent_client.py](mcp_utils/multiagent_client.py) - Multi-agent client +- [singleagent_client.py](mcp_utils/singleagent_client.py) - Single agent client +- [test_multiple_mcp_servers.py](mcp_utils/test_multiple_mcp_servers.py) - Multi-server testing + +### Utils Subdirectory +- [find_tools_on_mcp.py](mcp_utils/utils/find_tools_on_mcp.py) - Tool discovery on MCP +- [mcp_execute_example.py](mcp_utils/utils/mcp_execute_example.py) - MCP execution examples +- [mcp_load_tools_example.py](mcp_utils/utils/mcp_load_tools_example.py) - Tool loading examples +- [mcp_multiserver_tool_fetch.py](mcp_utils/utils/mcp_multiserver_tool_fetch.py) - Multi-server tool fetching + +## Multi-MCP Examples +- [multi_mcp_example.py](multi_mcp_example.py) - Multi-MCP integration example + +## Multi-MCP Guide +- [agent_mcp.py](multi_mcp_guide/agent_mcp.py) - MCP agent implementation +- [mcp_agent_tool.py](multi_mcp_guide/mcp_agent_tool.py) - MCP agent tool +- [okx_crypto_server.py](multi_mcp_guide/okx_crypto_server.py) - OKX crypto server integration + +## Servers +- [mcp_agent_tool.py](servers/mcp_agent_tool.py) - Server-side MCP agent tool +- [mcp_test.py](servers/mcp_test.py) - MCP server testing +- [okx_crypto_server.py](servers/okx_crypto_server.py) - OKX crypto server +- [test.py](servers/test.py) - Server testing utilities + +## Utilities +- [utils.py](utils.py) - General MCP utilities diff --git a/examples/multi_agent/README.md b/examples/multi_agent/README.md new file mode 100644 index 00000000..53fcc202 --- /dev/null +++ b/examples/multi_agent/README.md @@ -0,0 +1,151 @@ +# Multi-Agent Examples + +This directory contains comprehensive examples demonstrating various multi-agent patterns and workflows in Swarms. + +## Agent Rearrangement +- [rearrange_test.py](agent_rearrange_examples/rearrange_test.py) - Test agent rearrangement functionality + +## Auto Swarm Builder (ASB) +- [agents_builder.py](asb/agents_builder.py) - Core agent builder functionality +- [asb_research.py](asb/asb_research.py) - Research-focused ASB implementation +- [auto_agent.py](asb/auto_agent.py) - Automated agent creation +- [auto_swarm_builder_example.py](asb/auto_swarm_builder_example.py) - Complete ASB example +- [auto_swarm_builder_test.py](asb/auto_swarm_builder_test.py) - ASB testing suite +- [auto_swarm_router.py](asb/auto_swarm_router.py) - Router for auto-generated swarms +- [content_creation_asb.py](asb/content_creation_asb.py) - Content creation with ASB + +## Batched Grid Workflow +- [batched_grid_advanced_example.py](batched_grid_workflow/batched_grid_advanced_example.py) - Advanced batched grid workflow +- [batched_grid_simple_example.py](batched_grid_workflow/batched_grid_simple_example.py) - Simple batched grid example +- [batched_grid_swarm_router.py](batched_grid_workflow/batched_grid_swarm_router.py) - Router for batched grid swarms +- [batched_grid_workflow_example.py](batched_grid_workflow/batched_grid_workflow_example.py) - Complete workflow example +- [README.md](batched_grid_workflow/README.md) - Detailed documentation + +## Board of Directors +- [board_of_directors_example.py](board_of_directors/board_of_directors_example.py) - Full board simulation +- [minimal_board_example.py](board_of_directors/minimal_board_example.py) - Minimal board setup +- [simple_board_example.py](board_of_directors/simple_board_example.py) - Simple board example + +## Caching Examples +- [example_multi_agent_caching.py](caching_examples/example_multi_agent_caching.py) - Multi-agent caching implementation +- [quick_start_agent_caching.py](caching_examples/quick_start_agent_caching.py) - Quick start guide for caching +- [test_simple_agent_caching.py](caching_examples/test_simple_agent_caching.py) - Simple caching tests + +## Concurrent Examples +- [asi.py](concurrent_examples/asi.py) - ASI (Artificial Super Intelligence) example +- [concurrent_example_dashboard.py](concurrent_examples/concurrent_example_dashboard.py) - Dashboard for concurrent workflows +- [concurrent_example.py](concurrent_examples/concurrent_example.py) - Basic concurrent execution +- [concurrent_mix.py](concurrent_examples/concurrent_mix.py) - Mixed concurrent patterns +- [concurrent_swarm_example.py](concurrent_examples/concurrent_swarm_example.py) - Concurrent swarm execution +- [streaming_concurrent_workflow.py](concurrent_examples/streaming_concurrent_workflow.py) - Streaming with concurrency +- [streaming_callback/](concurrent_examples/streaming_callback/) - Streaming callback examples +- [uvloop/](concurrent_examples/uvloop/) - UVLoop integration examples + +## Council of Judges +- [council_judge_evaluation.py](council/council_judge_evaluation.py) - Judge evaluation system +- [council_judge_example.py](council/council_judge_example.py) - Basic council example +- [council_of_judges_eval.py](council/council_of_judges_eval.py) - Evaluation framework +- [council_judge_complex_example.py](council_of_judges/council_judge_complex_example.py) - Complex council setup +- [council_judge_custom_example.py](council_of_judges/council_judge_custom_example.py) - Custom council configuration + +## Debate Examples +- [debate_examples/](debate_examples/) - Various debate simulation patterns + +## Election Swarm +- [apple_board_election_example.py](election_swarm_examples/apple_board_election_example.py) - Apple board election simulation +- [election_example.py](election_swarm_examples/election_example.py) - General election example + +## Forest Swarm +- [forest_swarm_example.py](forest_swarm_examples/forest_swarm_example.py) - Forest-based swarm architecture +- [fund_manager_forest.py](forest_swarm_examples/fund_manager_forest.py) - Financial fund management forest +- [medical_forest_swarm.py](forest_swarm_examples/medical_forest_swarm.py) - Medical domain forest swarm +- [tree_example.py](forest_swarm_examples/tree_example.py) - Basic tree structure example +- [tree_swarm_test.py](forest_swarm_examples/tree_swarm_test.py) - Tree swarm testing + +## Graph Workflow +- [advanced_graph_workflow.py](graphworkflow_examples/advanced_graph_workflow.py) - Advanced graph-based workflows +- [graph_workflow_basic.py](graphworkflow_examples/graph_workflow_basic.py) - Basic graph workflow +- [graph_workflow_example.py](graphworkflow_examples/graph_workflow_example.py) - Complete graph workflow example +- [graph_workflow_validation.py](graphworkflow_examples/graph_workflow_validation.py) - Workflow validation +- [test_enhanced_json_export.py](graphworkflow_examples/test_enhanced_json_export.py) - JSON export testing +- [test_graph_workflow_caching.py](graphworkflow_examples/test_graph_workflow_caching.py) - Caching tests +- [test_graphviz_visualization.py](graphworkflow_examples/test_graphviz_visualization.py) - Visualization tests +- [test_parallel_processing_example.py](graphworkflow_examples/test_parallel_processing_example.py) - Parallel processing tests +- [graph/](graphworkflow_examples/graph/) - Core graph utilities +- [example_images/](graphworkflow_examples/example_images/) - Visualization images + +## Group Chat +- [interactive_groupchat_example.py](groupchat/interactive_groupchat_example.py) - Interactive group chat +- [quantum_physics_swarm.py](groupchat/quantum_physics_swarm.py) - Physics-focused group chat +- [random_dynamic_speaker_example.py](groupchat/random_dynamic_speaker_example.py) - Dynamic speaker selection +- [groupchat_examples/](groupchat/groupchat_examples/) - Additional group chat patterns + +## Heavy Swarm +- [heavy_swarm_example_one.py](heavy_swarm_examples/heavy_swarm_example_one.py) - First heavy swarm example +- [heavy_swarm_example.py](heavy_swarm_examples/heavy_swarm_example.py) - Main heavy swarm implementation +- [heavy_swarm_no_dashboard.py](heavy_swarm_examples/heavy_swarm_no_dashboard.py) - Heavy swarm without dashboard +- [medical_heavy_swarm_example.py](heavy_swarm_examples/medical_heavy_swarm_example.py) - Medical heavy swarm + +## Hierarchical Swarm +- [hierarchical_swarm_basic_demo.py](hiearchical_swarm/hierarchical_swarm_basic_demo.py) - Basic hierarchical demo +- [hierarchical_swarm_batch_demo.py](hiearchical_swarm/hierarchical_swarm_batch_demo.py) - Batch processing demo +- [hierarchical_swarm_comparison_demo.py](hiearchical_swarm/hierarchical_swarm_comparison_demo.py) - Comparison demo +- [hierarchical_swarm_example.py](hiearchical_swarm/hierarchical_swarm_example.py) - Main hierarchical example +- [hierarchical_swarm_streaming_demo.py](hiearchical_swarm/hierarchical_swarm_streaming_demo.py) - Streaming demo +- [hierarchical_swarm_streaming_example.py](hiearchical_swarm/hierarchical_swarm_streaming_example.py) - Streaming example +- [hs_interactive.py](hiearchical_swarm/hs_interactive.py) - Interactive hierarchical swarm +- [hs_stock_team.py](hiearchical_swarm/hs_stock_team.py) - Stock trading team +- [hybrid_hiearchical_swarm.py](hiearchical_swarm/hybrid_hiearchical_swarm.py) - Hybrid approach +- [sector_analysis_hiearchical_swarm.py](hiearchical_swarm/sector_analysis_hiearchical_swarm.py) - Sector analysis +- [hiearchical_examples/](hiearchical_swarm/hiearchical_examples/) - Additional hierarchical examples +- [hiearchical_swarm_ui/](hiearchical_swarm/hiearchical_swarm_ui/) - UI components +- [hscf/](hiearchical_swarm/hscf/) - Hierarchical framework examples + +## Interactive Group Chat +- [interactive_groupchat_speaker_example.py](interactive_groupchat_examples/interactive_groupchat_speaker_example.py) - Speaker management +- [medical_panel_example.py](interactive_groupchat_examples/medical_panel_example.py) - Medical panel discussion +- [speaker_function_examples.py](interactive_groupchat_examples/speaker_function_examples.py) - Speaker function examples +- [stream_example.py](interactive_groupchat_examples/stream_example.py) - Streaming example + +## Majority Voting +- [majority_voting_example_new.py](majority_voting/majority_voting_example_new.py) - Updated voting example +- [majority_voting_example.py](majority_voting/majority_voting_example.py) - Basic voting example +- [snake_game_code_voting.py](majority_voting/snake_game_code_voting.py) - Game code voting + +## MAR (Multi-Agent Reinforcement) +- [mar/](mar/) - Multi-agent reinforcement learning examples + +## MOA Examples +- [moa_examples/](moa_examples/) - Multi-objective agent examples + +## Spreadsheet Examples +- [new_spreadsheet_new_examples/](new_spreadsheet_new_examples/) - Latest spreadsheet integrations +- [new_spreadsheet_swarm_examples/](new_spreadsheet_swarm_examples/) - Spreadsheet swarm examples + +## Orchestration +- [orchestration_examples/](orchestration_examples/) - Workflow orchestration patterns + +## Paper Implementations +- [paper_implementations/](paper_implementations/) - Academic paper implementations + +## Sequential Workflow +- [sequential_workflow/](sequential_workflow/) - Sequential processing examples + +## Simulations +- [simulations/](simulations/) - Various simulation scenarios + +## Swarm Router +- [swarm_router/](swarm_router/) - Routing and load balancing + +## Swarm Arrange +- [swarmarrange/](swarmarrange/) - Agent arrangement utilities + +## Swarms API +- [swarms_api_examples/](swarms_api_examples/) - API integration examples + +## Utils +- [utils/](utils/) - Utility functions and helpers + +## Additional Files +- [duo_agent.py](duo_agent.py) - Two-agent collaboration +- [enhanced_collaboration_example.py](enhanced_collaboration_example.py) - Enhanced collaboration patterns diff --git a/majority_voting_example.py b/examples/multi_agent/majority_voting/_doda_majority_voting_example_new.py similarity index 100% rename from majority_voting_example.py rename to examples/multi_agent/majority_voting/_doda_majority_voting_example_new.py diff --git a/spreadsheet_new_examples/agent_config_example.csv b/examples/multi_agent/new_spreadsheet_new_examples/agent_config_example.csv similarity index 100% rename from spreadsheet_new_examples/agent_config_example.csv rename to examples/multi_agent/new_spreadsheet_new_examples/agent_config_example.csv diff --git a/spreadsheet_new_examples/spreadsheet_swarm_run_id_02575aa12829486c91967c24b927100b.csv b/examples/multi_agent/new_spreadsheet_new_examples/spreadsheet_swarm_run_id_02575aa12829486c91967c24b927100b.csv similarity index 100% rename from spreadsheet_new_examples/spreadsheet_swarm_run_id_02575aa12829486c91967c24b927100b.csv rename to examples/multi_agent/new_spreadsheet_new_examples/spreadsheet_swarm_run_id_02575aa12829486c91967c24b927100b.csv diff --git a/spreadsheet_new_examples/spreadsheet_swarm_run_id_69f4c23f5a97477ab2b8114521c33fd4.csv b/examples/multi_agent/new_spreadsheet_new_examples/spreadsheet_swarm_run_id_69f4c23f5a97477ab2b8114521c33fd4.csv similarity index 100% rename from spreadsheet_new_examples/spreadsheet_swarm_run_id_69f4c23f5a97477ab2b8114521c33fd4.csv rename to examples/multi_agent/new_spreadsheet_new_examples/spreadsheet_swarm_run_id_69f4c23f5a97477ab2b8114521c33fd4.csv diff --git a/spreadsheet_new_examples/spreadsheet_swarm_run_id_b93a2946b074493f8fa34a47377b2625.csv b/examples/multi_agent/new_spreadsheet_new_examples/spreadsheet_swarm_run_id_b93a2946b074493f8fa34a47377b2625.csv similarity index 100% rename from spreadsheet_new_examples/spreadsheet_swarm_run_id_b93a2946b074493f8fa34a47377b2625.csv rename to examples/multi_agent/new_spreadsheet_new_examples/spreadsheet_swarm_run_id_b93a2946b074493f8fa34a47377b2625.csv diff --git a/spreadsheet_new_examples/spreadsheet_swarm_usage.py b/examples/multi_agent/new_spreadsheet_new_examples/spreadsheet_swarm_usage.py similarity index 100% rename from spreadsheet_new_examples/spreadsheet_swarm_usage.py rename to examples/multi_agent/new_spreadsheet_new_examples/spreadsheet_swarm_usage.py diff --git a/spreadsheet_new_examples/swarm_outputs/Spreedsheet-Swarm-Financial-Analysis-Swarm/Financial-Analysis-Swarm/spreedsheet-swarm-69f4c23f5a97477ab2b8114521c33fd4-metadata.json b/examples/multi_agent/new_spreadsheet_new_examples/swarm_outputs/Spreedsheet-Swarm-Financial-Analysis-Swarm/Financial-Analysis-Swarm/spreedsheet-swarm-69f4c23f5a97477ab2b8114521c33fd4-metadata.json similarity index 100% rename from spreadsheet_new_examples/swarm_outputs/Spreedsheet-Swarm-Financial-Analysis-Swarm/Financial-Analysis-Swarm/spreedsheet-swarm-69f4c23f5a97477ab2b8114521c33fd4-metadata.json rename to examples/multi_agent/new_spreadsheet_new_examples/swarm_outputs/Spreedsheet-Swarm-Financial-Analysis-Swarm/Financial-Analysis-Swarm/spreedsheet-swarm-69f4c23f5a97477ab2b8114521c33fd4-metadata.json diff --git a/spreadsheet_new_examples/swarm_outputs/Spreedsheet-Swarm-Financial-Analysis-Swarm/Financial-Analysis-Swarm/spreedsheet-swarm-b93a2946b074493f8fa34a47377b2625-metadata.json b/examples/multi_agent/new_spreadsheet_new_examples/swarm_outputs/Spreedsheet-Swarm-Financial-Analysis-Swarm/Financial-Analysis-Swarm/spreedsheet-swarm-b93a2946b074493f8fa34a47377b2625-metadata.json similarity index 100% rename from spreadsheet_new_examples/swarm_outputs/Spreedsheet-Swarm-Financial-Analysis-Swarm/Financial-Analysis-Swarm/spreedsheet-swarm-b93a2946b074493f8fa34a47377b2625-metadata.json rename to examples/multi_agent/new_spreadsheet_new_examples/swarm_outputs/Spreedsheet-Swarm-Financial-Analysis-Swarm/Financial-Analysis-Swarm/spreedsheet-swarm-b93a2946b074493f8fa34a47377b2625-metadata.json diff --git a/examples/rag/README.md b/examples/rag/README.md new file mode 100644 index 00000000..bde13960 --- /dev/null +++ b/examples/rag/README.md @@ -0,0 +1,6 @@ +# RAG (Retrieval Augmented Generation) Examples + +This directory contains examples demonstrating RAG implementations and vector database integrations in Swarms. + +## Qdrant RAG +- [qdrant_rag_example.py](qdrant_rag_example.py) - Complete Qdrant RAG implementation diff --git a/examples/reasoning_agents/README.md b/examples/reasoning_agents/README.md new file mode 100644 index 00000000..30292db1 --- /dev/null +++ b/examples/reasoning_agents/README.md @@ -0,0 +1,12 @@ +# Reasoning Agents Examples + +This directory contains examples demonstrating advanced reasoning capabilities and agent evaluation systems in Swarms. + +## Agent Judge Examples +- [example1_basic_evaluation.py](agent_judge_examples/example1_basic_evaluation.py) - Basic agent evaluation +- [example2_technical_evaluation.py](agent_judge_examples/example2_technical_evaluation.py) - Technical evaluation criteria +- [example3_creative_evaluation.py](agent_judge_examples/example3_creative_evaluation.py) - Creative evaluation patterns + +## O3 Integration +- [example_o3.py](example_o3.py) - O3 model integration example +- [o3_agent.py](o3_agent.py) - O3 agent implementation diff --git a/examples/single_agent/README.md b/examples/single_agent/README.md new file mode 100644 index 00000000..d9997390 --- /dev/null +++ b/examples/single_agent/README.md @@ -0,0 +1,115 @@ +# Single Agent Examples + +This directory contains examples demonstrating single agent patterns, configurations, and use cases in Swarms. + +## Demos +- [insurance_agent.py](demos/insurance_agent.py) - Insurance processing agent +- [persistent_legal_agent.py](demos/persistent_legal_agent.py) - Legal document processing agent + +## External Agents +- [custom_agent_example.py](external_agents/custom_agent_example.py) - Custom agent implementation +- [openai_assistant_wrapper.py](external_agents/openai_assistant_wrapper.py) - OpenAI Assistant integration + +## LLM Integrations + +### Azure +- [azure_agent_api_verison.py](llms/azure_agent_api_verison.py) - Azure API version handling +- [azure_agent.py](llms/azure_agent.py) - Azure OpenAI integration +- [azure_model_support.py](llms/azure_model_support.py) - Azure model support + +### Claude +- [claude_4_example.py](llms/claude_examples/claude_4_example.py) - Claude 4 integration +- [claude_4.py](llms/claude_examples/claude_4.py) - Claude 4 implementation +- [swarms_claude_example.py](llms/claude_examples/swarms_claude_example.py) - Swarms Claude integration + +### DeepSeek +- [deepseek_r1.py](llms/deepseek_examples/deepseek_r1.py) - DeepSeek R1 model +- [fast_r1_groq.py](llms/deepseek_examples/fast_r1_groq.py) - Fast R1 with Groq +- [grok_deepseek_agent.py](llms/deepseek_examples/grok_deepseek_agent.py) - Grok DeepSeek integration + +### Mistral +- [mistral_example.py](llms/mistral_example.py) - Mistral model integration + +### OpenAI +- [4o_mini_demo.py](llms/openai_examples/4o_mini_demo.py) - GPT-4o Mini demonstration +- [reasoning_duo_batched.py](llms/openai_examples/reasoning_duo_batched.py) - Batched reasoning with OpenAI +- [test_async_litellm.py](llms/openai_examples/test_async_litellm.py) - Async LiteLLM testing + +### Qwen +- [qwen_3_base.py](llms/qwen_3_base.py) - Qwen 3 base model + +## Onboarding +- [agents.yaml](onboard/agents.yaml) - Agent configuration file +- [onboard-basic.py](onboard/onboard-basic.py) - Basic onboarding example + +## RAG (Retrieval Augmented Generation) +- [full_agent_rag_example.py](rag/full_agent_rag_example.py) - Complete RAG implementation +- [pinecone_example.py](rag/pinecone_example.py) - Pinecone vector database integration +- [qdrant_agent.py](rag/qdrant_agent.py) - Qdrant vector database agent +- [qdrant_rag_example.py](rag/qdrant_rag_example.py) - Qdrant RAG implementation +- [simple_example.py](rag/simple_example.py) - Simple RAG example +- [README.md](rag/README.md) - RAG documentation + +## Reasoning Agents +- [agent_judge_evaluation_criteria_example.py](reasoning_agent_examples/agent_judge_evaluation_criteria_example.py) - Evaluation criteria for agent judging +- [agent_judge_example.py](reasoning_agent_examples/agent_judge_example.py) - Agent judging system +- [consistency_agent.py](reasoning_agent_examples/consistency_agent.py) - Consistency checking agent +- [consistency_example.py](reasoning_agent_examples/consistency_example.py) - Consistency example +- [gpk_agent.py](reasoning_agent_examples/gpk_agent.py) - GPK reasoning agent +- [iterative_agent.py](reasoning_agent_examples/iterative_agent.py) - Iterative reasoning agent +- [malt_example.py](reasoning_agent_examples/malt_example.py) - MALT reasoning example +- [reasoning_agent_router_now.py](reasoning_agent_examples/reasoning_agent_router_now.py) - Current reasoning router +- [reasoning_agent_router.py](reasoning_agent_examples/reasoning_agent_router.py) - Reasoning agent router +- [reasoning_duo_example.py](reasoning_agent_examples/reasoning_duo_example.py) - Two-agent reasoning +- [reasoning_duo_test.py](reasoning_agent_examples/reasoning_duo_test.py) - Reasoning duo testing +- [reasoning_duo.py](reasoning_agent_examples/reasoning_duo.py) - Reasoning duo implementation + +## Tools Integration +- [exa_search_agent.py](tools/exa_search_agent.py) - Exa search integration +- [example_async_vs_multithread.py](tools/example_async_vs_multithread.py) - Async vs multithreading comparison +- [litellm_tool_example.py](tools/litellm_tool_example.py) - LiteLLM tool integration +- [multi_tool_usage_agent.py](tools/multi_tool_usage_agent.py) - Multi-tool agent +- [new_tools_examples.py](tools/new_tools_examples.py) - Latest tool examples +- [omni_modal_agent.py](tools/omni_modal_agent.py) - Omni-modal agent +- [swarms_of_browser_agents.py](tools/swarms_of_browser_agents.py) - Browser automation swarms +- [swarms_tools_example.py](tools/swarms_tools_example.py) - Swarms tools integration +- [together_deepseek_agent.py](tools/together_deepseek_agent.py) - Together AI DeepSeek integration + +### Solana Tools +- [solana_tool.py](tools/solana_tool/solana_tool.py) - Solana blockchain integration +- [solana_tool_test.py](tools/solana_tool/solana_tool_test.py) - Solana tool testing + +### Structured Outputs +- [example_meaning_of_life_agents.py](tools/structured_outputs/example_meaning_of_life_agents.py) - Meaning of life example +- [structured_outputs_example.py](tools/structured_outputs/structured_outputs_example.py) - Structured output examples + +### Tools Examples +- [dex_screener.py](tools/tools_examples/dex_screener.py) - DEX screener tool +- [financial_news_agent.py](tools/tools_examples/financial_news_agent.py) - Financial news agent +- [simple_tool_example.py](tools/tools_examples/simple_tool_example.py) - Simple tool usage +- [swarms_tool_example_simple.py](tools/tools_examples/swarms_tool_example_simple.py) - Simple Swarms tool + +## Utils +- [async_agent.py](utils/async_agent.py) - Async agent implementation +- [dynamic_context_window.py](utils/dynamic_context_window.py) - Dynamic context window management +- [fallback_test.py](utils/fallback_test.py) - Fallback mechanism testing +- [grok_4_agent.py](utils/grok_4_agent.py) - Grok 4 agent implementation +- [handoffs_example.py](utils/handoffs_example.py) - Agent handoff examples +- [list_agent_output_types.py](utils/list_agent_output_types.py) - Output type listing +- [markdown_agent.py](utils/markdown_agent.py) - Markdown processing agent +- [xml_output_example.py](utils/xml_output_example.py) - XML output example + +### Transform Prompts +- [transforms_agent_example.py](utils/transform_prompts/transforms_agent_example.py) - Prompt transformation agent +- [transforms_examples.py](utils/transform_prompts/transforms_examples.py) - Prompt transformation examples + +## Vision +- [anthropic_vision_test.py](vision/anthropic_vision_test.py) - Anthropic vision testing +- [image_batch_example.py](vision/image_batch_example.py) - Batch image processing +- [multimodal_example.py](vision/multimodal_example.py) - Multimodal agent example +- [multiple_image_processing.py](vision/multiple_image_processing.py) - Multiple image processing +- [vision_test.py](vision/vision_test.py) - Vision testing +- [vision_tools.py](vision/vision_tools.py) - Vision tools integration + +## Main Files +- [simple_agent.py](simple_agent.py) - Basic single agent example diff --git a/examples/swarms_api_examples/README.md b/examples/swarms_api_examples/README.md new file mode 100644 index 00000000..7092e1fb --- /dev/null +++ b/examples/swarms_api_examples/README.md @@ -0,0 +1,22 @@ +# Swarms API Examples + +This directory contains examples demonstrating how to use the Swarms API for various agent operations. + +## Agent Overview +- [agent_overview.py](agent_overview.py) - Comprehensive overview of agent capabilities + +## Batch Processing +- [batch_example.py](batch_example.py) - Batch processing with multiple agents + +## Client Integration +- [client_example.py](client_example.py) - Basic client usage example + +## Team Examples +- [hospital_team.py](hospital_team.py) - Hospital management team simulation +- [legal_team.py](legal_team.py) - Legal team collaboration example + +## Analysis Examples +- [icd_ten_analysis.py](icd_ten_analysis.py) - ICD-10 medical code analysis + +## Rate Limiting +- [rate_limits.py](rate_limits.py) - Rate limiting and throttling examples diff --git a/examples/tools/README.md b/examples/tools/README.md new file mode 100644 index 00000000..a7b7ddb1 --- /dev/null +++ b/examples/tools/README.md @@ -0,0 +1,45 @@ +# Tools Examples + +This directory contains examples demonstrating various tool integrations and usage patterns in Swarms. + +## Agent as Tools +- [agent_as_tools.py](agent_as_tools.py) - Using agents as tools in workflows + +## Base Tool Examples +- [base_tool_examples.py](base_tool_examples/base_tool_examples.py) - Core base tool functionality +- [conver_funcs_to_schema.py](base_tool_examples/conver_funcs_to_schema.py) - Function to schema conversion +- [convert_basemodels.py](base_tool_examples/convert_basemodels.py) - BaseModel conversion utilities +- [exa_search_test.py](base_tool_examples/exa_search_test.py) - Exa search testing +- [example_usage.py](base_tool_examples/example_usage.py) - Basic usage examples +- [schema_validation_example.py](base_tool_examples/schema_validation_example.py) - Schema validation +- [test_anthropic_specific.py](base_tool_examples/test_anthropic_specific.py) - Anthropic-specific testing +- [test_base_tool_comprehensive_fixed.py](base_tool_examples/test_base_tool_comprehensive_fixed.py) - Comprehensive testing (fixed) +- [test_base_tool_comprehensive.py](base_tool_examples/test_base_tool_comprehensive.py) - Comprehensive testing +- [test_function_calls_anthropic.py](base_tool_examples/test_function_calls_anthropic.py) - Anthropic function calls +- [test_function_calls.py](base_tool_examples/test_function_calls.py) - Function call testing + +## Browser Integration +- [browser_use_as_tool.py](browser_use_as_tool.py) - Browser automation as a tool +- [browser_use_demo.py](browser_use_demo.py) - Browser automation demonstration + +## Claude Integration +- [claude_as_a_tool.py](claude_as_a_tool.py) - Using Claude as a tool + +## Exa Search +- [exa_search_agent.py](exa_search_agent.py) - Exa search agent implementation + +## Firecrawl Integration +- [firecrawl_agents_example.py](firecrawl_agents_example.py) - Firecrawl web scraping agents + +## Multi-Tool Usage +- [many_tool_use_demo.py](multii_tool_use/many_tool_use_demo.py) - Multiple tool usage demonstration +- [multi_tool_anthropic.py](multii_tool_use/multi_tool_anthropic.py) - Multi-tool with Anthropic + +## Stagehand Integration +- [1_stagehand_wrapper_agent.py](stagehand/1_stagehand_wrapper_agent.py) - Stagehand wrapper agent +- [2_stagehand_tools_agent.py](stagehand/2_stagehand_tools_agent.py) - Stagehand tools agent +- [3_stagehand_mcp_agent.py](stagehand/3_stagehand_mcp_agent.py) - Stagehand MCP agent +- [4_stagehand_multi_agent_workflow.py](stagehand/4_stagehand_multi_agent_workflow.py) - Multi-agent workflow +- [README.md](stagehand/README.md) - Stagehand documentation +- [requirements.txt](stagehand/requirements.txt) - Stagehand dependencies +- [tests/](stagehand/tests/) - Stagehand testing suite diff --git a/examples/ui/README.md b/examples/ui/README.md new file mode 100644 index 00000000..ddef2a0a --- /dev/null +++ b/examples/ui/README.md @@ -0,0 +1,6 @@ +# UI Examples + +This directory contains user interface examples and implementations for Swarms. + +## Chat Interface +- [chat.py](chat.py) - Chat interface implementation diff --git a/examples/utils/README.md b/examples/utils/README.md new file mode 100644 index 00000000..7e7c23d6 --- /dev/null +++ b/examples/utils/README.md @@ -0,0 +1,40 @@ +# Utils Examples + +This directory contains utility examples and helper functions for various Swarms operations. + +## Agent Loader +- [agent_loader_demo.py](agent_loader/agent_loader_demo.py) - Agent loading demonstration +- [claude_code_compatible.py](agent_loader/claude_code_compatible.py) - Claude code compatibility +- [finance_advisor.md](agent_loader/finance_advisor.md) - Finance advisor documentation +- [multi_agents_loader_demo.py](agent_loader/multi_agents_loader_demo.py) - Multi-agent loading demo + +## Communication Examples +- [duckdb_agent.py](communication_examples/duckdb_agent.py) - DuckDB database agent +- [pulsar_conversation.py](communication_examples/pulsar_conversation.py) - Apache Pulsar messaging +- [redis_conversation.py](communication_examples/redis_conversation.py) - Redis-based conversations +- [sqlite_conversation.py](communication_examples/sqlite_conversation.py) - SQLite conversation storage + +## Concurrent Wrapper +- [concurrent_wrapper_examples.py](concurrent_wrapper_examples.py) - Concurrent execution wrapper examples + +## Miscellaneous +- [agent_map_test.py](misc/agent_map_test.py) - Agent mapping testing +- [conversation_simple.py](misc/conversation_simple.py) - Simple conversation handling +- [conversation_test_truncate.py](misc/conversation_test_truncate.py) - Conversation truncation testing +- [conversation_test.py](misc/conversation_test.py) - Conversation testing +- [csvagent_example.py](misc/csvagent_example.py) - CSV processing agent +- [dict_to_table.py](misc/dict_to_table.py) - Dictionary to table conversion +- [swarm_matcher_example.py](misc/swarm_matcher_example.py) - Swarm matching utilities +- [test_load_conversation.py](misc/test_load_conversation.py) - Conversation loading tests +- [visualizer_test.py](misc/visualizer_test.py) - Visualization testing + +### AOP (Aspect-Oriented Programming) +- [client.py](misc/aop/client.py) - AOP client implementation +- [test_aop.py](misc/aop/test_aop.py) - AOP testing + +### Conversation Structure +- [conversation_example_supabase.py](misc/conversation_structure/conversation_example_supabase.py) - Supabase conversation example + +## Telemetry +- [class_method_example.py](telemetry/class_method_example.py) - Class method telemetry +- [example_decorator_usage.py](telemetry/example_decorator_usage.py) - Decorator usage examples diff --git a/examples/workshops/README.md b/examples/workshops/README.md new file mode 100644 index 00000000..71800c9b --- /dev/null +++ b/examples/workshops/README.md @@ -0,0 +1,15 @@ +# Workshop Examples + +This directory contains examples from workshops and educational sessions. + +## Workshop September 20 +- [agent_tools_dict_example.py](workshop_sep_20/agent_tools_dict_example.py) - Agent tools dictionary example +- [batched_grid_simple_example.py](workshop_sep_20/batched_grid_simple_example.py) - Simple batched grid example +- [geo_guesser_agent.py](workshop_sep_20/geo_guesser_agent.py) - Geographic location guessing agent +- [jarvis_agent.py](workshop_sep_20/jarvis_agent.py) - Jarvis AI assistant +- [same_task_example.py](workshop_sep_20/same_task_example.py) - Same task execution example + +### Sample Images +- [hk.jpg](workshop_sep_20/hk.jpg) - Hong Kong sample image +- [miami.jpg](workshop_sep_20/miami.jpg) - Miami sample image +- [mountains.jpg](workshop_sep_20/mountains.jpg) - Mountains sample image