Skip to content

rashidulas/peer12.0

Repository files navigation

🌐 Peer 12.0 - Intelligent Network Monitoring & Incident Response System

Next.js FastAPI Python TypeScript LiveKit

Enterprise-grade network monitoring with AI-powered analysis, real-time P2P mesh networking, and automated incident response workflows.

FetchAI agent

@insight-engine-agent @insight-engine-agent @peer-orchestrator-agent

🎯 Overview

Peer 12.0 is a sophisticated real-time network monitoring and incident response system designed for large venues, hackathons, conferences, and enterprise environments. It combines AI-powered analysis, P2P mesh networking, vector-based clustering, and automated multi-channel incident response.

✨ Key Features

  • πŸ€– AI-Powered Analysis - Claude Sonnet 4 for intelligent network insights
  • 🌐 Real-Time P2P Mesh - LiveKit WebRTC for collaborative monitoring
  • πŸ“Š Vector-Based Clustering - ChromaDB for intelligent network zone detection
  • 🚨 Automated Incident Response - Multi-channel alerts (Email, Jira, Slack)
  • 🏒 Venue-Aware Monitoring - Interactive floorplan with Wi-Fi signal overlay
  • πŸ“ˆ Real-Time Visualization - Advanced charts and heatmaps
  • πŸ”„ Distributed Agents - Location-specific network monitoring
  • ⚑ Speed Testing - Built-in network performance testing

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚   Backend       β”‚    β”‚   Data Layer    β”‚
β”‚   (Next.js)     │◄──►│   (FastAPI)     │◄──►│   (ChromaDB)    β”‚
β”‚   Dashboard     β”‚    β”‚   API Server    β”‚    β”‚   Vector Store  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
         β”‚              β”‚   AI Services   β”‚              β”‚
         └──────────────►│   (Claude)      β”‚β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚   Automation    β”‚
                        β”‚   (Composio)    β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • npm or yarn

1. Clone & Install

git clone <repository-url>
cd peer12.0

# Install Python dependencies
cd backend
pip install -r requirements.txt

# Install Node.js dependencies
cd ../dashboard
npm install

2. Environment Configuration

Create backend/.env:

# LiveKit Configuration
LIVEKIT_URL=wss://your-project.livekit.cloud
LIVEKIT_API_KEY=your_api_key
LIVEKIT_API_SECRET=your_api_secret

# AI Services
ANTHROPIC_API_KEY=your_anthropic_key

# Automation (Optional)
COMPOSIO_API_KEY=your_composio_key
COMPOSIO_ENTITY_ID=netagent-default
[email protected]
JIRA_PROJECT_KEY=NET
SLACK_CHANNEL=#connectivity-alerts

# ChromaDB (Optional - uses local by default)
CHROMA_API_KEY=your_chroma_key
CHROMA_HOST=https://api.trychroma.com

Create dashboard/.env.local:

NEXT_PUBLIC_API_URL=http://127.0.0.1:8000

3. Start Services

Backend (Terminal 1):

cd backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000

Frontend (Terminal 2):

cd dashboard
npm run dev

Optional - Telemetry Client (Terminal 3):

python3 client.py

4. Access the Application

πŸ“Š Dashboard Features

🏠 Main Dashboard

  • Real-Time Latency Chart - Live network performance with trend analysis
  • Venue Floorplan - Interactive Wi-Fi signal strength overlay
  • System Status - Service health monitoring
  • P2P Mesh Visualization - Connected devices and communication

πŸ”§ Tools Section

  • Speed Test Panel - Network performance testing
  • Alert Management - Incident response controls
  • Network Heatmap - Vector-based health clustering

πŸ“ˆ Advanced Visualizations

  • Interactive Charts - Recharts with smooth animations
  • Color-Coded Health Zones - Excellent β†’ Critical status indicators
  • Real-Time Updates - Live data refresh every 5 seconds
  • Responsive Design - Works on all screen sizes

πŸ”Œ API Endpoints

Core Endpoints

Method Endpoint Description
GET /health Comprehensive service health check
POST /telemetry Network metrics ingestion
GET /predict AI-powered network analysis
GET /token LiveKit authentication tokens

Action Endpoints

Method Endpoint Description
POST /actions/speedtest Run network speed test
POST /actions/send-alert Trigger incident response
POST /actions/save-logs Archive telemetry logs

Heatmap Endpoints

Method Endpoint Description
GET /heatmap/zones Get network health zones
GET /heatmap/similar Find similar network conditions

πŸ€– AI & Machine Learning

Claude AI Integration

  • Real-time Analysis - Continuous network condition assessment
  • Intelligent Recommendations - Contextual suggestions for network issues
  • Incident Response - Automated multi-step alert workflows
  • Threshold Detection - Smart alerting based on network patterns

Vector Database (ChromaDB)

  • 3D Embeddings - Latency, packet loss, and temporal factors
  • Similarity Search - Find devices with similar network conditions
  • Health Clustering - Automatic network zone detection
  • Temporal Analysis - Time-based pattern recognition

🌐 P2P Mesh Networking

LiveKit WebRTC Integration

  • Multi-Device Sync - Real-time collaboration across devices
  • Session Management - Stable connection handling
  • Message Broadcasting - Peer-to-peer communication
  • Auto-Reconnection - Robust connection recovery

Agent System

  • Distributed Monitoring - Location-specific network agents
  • Peer Coordination - Agent-to-agent communication
  • Automatic Telemetry - Continuous network measurement
  • Alert Broadcasting - Real-time issue propagation

🚨 Incident Response System

Multi-Channel Automation

  1. Email Alerts - Gmail API integration
  2. Jira Tickets - Automatic issue creation
  3. Slack Notifications - Team channel alerts
  4. Rate Limiting - Prevents alert spam
  5. Contextual Data - Rich incident information

Alert Triggers

  • High Latency - Configurable thresholds (default: 200ms)
  • Packet Loss - Critical loss detection (default: 10%)
  • Service Degradation - AI-detected patterns
  • Manual Triggers - On-demand alerting

πŸ› οΈ Technical Stack

Frontend

  • Next.js 16 - React framework with Turbopack
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first styling
  • Recharts - Data visualization
  • Radix UI - Accessible components

Backend

  • FastAPI - High-performance Python API
  • Uvicorn - ASGI server
  • Pydantic - Data validation
  • Python 3.11 - Modern Python features

Data & AI

  • ChromaDB - Vector database
  • Anthropic Claude - AI analysis
  • Composio - Multi-service automation
  • LiveKit - Real-time communication

Monitoring

  • Ping3 - Network latency measurement
  • Custom Agents - Distributed monitoring
  • WebSocket - Real-time updates
  • REST API - Standard HTTP interface

πŸ“ Project Structure

peer12.0/
β”œβ”€β”€ backend/                 # FastAPI backend
β”‚   β”œβ”€β”€ main.py             # Main API server
β”‚   β”œβ”€β”€ ai_agent.py         # Claude AI integration
β”‚   β”œβ”€β”€ chroma_service.py   # Vector database
β”‚   β”œβ”€β”€ telemetry.py        # Metrics collection
β”‚   └── requirements.txt    # Python dependencies
β”œβ”€β”€ dashboard/              # Next.js frontend
β”‚   β”œβ”€β”€ app/               # App router pages
β”‚   β”œβ”€β”€ components/        # React components
β”‚   β”œβ”€β”€ lib/              # Utilities & contexts
β”‚   └── package.json      # Node dependencies
β”œβ”€β”€ agents/                # Distributed agents
β”‚   β”œβ”€β”€ agent_base.py     # Base agent class
β”‚   β”œβ”€β”€ agent_alpha.py    # Alpha agent
β”‚   β”œβ”€β”€ agent_beta.py     # Beta agent
β”‚   └── run_agents.py     # Agent runner
β”œβ”€β”€ client.py             # Simple telemetry client
└── README.md            # This file

πŸ”§ Configuration

Environment Variables

Backend (.env)

# Required
LIVEKIT_URL=wss://your-project.livekit.cloud
LIVEKIT_API_KEY=your_api_key
LIVEKIT_API_SECRET=your_api_secret
ANTHROPIC_API_KEY=your_anthropic_key

# Optional
COMPOSIO_API_KEY=your_composio_key
[email protected]
JIRA_PROJECT_KEY=NET
SLACK_CHANNEL=#connectivity-alerts
CHROMA_API_KEY=your_chroma_key

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://127.0.0.1:8000

πŸš€ Deployment

Development

# Backend
cd backend && uvicorn main:app --reload

# Frontend
cd dashboard && npm run dev

Production

# Build frontend
cd dashboard && npm run build

# Start backend
cd backend && uvicorn main:app --host 0.0.0.0 --port 8000

πŸ§ͺ Testing

Health Check

curl http://localhost:8000/health | jq

Send Test Telemetry

curl -X POST http://localhost:8000/telemetry \
  -H "Content-Type: application/json" \
  -d '{"deviceId":"test","latency":50,"packetLoss":0}'

Test AI Analysis

curl http://localhost:8000/predict | jq

πŸ› Troubleshooting

Common Issues

Backend won't start:

# Check port availability
lsof -i :8000

# Verify dependencies
cd backend && pip install -r requirements.txt

Frontend can't connect:

# Test backend connectivity
curl http://localhost:8000/

# Check environment variables
cat dashboard/.env.local

LiveKit connection fails:

# Test token generation
curl "http://localhost:8000/token?identity=test" | jq

# Verify credentials in .env

πŸ“ˆ Performance

Benchmarks

  • API Response Time: < 50ms average
  • Real-Time Updates: 5-second intervals
  • Concurrent Users: 100+ supported
  • Data Retention: Configurable (default: 20 readings)

Optimization

  • Caching: AI predictions cached for 30 seconds
  • Rate Limiting: Prevents API abuse
  • Connection Pooling: Efficient database connections
  • Lazy Loading: On-demand component loading

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

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

πŸ™ Acknowledgments

  • LiveKit - Real-time communication platform
  • Anthropic - Claude AI capabilities
  • ChromaDB - Vector database technology
  • Composio - Multi-service automation
  • Next.js - React framework
  • FastAPI - Python web framework

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors