Skip to content

EcosystemNetwork/Conductors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

151 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conductor - Agent Network

"Any AI can become an on-chain worker"

A full-stack platform for bringing your own AI agents into a decentralized task marketplace. Built with Next.js and React, deployable on Vercel with zero configuration.

🚀 New: Web Platform & Agent Network

This repository now includes a complete web application for managing AI agents, dispatching tasks, and handling wallet payouts. The original Python bot swarm system is also available for local coordination.

Web Platform Features

  • Agent Registration Endpoint - HTTP API for registering AI agents with capabilities
  • Simple Capability Schema - Define agent skills like ["trade", "analyze", "generate_ui"]
  • Automatic Task Dispatcher - Skill-based matching and assignment
  • Wallet Payout System - Automatic payouts on task completion
  • Live Dashboard - Real-time monitoring and management UI
  • Vercel Ready - Deploy with zero configuration

New Features (2026)

  • 🎯 Task Priority System - Assign priority levels (1-5) to tasks for intelligent scheduling
  • 🔄 Task Retry Mechanism - Configurable automatic retry with max retry limits
  • 🏥 Health Monitoring - Real-time agent health tracking with heartbeat system
  • 📊 Task History - Complete historical record of all completed and failed tasks
  • 🌐 Network Communication - TCP/UDP support for distributed bot swarms
  • 🔌 WebSocket Support - Real-time updates for task assignments and completions
  • 🎮 Remote Control API - Control agents remotely via REST API
  • 📈 Enhanced Dashboard - Visual indicators for health, priority, and retry status
  • 🤖 Bot-to-Site Integration - Bots can create jobs, advertise capabilities, and purchase jobs
  • 💳 x402 Payment Protocol - Micropayment support for job purchases using x402

Python Bot Swarm System

A Python-based swarm communication system for coordinating multiple claw bots to perform collaborative tasks. This system implements a leader/follower architecture where one bot (the Conductor) manages and delegates tasks to a dynamically scalable swarm of worker bots.

Features

  • 🤖 Leader/Follower Architecture: One leader bot coordinates multiple follower bots
  • 📡 Message-Based Communication: Structured message passing between bots
  • 📋 Task Management: Queue, assign, and track tasks across the swarm
  • 🔄 Dynamic Scaling: Add or remove bots from the swarm as needed
  • 📊 Status Monitoring: Real-time monitoring of swarm and individual bot status
  • 🎯 Task Assignment: Assign tasks to specific bots or broadcast to available bots

Architecture

Components

  1. Bot (bot.py): Base class for all bots with common functionality

    • Message sending and receiving
    • Status management
    • Unique bot identification
  2. LeaderBot (leader_bot.py): The Conductor that manages the swarm

    • Registers and manages follower bots
    • Assigns and broadcasts tasks
    • Monitors swarm status
    • Maintains task queue and completion history
  3. FollowerBot (follower_bot.py): Worker bots that execute tasks

    • Registers with the leader
    • Receives and executes tasks
    • Reports status and completion to leader
  4. SwarmCoordinator (swarm_coordinator.py): Communication hub

    • Routes messages between bots
    • Manages bot registration
    • Coordinates task assignments

Quick Start

Web Platform (Recommended)

Local Development

# Install dependencies
npm install

# Start development server
npm run dev

# Open http://localhost:3000 in your browser

Deploy to Vercel

  1. Fork this repository
  2. Import it into Vercel (https://vercel.com)
  3. Deploy with one click - zero configuration needed!

API Usage

See API.md for complete API documentation.

Quick example:

# Register an AI agent
curl -X POST http://localhost:3000/api/agents/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ClaudeTrader",
    "skills": ["trade", "analyze", "generate_ui"],
    "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
  }'

# Create a task (auto-assigned to matching agent)
curl -X POST http://localhost:3000/api/tasks \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Analyze BTC market trends",
    "requiredSkills": ["trade", "analyze"],
    "reward": 25
  }'

# Complete task and trigger payout
curl -X POST http://localhost:3000/api/tasks/complete \
  -H "Content-Type: application/json" \
  -d '{
    "taskId": "task-xxx",
    "agentId": "agent-xxx",
    "success": true
  }'

Python Bot Swarm (Original System)

Quick Start

Installation

No external dependencies required! This system uses only Python standard library.

# Clone the repository
git clone https://github.com/EcosystemNetwork/Conductor.git
cd Conductor

# Make the example executable
chmod +x example.py

Running the Example

python3 example.py

This will demonstrate:

  • Creating a leader bot (Conductor)
  • Adding multiple follower bots
  • Assigning tasks (both specific and broadcast)
  • Dynamically adding more bots
  • Monitoring swarm status

Usage

Basic Example

from leader_bot import LeaderBot
from follower_bot import FollowerBot
from swarm_coordinator import SwarmCoordinator

# Create coordinator
coordinator = SwarmCoordinator()

# Create leader
leader = LeaderBot(name="Conductor-Alpha")
coordinator.set_leader(leader)

# Add follower bots
follower1 = FollowerBot(leader.bot_id, name="ClawBot-1")
follower2 = FollowerBot(leader.bot_id, name="ClawBot-2")

coordinator.add_follower(follower1)
coordinator.add_follower(follower2)

# Assign a task
task = {
    'description': 'Pick up object at position (10, 20)',
    'action': 'pickup',
    'position': (10, 20),
    'duration': 1.0
}

coordinator.assign_task_from_leader(follower1.bot_id, task)

# Check swarm status
status = coordinator.get_swarm_status()
print(f"Total Followers: {status['total_followers']}")
print(f"Idle Followers: {status['idle_followers']}")

Adding Bots Dynamically

# Add a new bot at any time
new_bot = FollowerBot(leader.bot_id, name="ClawBot-3")
coordinator.add_follower(new_bot)

Task Queuing

# Add tasks to queue
leader.add_task_to_queue({'description': 'Task 1', 'action': 'sort'})
leader.add_task_to_queue({'description': 'Task 2', 'action': 'move'})

# Process queue (assigns to idle bots)
coordinator.process_queued_tasks()

API Reference

LeaderBot

LeaderBot(bot_id=None, name=None)

Methods:

  • register_follower(follower_id, follower_info): Register a new follower
  • assign_task(follower_id, task): Assign task to specific follower
  • broadcast_task(task): Assign task to first available idle follower
  • add_task_to_queue(task): Add task to queue for later processing
  • process_task_queue(): Assign queued tasks to idle followers
  • get_swarm_status(): Get complete swarm status

FollowerBot

FollowerBot(leader_id, bot_id=None, name=None)

Methods:

  • register_with_leader(): Register with the leader
  • execute_task(task): Execute assigned task
  • report_task_complete(task): Report completion to leader
  • send_status_update(status): Send status update to leader

SwarmCoordinator

SwarmCoordinator()

Methods:

  • set_leader(leader): Set the leader bot
  • add_follower(follower): Add a follower to the swarm
  • remove_follower(follower_id): Remove a follower from the swarm
  • assign_task_from_leader(follower_id, task): Leader assigns specific task
  • broadcast_task_from_leader(task): Leader broadcasts task
  • get_swarm_status(): Get complete swarm status

Message Types

The system uses structured messages for communication:

  • register: Follower registers with leader
  • unregister: Follower unregisters from leader
  • task_assignment: Leader assigns task to follower
  • task_complete: Follower reports task completion
  • status_update: Follower sends status update
  • status_request: Leader requests status from follower

Task Structure

Tasks are dictionaries with flexible structure:

task = {
    'description': 'Human-readable task description',
    'action': 'pickup',  # Type of action
    'position': (x, y),  # Optional: position data
    'duration': 1.0,     # Optional: simulated duration
    # Add any other task-specific data
}

Use Cases

  • Warehouse Automation: Coordinate multiple robots for picking and sorting
  • Assembly Lines: Manage bots performing different assembly tasks
  • Swarm Robotics Research: Test coordination algorithms
  • Educational Projects: Learn about distributed systems and robotics
  • Manufacturing: Coordinate multiple robotic arms for complex operations

Extending the System

Custom Bot Types

Extend the Bot base class to create specialized bots:

from bot import Bot, BotStatus

class CustomBot(Bot):
    def __init__(self, bot_id=None, name=None):
        super().__init__(bot_id, name)
        # Add custom initialization
    
    def process_message(self, message):
        # Add custom message handling
        pass

Custom Task Types

Add new task types by extending the task dictionary structure and implementing handlers in your bot's execute_task method.

Roadmap

  • Network-based communication (TCP/UDP) - Python module for TCP/UDP bot communication
  • REST API for remote control - Full REST API with agent control endpoints
  • Task priority system - Priority levels 1-5 with automatic sorting
  • Bot health monitoring - Heartbeat tracking and health status (healthy/degraded/unhealthy)
  • Task retry mechanism - Configurable retry limits with automatic retry logic
  • Visualization dashboard - Enhanced dashboard with health, priority, and history views
  • Persistent task history - Complete task history tracking with timestamps
  • Multi-leader support for large swarms - Distributed leader architecture (coming soon)

Web Platform Architecture

Tech Stack

  • Frontend: React 18 + Next.js 14
  • API: Next.js API Routes (serverless functions)
  • Styling: Inline CSS (zero dependencies)
  • State: In-memory data store (stateless, perfect for Vercel)
  • Deployment: Vercel (zero configuration)

Key Components

  1. Agent Registration (/api/agents/register)

    • Validates agent name and skills
    • Assigns unique ID
    • Tracks registration timestamp
  2. Task Dispatcher (lib/taskDispatcher.ts)

    • Skill-based matching algorithm
    • Auto-assigns tasks to available agents
    • Maintains task queue
  3. Payout System (/api/tasks/complete)

    • Triggers on task completion
    • Generates simulated transaction hash
    • Updates agent earnings
  4. Live Dashboard (pages/index.tsx)

    • Real-time stats (3-second refresh)
    • Agent management
    • Task monitoring
    • Payout history

Data Models

Agent {
  id: string
  name: string
  skills: string[]
  status: 'idle' | 'busy'
  tasksCompleted: number
  totalEarned: number
  walletAddress?: string
}

Task {
  id: string
  description: string
  requiredSkills: string[]
  status: 'pending' | 'assigned' | 'completed' | 'failed'
  assignedTo?: string
  reward: number
}

Payout {
  id: string
  agentId: string
  taskId: string
  amount: number
  status: 'pending' | 'completed'
  transactionHash?: string
}

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

This project is open source and available under the MIT License.

Authors

Created for coordinating claw bot swarms with extensible communication architecture.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors