This guide helps you build, run, and experiment with InferMesh locally. It covers both mock deployments for testing and real GPU deployments.
- Rust (latest stable via rustup)
- Protobuf compiler (
protoc) - Docker (optional, for container builds)
- NVIDIA GPU drivers + CUDA toolkit (for real GPU nodes)
- DCGM (for GPU telemetry) – optional in mock mode
git clone https://github.com/redbco/infermesh.git
cd infermesh# Build all crates
cargo build --release
# Or build just agent and router
cargo build --release -p mesh-agent -p mesh-routerThe binaries will be in target/release/.
Start a single node with default configuration:
# Start the mesh agent daemon
cargo run -p mesh-agent -- start
# The agent will start with mock adapters by default
# - Mock GPU telemetry (simulates NVIDIA GPUs)
# - Mock runtime adapters (simulates vLLM, Triton, TGI)
# - Control plane API on port 50051
# - Metrics endpoint on port 9090Interact with the mesh:
# List nodes in the mesh
cargo run -p mesh-cli -- list-nodes
# Get mesh statistics
cargo run -p mesh-cli -- stats
# Check health status
cargo run -p mesh-cli -- health
# Check metrics
curl http://127.0.0.1:9090/metricsYou can run multiple agents locally using configuration files:
# Terminal 1: First node
cargo run -p mesh-agent -- start --config examples/node1.yaml
# Terminal 2: Second node
cargo run -p mesh-agent -- start --config examples/node2.yaml
# Terminal 3: Third node (router-only)
cargo run -p mesh-agent -- start --config examples/router.yamlCheck cluster membership:
# List all nodes in the mesh
cargo run -p mesh-cli -- list-nodes
# Get detailed node information
cargo run -p mesh-cli -- describe-node node1
# Monitor cluster statistics
cargo run -p mesh-cli -- statsBuild container images:
docker build -t infermesh-agent -f Dockerfile.agent .
docker build -t infermesh-router -f Dockerfile.router .Run with Docker Compose (see examples/compose.yml):
docker-compose upOn GPU-capable hosts:
- Install NVIDIA drivers + CUDA toolkit
- Install your inference runtime (Triton, vLLM, or TGI)
- Optional: Install DCGM for enterprise GPU monitoring
Create a configuration file (gpu-node.yaml):
node:
id: "gpu-node-1"
roles: ["gpu"]
adapters:
runtime:
- type: "triton"
endpoint: "http://localhost:8000"
health_check_interval: 30
- type: "vllm"
endpoint: "http://localhost:8001"
health_check_interval: 30
gpu:
- type: "nvml"
collection_interval: 10
# OR for enterprise setups:
# - type: "dcgm"
# dcgm_socket: "/var/run/dcgm.sock"Start the agent:
cargo run -p mesh-agent -- start --config gpu-node.yamlOn router hosts, create router-node.yaml:
node:
id: "router-1"
roles: ["router"]
router:
listen_address: "0.0.0.0:8080"
health_check_interval: 15
connection_pool_size: 100Start the router:
cargo run -p mesh-agent -- start --config router-node.yamlNow inference requests to the router will be intelligently routed to the best available GPU node based on real-time telemetry.
All components expose metrics at /metrics:
- Router: request/latency metrics
- Agent: gossip, Raft, control-plane metrics
- Adapters: runtime queue depth, GPU utilization
Use the example dashboards in DASHBOARDS.md.
Enable OpenTelemetry export:
RUST_LOG=info OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 cargo run -p mesh-agent -- --otelThe CLI provides comprehensive mesh management capabilities:
# Node management
cargo run -p mesh-cli -- list-nodes
cargo run -p mesh-cli -- describe-node <node-id>
# Model management
cargo run -p mesh-cli -- pin-model <model-name> --nodes node1,node2
cargo run -p mesh-cli -- unpin-model <model-name>
cargo run -p mesh-cli -- list-pins
# Monitoring
cargo run -p mesh-cli -- stats
cargo run -p mesh-cli -- health
# Event streaming
cargo run -p mesh-cli -- subscribe-events
# Configuration
cargo run -p mesh-cli -- config --helpAll commands support JSON output for automation:
cargo run -p mesh-cli -- list-nodes --output json
cargo run -p mesh-cli -- stats --json- Explore the ARCHITECTURE.md for a deeper dive.
- Try running with a real runtime like Triton or vLLM.
- Deploy in Kubernetes using a DaemonSet for
mesh-agentand a Deployment formesh-router. - Build custom Grafana dashboards using PromQL queries from DASHBOARDS.md.
- Metrics endpoint not found: check
--metricsflag when starting agents. - GPU telemetry missing: ensure DCGM is installed and running.
- Gossip membership issues: open UDP/TCP ports used by agents (default 7946/7947).
- Control-plane writes blocked: ensure Raft quorum is available (3+ agents recommended).
Happy hacking with InferMesh 🚀