Skip to content

A powerful, production-ready hierarchical multi-agent framework with a visual builder for creating, orchestrating, and deploying AI agent systems. Built with TypeScript, Next.js 16, and featuring a drag-and-drop workflow canvas.

License

Notifications You must be signed in to change notification settings

willnapolinighub/Multi-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Multi-Agent System

A powerful, production-ready hierarchical multi-agent framework with a visual builder for creating, orchestrating, and deploying AI agent systems. Built with TypeScript, Next.js 16, and featuring a drag-and-drop workflow canvas.

License TypeScript Next.js

✨ Features

πŸ—οΈ Hierarchical Architecture

  • Master Orchestrator: Coordinates complex tasks across specialized sub-agents
  • Sub-Orchestrators: Domain-specific coordinators (Analytics, Research, Content)
  • Specialist Agents: Focused tools for specific operations
  • Intelligent Delegation: Automatic task routing based on domain expertise

🎨 Visual Builder

  • n8n-style Canvas: Drag-and-drop interface for creating agent workflows
  • Node Palette: Pre-built nodes for triggers, agents, tools, and logic
  • Properties Panel: Configure nodes with rich form controls
  • Code Generation: Export visual workflows to production-ready TypeScript

πŸ”Œ Multi-Provider AI Support

Provider Models Features
OpenAI GPT-4o, GPT-4 Turbo Full tool calling support
Ollama Llama, Mistral, Qwen Run locally, zero API costs
OpenRouter Claude, Gemini, GPT Multi-model gateway
n8n Custom workflows Integration with automation
AgentRouter Auto-routing Intelligent model selection
Custom Any OpenAI-compatible Bring your own API

πŸ› οΈ 15+ Built-in Tools

Analytics Tools:

  • Statistical Analysis
  • Trend Detection
  • Data Comparison
  • Correlation Analysis
  • Forecasting

Research Tools:

  • Web Search
  • Content Extraction
  • Summarization
  • Fact Verification

Content Tools:

  • Report Generation
  • Content Formatting
  • Translation
  • Sentiment Analysis

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ or Bun
  • npm, yarn, pnpm, or bun

Installation

# Clone the repository
git clone https://github.com/yourusername/multi-agent-system.git
cd multi-agent-system

# Install dependencies
bun install

# Set up environment variables
cp .env.example .env.local

# Start development server
bun run dev

Open http://localhost:3000 to see the application.

Environment Variables

# Required: OpenAI API Key (for z-ai-web-dev-sdk)
OPENAI_API_KEY=your_openai_api_key

# Optional: Other provider API keys
OLLAMA_BASE_URL=http://localhost:11434
OPENROUTER_API_KEY=your_openrouter_key
N8N_WEBHOOK_URL=http://localhost:5678/webhook
CUSTOM_AI_API_KEY=your_custom_key

πŸ“– Documentation

Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      User Interface                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Landing Pageβ”‚  β”‚  Agent App  β”‚  β”‚   Visual Builder    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                       API Layer                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ /api/agents   β”‚  β”‚ /api/settings β”‚  β”‚ /api/analytics β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Agent System Core                          β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚              Master Orchestrator                     β”‚    β”‚
β”‚  β”‚    (Plans, Coordinates, Aggregates Results)         β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚              β”‚              β”‚              β”‚                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   Analytics    β”‚ β”‚   Research   β”‚ β”‚     Content     β”‚   β”‚
β”‚  β”‚  Orchestrator  β”‚ β”‚ Orchestrator β”‚ β”‚  Orchestrator   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚           β”‚                β”‚                 β”‚              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”      β”‚
β”‚  β”‚ Analytics   β”‚    β”‚  Research   β”‚   β”‚   Content   β”‚      β”‚
β”‚  β”‚   Tools     β”‚    β”‚   Tools     β”‚   β”‚   Tools     β”‚      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Provider Layer                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ OpenAI  β”‚ β”‚ Ollama  β”‚ β”‚OpenRouter β”‚ β”‚  n8n   β”‚ β”‚Customβ”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Creating Agents

Using Code

import { MasterOrchestrator, AnalyticsOrchestrator } from '@/lib/agents';

// Create a master orchestrator
const master = new MasterOrchestrator({
  id: 'master-1',
  name: 'Task Coordinator',
  description: 'Main orchestrator for complex tasks',
  role: 'master_orchestrator',
  domain: 'general',
  model: 'gpt-4o',
});

// Execute a task
const result = await master.execute('Analyze Q4 sales and create a report');

Using Visual Builder

  1. Open the app and click "Launch App"
  2. Switch to the "Build" tab
  3. Drag nodes from the palette onto the canvas
  4. Connect nodes to define workflow
  5. Configure each node's properties
  6. Click "Generate Code" to export TypeScript

Adding Custom Tools

// src/lib/agents/tools/custom.ts
import { Tool } from '@/lib/agents/core/types';

export const customTool: Tool = {
  definition: {
    name: 'my_custom_tool',
    description: 'Does something specific',
    parameters: {
      input: {
        type: 'string',
        description: 'Input parameter',
        required: true,
      },
    },
  },
  execute: async (params) => {
    // Your custom logic here
    return {
      success: true,
      data: { result: 'Processed: ' + params.input },
    };
  },
};

API Endpoints

Endpoint Method Description
/api/agents POST Execute master orchestrator
/api/agents/analytics POST Execute analytics agent
/api/agents/research POST Execute research agent
/api/agents/content POST Execute content agent
/api/settings GET/POST Manage provider settings

Example API Usage

# Execute a task
curl -X POST http://localhost:3000/api/agents \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Analyze the latest market trends",
    "context": { "industry": "technology" }
  }'

πŸ› οΈ Tech Stack

  • Framework: Next.js 16 (App Router)
  • Language: TypeScript 5
  • Styling: Tailwind CSS 4 + shadcn/ui
  • State Management: Zustand
  • Visual Builder: ReactFlow
  • Animations: Framer Motion
  • AI SDK: z-ai-web-dev-sdk (OpenAI compatible)

πŸ“ Project Structure

src/
β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”œβ”€β”€ api/                      # API Routes
β”‚   β”‚   β”œβ”€β”€ agents/               # Agent endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ route.ts          # Master orchestrator
β”‚   β”‚   β”‚   β”œβ”€β”€ analytics/        # Analytics agent
β”‚   β”‚   β”‚   β”œβ”€β”€ research/         # Research agent
β”‚   β”‚   β”‚   └── content/          # Content agent
β”‚   β”‚   └── settings/             # Settings management
β”‚   β”œβ”€β”€ layout.tsx                # Root layout
β”‚   β”œβ”€β”€ page.tsx                  # Main entry (Landing β†’ App)
β”‚   └── globals.css               # Global styles
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/                       # shadcn/ui components
β”‚   β”œβ”€β”€ builder/                  # Visual builder components
β”‚   β”‚   └── VisualBuilder.tsx     # Main canvas component
β”‚   β”œβ”€β”€ landing/                  # Landing page components
β”‚   β”‚   β”œβ”€β”€ LandingPage.tsx       # Marketing page
β”‚   β”‚   └── ThemeProvider.tsx     # Dark/light theme
β”‚   β”œβ”€β”€ MainApp.tsx               # Main application
β”‚   β”œβ”€β”€ PageWrapper.tsx           # Page wrapper with providers
β”‚   └── SettingsDialog.tsx        # Settings modal
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ agents/                   # Agent system core
β”‚   β”‚   β”œβ”€β”€ core/                 # Base classes and types
β”‚   β”‚   β”‚   β”œβ”€β”€ Agent.ts          # Base agent class
β”‚   β”‚   β”‚   β”œβ”€β”€ Orchestrator.ts   # Orchestrator base
β”‚   β”‚   β”‚   └── types.ts          # Type definitions
β”‚   β”‚   β”œβ”€β”€ orchestrators/        # Specialized orchestrators
β”‚   β”‚   β”‚   β”œβ”€β”€ MasterOrchestrator.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ AnalyticsOrchestrator.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ ResearchOrchestrator.ts
β”‚   β”‚   β”‚   └── ContentOrchestrator.ts
β”‚   β”‚   β”œβ”€β”€ providers/            # AI provider implementations
β”‚   β”‚   β”‚   β”œβ”€β”€ types.ts          # Provider types
β”‚   β”‚   β”‚   β”œβ”€β”€ store.ts          # Settings store
β”‚   β”‚   β”‚   β”œβ”€β”€ OpenAIProvider.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ OllamaProvider.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ OpenRouterProvider.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ N8nProvider.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ AgentRouterProvider.ts
β”‚   β”‚   β”‚   └── CustomProvider.ts
β”‚   β”‚   └── tools/                # Built-in tools
β”‚   β”‚       β”œβ”€β”€ analytics.ts      # Analytics tools
β”‚   β”‚       β”œβ”€β”€ research.ts       # Research tools
β”‚   β”‚       └── content.ts        # Content tools
β”‚   β”‚
β”‚   β”œβ”€β”€ builder/                  # Visual builder core
β”‚   β”‚   β”œβ”€β”€ types.ts              # Builder types
β”‚   β”‚   β”œβ”€β”€ store.ts              # Builder state
β”‚   β”‚   β”œβ”€β”€ codeGenerator.ts      # Visual β†’ Code
β”‚   β”‚   └── nodes/                # Custom ReactFlow nodes
β”‚   β”‚
β”‚   β”œβ”€β”€ db.ts                     # Database client
β”‚   └── utils.ts                  # Utility functions
β”‚
└── hooks/                        # Custom React hooks
    β”œβ”€β”€ use-mobile.ts
    └── use-toast.ts

πŸš€ Deployment

Vercel (Recommended)

Deploy with Vercel

  1. Push your code to GitHub
  2. Import your repository on Vercel
  3. Set environment variables
  4. Deploy!

Docker

# Dockerfile
FROM oven/bun:1 AS base
WORKDIR /app

# Install dependencies
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile

# Copy source
COPY . .

# Build
RUN bun run build

# Expose port
EXPOSE 3000

# Start
CMD ["bun", "start"]
docker build -t multi-agent-system .
docker run -p 3000:3000 multi-agent-system

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Clone and install
git clone https://github.com/yourusername/multi-agent-system.git
cd multi-agent-system
bun install

# Run development server
bun run dev

# Run linting
bun run lint

# Build for production
bun run build

Project Scripts

Script Description
bun run dev Start development server
bun run build Build for production
bun run start Start production server
bun run lint Run ESLint
bun run db:push Push Prisma schema
bun run db:generate Generate Prisma client

πŸ“„ License

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

πŸ™ Acknowledgments

πŸ“ž Support


Built with ❀️ by Will Napolini & Community. Powered by AI.

About

A powerful, production-ready hierarchical multi-agent framework with a visual builder for creating, orchestrating, and deploying AI agent systems. Built with TypeScript, Next.js 16, and featuring a drag-and-drop workflow canvas.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages