How meshag-ai/meshag works
Project type and purpose
• This is a Rust-based, event-driven, distributed microservices application called MeshAG.
• Its goal is to orchestrate AI agents (STT, LLM, TTS) in real-time conversational scenarios over WebRTC, using NATS JetStream for messaging and a Redis-compatible Valkey store for configuration.
File structure
• Top-level workspace with multiple Cargo crates under /crates and /services.
• crates/connectors: Connector traits and provider implementations (OpenAI, Deepgram, ElevenLabs, Twilio, Daily.co, etc.)
• crates/orchestrator: Core pipeline router and configuration logic
• crates/service-common: Shared HTTP server setup, request handlers, types
• crates/shared: Cross-service utilities, queue abstractions
• /services: Four independent binaries, each in its own Rust project:
• stt-service (port 8081)
• llm-service (port 8082)
• tts-service (port 8083)
• transport-service (port 8084)
• Docker directory holds Dockerfiles per service and docker-compose.yml for local infra (NATS, Valkey, metrics).
README for additional insights
• Client App ↔ Transport Service ↔ Daily.co API
• Transport → Valkey → NATS JetStream → [STT, LLM, TTS] → back through pipeline.
• Key technologies: NATS JetStream, Valkey (Redis), Daily.co (WebRTC), pluggable connectors.
Detailed capture of essential elements
• Service ports, protocol (HTTP, WebSocket, Pub/Sub), config store TTL cleanup, pipeline routing logic.
• “pipeline flow” ordering: transport → stt → llm → tts → transport.