Getting Started with Swarm Squad β
Welcome to Swarm Squad, a comprehensive simulation framework for multi-agent systems. This guide will help you set up, configure, and run your first simulation with agent-based modeling capabilities.
What is Swarm Squad? β
Swarm Squad is a powerful simulation framework designed for multi-agent systems with the following key features:
- π€ Agent Simulation: Simulates multiple agents in a shared environment
- π Scalability: Handles large-scale agent simulations efficiently
- β Behavior Specs: Define and test agent behavior against expected outcomes
- π Environment Modeling: Build and manage physical or virtual environments
- π Analytics: Collect metrics on speed, coordination, and performance
- βοΈ Customizable: Easily extend agents, environments, and evaluation logic
- πΊοΈ Visualization: Real-time views and post-run reports of simulations
- π§° Tool Integration: Connect with RL libraries, protocols, or visual tools
- π Versatile Agents: Supports robots, drones, and autonomous vehicles
Quick Start β
For most users, getting started with Swarm Squad is as simple as:
# Install Swarm Squad
uv pip install swarm-squad
# Run the application
swarm-squad
swarm-squad --help
That's it! The application will start and you can begin exploring multi-agent simulations.
Prerequisites β
For basic usage, you only need:
- uv: For package installation and management (recommended)
Installing uv β
If you don't have uv installed, you can install it using:
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
Installation β
Option 1: Install from PyPI (Recommended) β
The simplest way to install Swarm Squad is directly from PyPI:
# Install the package using uv
uv pip install swarm-squad
Option 2: Development Installation β
For contributors, developers, or if you plan to modify the framework:
Additional Prerequisites for Development:
- git: For cloning the repository
- ruff: For code linting and formatting
- pre-commit: For code quality hooks
# Clone the repository
git clone https://github.com/Sang-Buster/Swarm-Squad
cd Swarm-Squad
# Option 1 (Recommended): Synchronize environment with dependencies
uv sync
source .venv/bin/activate # On Linux/macOS
# Or: .venv\Scripts\activate # On Windows
# Option 2 (Manual): Create virtual environment manually
uv venv --python 3.10
source .venv/bin/activate # On Linux/macOS
# Or: .venv\Scripts\activate # On Windows
uv pip install -e .
Running Swarm Squad β
After installation, you can run Swarm Squad using the command-line interface:
# Run with default settings
swarm-squad
# Show available options and help
swarm-squad --help
Environment Configuration (Optional) β
For advanced features, you can configure some environment variables:
# Copy the example environment file (only if cloned from source)
cp .env.example .env
Edit the .env
file and configure the following variables:
MAPBOX_ACCESS_TOKEN
: Required for map visualization features- Sign up at https://www.mapbox.com/ to get your access token
OLLAMA_API_URL
: URL for Ollama API integration- Update if your Ollama instance is running on a different address
DATABASE_PATH
: Path to the database file- Specify if you want to use a custom database file location
Development Setup β
If you're planning to develop or extend Swarm Squad, set up the development environment:
Install Development Tools β
# Install development dependencies
uv pip install ruff pre-commit
Set up Git Hooks β
# Install git hooks for code quality
pre-commit install --install-hooks
These hooks perform different checks at various stages:
commit-msg
: Ensures commit messages follow the conventional formatpre-commit
: Runs Ruff linting and formatting checks before each commitpre-push
: Performs final validation before pushing to remote
Code Quality Checks β
# Run linting and formatting
ruff check --fix
ruff check --select I --fix
ruff format
Running from Source β
When developing, you can run directly from the source code:
uv run src/swarm_squad/app.py
Project Structure β
Understanding the Swarm Squad file structure will help you navigate and extend the framework:
π Swarm Squad
β£ π src/swarm_squad/ # Main source code
β β£ π assets/ # Static assets (CSS, JS, images)
β β β£ π css/ # Stylesheets
β β β£ π js/ # JavaScript files
β β β£ π models/ # 3D models and assets
β β β π screenshots/ # Application screenshots
β β£ π cli/ # Command-line interface
β β£ π components/ # Reusable UI components
β β£ π data/ # Database and data files
β β£ π pages/ # Page components and routing
β β£ π scripts/ # Simulation and algorithm scripts
β β£ π utils/ # Utility functions and helpers
β β£ π app.py # Main application entry point
β β π core.py # Core Dash application logic
β£ π .env.example # Environment variables template
β£ π pyproject.toml # Project configuration
β π uv.lock # Dependency lock file
First Simulation β
Once you have Swarm Squad installed and configured, you can run your first simulation:
Launch the Application:
bashswarm-squad
Access the Web Interface: Open your browser and navigate to the URL displayed in the terminal (typically
http://localhost:8050
)Explore the Interface: The web interface provides:
- Real-time simulation visualization
- Agent behavior configuration
- Environment setup tools
- Performance analytics dashboard
Next Steps β
Now that you have Swarm Squad installed and running, explore these areas:
- Architecture: Understand the framework's design and components
- Configuration: Learn about customization options and settings
- Demo: Try out example simulations and use cases
- Community: Join the Swarm Squad community for support and collaboration
Troubleshooting β
If you encounter issues during installation or setup:
Common Issues β
- Python Version: Ensure you're using Python 3.10 or higher
- Virtual Environment: Always work within a virtual environment to avoid conflicts
- Dependencies: Run
uv pip install -e .
again if you encounter import errors - Environment Variables: Verify that all required environment variables are set correctly
Getting Help β
- Check the error messages for specific guidance
- Review the logs in the terminal output
- Ensure all prerequisites are correctly installed
- Visit the project's GitHub repository for issue tracking and community support
With Swarm Squad properly installed and configured, you're ready to explore the powerful world of multi-agent simulation!