5048db99c78bafe8fd66f07e94549336420c6c22
AgentCoordinator
A distributed task coordination system for AI agents built with Elixir and NATS.
Overview
AgentCoordinator is a centralized task management system designed to enable multiple AI agents (Claude Code, GitHub Copilot, etc.) to work collaboratively on the same codebase without conflicts. It provides:
- Distributed Task Management: Centralized task queue with agent-specific inboxes
- Conflict Resolution: File-level locking prevents agents from working on the same files
- Real-time Communication: NATS messaging for instant coordination
- Persistent Storage: Event sourcing with configurable retention policies
- MCP Integration: Model Context Protocol server for agent communication
- Fault Tolerance: Elixir supervision trees ensure system resilience
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ AI Agent 1 │ │ AI Agent 2 │ │ AI Agent N │
│ (Claude Code) │ │ (Copilot) │ │ ... │
└─────────┬───────┘ └─────────┬────────┘ └─────────┬───────┘
│ │ │
└──────────────────────┼───────────────────────┘
│
┌─────────────┴──────────────┐
│ MCP Server Interface │
└─────────────┬──────────────┘
│
┌─────────────┴──────────────┐
│ AgentCoordinator │
│ │
│ ┌──────────────────────┐ │
│ │ Task Registry │ │
│ │ ┌──────────────┐ │ │
│ │ │ Agent Inbox │ │ │
│ │ │ Agent Inbox │ │ │
│ │ │ Agent Inbox │ │ │
│ │ └──────────────┘ │ │
│ └──────────────────────┘ │
│ │
│ ┌──────────────────────┐ │
│ │ NATS Messaging │ │
│ └──────────────────────┘ │
│ │
│ ┌──────────────────────┐ │
│ │ Persistence │ │
│ │ (JetStream) │ │
│ └──────────────────────┘ │
└────────────────────────────┘
Installation
Prerequisites
- Elixir 1.16+ and Erlang/OTP 28+
- NATS server (with JetStream enabled)
Setup
-
Install Dependencies
mix deps.get -
Start NATS Server
# Using Docker docker run -p 4222:4222 -p 8222:8222 nats:latest -js # Or install locally and run nats-server -js -
Configure Environment
export NATS_HOST=localhost export NATS_PORT=4222 -
Start the Application
iex -S mix
Usage
Command Line Interface
# Register an agent
mix run -e "AgentCoordinator.CLI.main([\"register\", \"CodeBot\", \"coding\", \"testing\"])"
# Create a task
mix run -e "AgentCoordinator.CLI.main([\"create-task\", \"Fix login bug\", \"User login fails\", \"priority=high\"])"
# View task board
mix run -e "AgentCoordinator.CLI.main([\"board\"])"
MCP Integration
Available MCP tools for agents:
register_agent- Register a new agentcreate_task- Create a new taskget_next_task- Get next task for agentcomplete_task- Mark current task completeget_task_board- View all agent statusesheartbeat- Send agent heartbeat
Description
Languages
Elixir
91.6%
Shell
5.5%
Python
2.6%
Dockerfile
0.3%