Skip to content

josephsenior/distributed-multi-agent-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Distributed Multi-Agent Communication Platform

Python FastAPI License AutoGen

A production-ready distributed system for multi-agent communication, collaboration, and knowledge sharing. Built with AutoGen, featuring real-time WebSocket communication, ChromaDB vector database integration, Redis message queuing, and intelligent agent routing. Enables scalable agent-to-agent collaboration with automatic discovery, load balancing, and knowledge sharing capabilities.

Key Features

Core Capabilities

  • ** Distributed Agent Architecture**: Multiple agents running across different nodes with automatic discovery
  • ** Real-Time Communication**: WebSocket-based agent-to-agent messaging
  • ** Production Vector Database**: ChromaDB integration for semantic search and knowledge retrieval
  • ** Message Queue System**: Redis-based message queuing for reliable agent communication
  • ** Intelligent Routing**: Automatic agent discovery and intelligent message routing
  • ** Load Balancing**: Distribute agent workloads across available nodes
  • ** Knowledge Sharing**: Agents can share and retrieve knowledge from a shared vector store
  • ** Monitoring Dashboard**: Real-time monitoring of agent activities and system health

Features

Core Capabilities

  • Distributed Agent Architecture: Multiple agents running across different nodes with automatic discovery
  • Real-Time Communication: WebSocket-based agent-to-agent messaging
  • Production Vector Database: ChromaDB integration for semantic search and knowledge retrieval
  • Message Queue System: Redis-based message queuing for reliable agent communication
  • Agent Discovery & Routing: Automatic agent discovery and intelligent message routing
  • Load Balancing: Distribute agent workloads across available nodes
  • Knowledge Sharing: Agents can share and retrieve knowledge from a shared vector store
  • Monitoring Dashboard: Real-time monitoring of agent activities and system health

Agent Types

  • Researcher Agent: Gathers and synthesizes information from multiple sources
  • Analyst Agent: Performs deep analysis on provided data
  • Coordinator Agent: Orchestrates multi-agent workflows
  • Knowledge Agent: Manages and retrieves information from the vector database

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Agent Node 1  β”‚     β”‚   Agent Node 2  β”‚     β”‚   Agent Node 3  β”‚
β”‚                 β”‚     β”‚                 β”‚     β”‚                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚     β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚     β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Researcherβ”‚  β”‚     β”‚  β”‚  Analyst  β”‚  β”‚     β”‚  β”‚Coordinatorβ”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β”‚     β”‚  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β”‚     β”‚  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β”‚
β”‚        β”‚        β”‚     β”‚        β”‚        β”‚     β”‚        β”‚        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚                         β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚  Redis Queue   β”‚      β”‚   ChromaDB      β”‚
            β”‚  (Messaging)   β”‚      β”‚  (Knowledge)    β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚                         β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   API Gateway           β”‚
                    β”‚   (FastAPI + WebSocket) β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Installation

Option 1: Using Docker (Recommended)

The easiest way to get started is using Docker Compose:

# Clone the repository
git clone <repository-url>
cd distributed_agent_platform

# Set up environment variables
cp env.example .env
# Edit .env and add your GEMINI_API_KEY

# Start the platform
docker-compose up --build

Option 2: Manual Installation

# Clone the repository
git clone <repository-url>
cd distributed_agent_platform

# Install dependencies
pip install -r requirements.txt

# Set up environment variables
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY

# Start Redis (if not running)
# On macOS with Homebrew:
brew services start redis
# On Linux:
sudo systemctl start redis
# On Windows, download and run Redis

# Run the platform
python main.py

Quick Start

1. Start the Platform

python main.py

This will start:

  • FastAPI server on http://localhost:8000
  • WebSocket server on ws://localhost:8001
  • Agent discovery service
  • Vector database service

2. Access the Dashboard

Open your browser to http://localhost:8000 to access the monitoring dashboard.

3. Create Agents

from backend.agents.researcher_agent import ResearcherAgent
from backend.core.agent_manager import AgentManager

# Initialize agent manager
manager = AgentManager()

# Create a researcher agent
researcher = ResearcherAgent(
    name="researcher_1",
    system_message="You are a research agent specialized in gathering information."
)

# Register agent
manager.register_agent(researcher)

4. Send Messages Between Agents

# Send a message from one agent to another
message = {
    "from": "researcher_1",
    "to": "analyst_1",
    "content": "Please analyze this data: ...",
    "type": "analysis_request"
}

manager.send_message(message)

Project Structure

distributed_agent_platform/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ base_agent.py          # Base agent class
β”‚   β”‚   β”œβ”€β”€ researcher_agent.py    # Researcher agent implementation
β”‚   β”‚   β”œβ”€β”€ analyst_agent.py       # Analyst agent implementation
β”‚   β”‚   β”œβ”€β”€ coordinator_agent.py   # Coordinator agent implementation
β”‚   β”‚   └── knowledge_agent.py     # Knowledge management agent
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ agent_manager.py       # Agent lifecycle management
β”‚   β”‚   β”œβ”€β”€ message_router.py      # Message routing logic
β”‚   β”‚   β”œβ”€β”€ discovery_service.py   # Agent discovery
β”‚   β”‚   └── load_balancer.py       # Load balancing
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ vector_service.py      # ChromaDB integration
β”‚   β”‚   β”œβ”€β”€ queue_service.py       # Redis queue management
β”‚   β”‚   └── websocket_service.py   # WebSocket communication
β”‚   └── models/
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ message.py             # Message models
β”‚       └── agent.py               # Agent models
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ static/
β”‚   β”‚   β”œβ”€β”€ css/
β”‚   β”‚   └── js/
β”‚   └── templates/
β”‚       └── index.html             # Dashboard UI
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_agents.py
β”‚   β”œβ”€β”€ test_routing.py
β”‚   └── test_vector_service.py
β”œβ”€β”€ main.py                        # Application entry point
β”œβ”€β”€ requirements.txt
└── README.md

API Endpoints

REST API

  • GET /health - Health check
  • GET /agents - List all registered agents
  • POST /agents/register - Register a new agent
  • DELETE /agents/{agent_id} - Unregister an agent
  • POST /messages/send - Send a message between agents
  • GET /messages/{agent_id} - Get messages for an agent
  • GET /metrics - System metrics

WebSocket API

  • ws://localhost:8001/ws/{agent_id} - Agent WebSocket connection
  • Messages: {"type": "message", "to": "agent_id", "content": "..."}

Configuration

Edit .env to configure:

  • Gemini API: Set your API key
  • Redis: Configure Redis connection
  • ChromaDB: Set persistence directory
  • Server: Configure host and ports
  • Agents: Set limits and timeouts

Monitoring

The platform includes built-in monitoring:

  • Agent status and health
  • Message throughput
  • Queue depth
  • Vector database statistics
  • System resource usage

Access the dashboard at http://localhost:8000 for real-time monitoring.

Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=backend --cov-report=html

# Run specific test file
pytest tests/test_agents.py

Tech Stack

  • Framework: FastAPI (async Python web framework)
  • Agent Framework: Microsoft AutoGen
  • Vector Database: ChromaDB (semantic search & embeddings)
  • Message Queue: Redis (distributed messaging)
  • Real-time: WebSockets (bidirectional communication)
  • Embeddings: Sentence Transformers
  • Language: Python 3.9+

Use Cases

  • Multi-Agent Research Systems: Coordinate multiple research agents to gather and synthesize information
  • Distributed AI Workflows: Orchestrate complex AI tasks across multiple specialized agents
  • Knowledge Management: Build intelligent knowledge bases with semantic search capabilities
  • Agent Orchestration: Manage and coordinate multiple AI agents in production environments
  • Real-time Agent Communication: Enable instant messaging between distributed agents

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

A high-performance distributed multi-agent communication platform using AutoGen, FastAPI, and Redis. Features real-time WebSocket orchestration, semantic search with ChromaDB, and scalable agent discovery.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors