labman is an open-source, operator-friendly node for a p2p AI mesh.
It turns one or more local LLM runtimes (via Portman) into a provider in a decentralised network where:
This README describes the new mesh-based, conplane-less architecture and points to deeper design docs:
protocol.md – Portman ↔ labman protocol and mesh message formatseconomics.md – economics, FEPs, receipts, and payoutsThe goal is that this README + architecture.md + protocol.md +
economics.md in the repo root can stand alone without requiring any
additional docs.
In the current design, labman is not a thin agent talking to a central control plane. Instead, each labman instance is a full mesh peer:
There are three architectural roles:
Gateway labman
/v1/chat/completions, etc.) on a
public endpoint (e.g. --public-endpoint),Provider labman
Front-End Portal (FEP)
Portman is the local LLM runner:
labman is responsible for:
Mesh participation
Gateway behaviour (if configured)
Provider behaviour (if configured)
Operator ergonomics
labmand),labman explicitly does not:
The only remotely exercised behaviours are the ones described by:
protocol.md), andThe mesh is provided by a set of logical subsystems often referred to as labnet:
Each labman node has a long-lived keypair:
node_id is derived from the public key,sender_node_id matches the key,This enables:
The transport layer provides:
The exact implementation (e.g. libp2p/QUIC/custom) is an internal concern, but from the outside you can rely on:
stream-oriented messaging (ProxyRequest / ProxyResponse),
clear ownership of each stream by a (gateway, provider) pair,
separation between:
Labman maintains an eventually-consistent view of the mesh via signed gossip
messages (see the mesh section of protocol.md):
GossipPeers – who exists; addresses; roles; public endpoints.GossipCapabilities – what models each node can/does host; capacity and
pricing hints; payout currencies/addresses.GossipMarket – demand snapshots and utilisation for models.Gossip is:
small and periodic (seconds-scale),
merged into local peer and market views,
used by:
labman-market) to decide which models to keep warm.Client sends a standard OpenAI-style request to a gateway:
POST https://gateway.example/v1/chat/completions
Authorization: Bearer <api-key-from-FEP>
{
"model": "tenant:ep:model",
"messages": [...],
"stream": true
}
Gateway labman:
Gateway selects candidate providers from its mesh view:
tenant:ep:model (or compatible),Gateway ranks candidates by:
Gateway initiates a p2p stream to the chosen provider and sends a
ProxyRequest message which includes:
request_id,fep_id),Provider labman:
ProxyError (e.g. MODEL_NOT_AVAILABLE).Provider uses the local Portman protocol to:
Provider sends one or more ProxyResponse messages back over the p2p
stream, each containing an OpenAI-style chunk.
Gateway forwards these chunks to the end-user as a normal OpenAI streaming response.
When the job completes:
ProxyResponse, orReceiptDelivery message.Provider verifies the receipt signature and economic fields, and stores it durably for future payouts.
Detailed message schemas are in protocol.md (mesh section).
The economics layer is specified in economics.md.
Key points:
receipt_id, fep_id, provider_node_id, gateway_node_id,Providers:
labman’s role in economics is to:
Settlement details (mock FEP for MVP, real payouts later) live in
economics.md.
Portman remains the local LLM orchestrator.
labman’s Portman-facing responsibilities:
LoadModel(model_id, priority),UnloadModel(model_id, reason),SetConcurrency or equivalent,The labman-market subsystem performs the hosting decision logic, based on:
This keeps Portman simple and allows the mesh economy to adapt dynamically without any central controller.
The workspace is organised into crates aligned with the mesh design. Names are
indicative; check Cargo.toml for the exact list.
bin/labmand/ # main daemon
bin/labman-cli/ # CLI for operators
crates/
labman-core/ # shared types, node/model descriptors, errors
labman-config/ # config loading and validation
labman-telemetry/ # logging, tracing, metrics hooks
labman-labnet-core/ # node identity, peer store, protocol message defs
labman-labnet-transport/
# encrypted p2p transport and streams
labman-labnet-gossip/
# peers, capabilities, market gossip
labman-gateway/ # OpenAI HTTP server + routing into the mesh
labman-market/ # hosting decision engine (local/mesh demand)
labman-economics/ # provider payout config, receipt verification, claims
labman-portman-ws/ # Portman WebSocket client/server integration
architecture.md # mesh-based architecture & security design (root)
protocol.md # Portman ↔ labman and mesh-level protocol
economics.md # economics layer, FEPs, receipts, and claims
economics-and-portals.md
# FEPs, receipts, payouts, claims
Over time, any conplane-specific crates or references should be either removed or repurposed to fit this mesh-first picture.
The full mesh implementation is in progress, but the intended operator experience is:
Install labmand and labman-cli (binaries or container).
Write a config file (e.g. /etc/labman/labman.toml) that defines:
Start the daemon:
sudo systemctl enable --now labmand
Use labman-cli to:
Implementation details and exact CLI arguments will evolve, but the one daemon + one config + one CLI shape is stable.
Earlier versions of this repository assumed:
That design has been superseded by the mesh-based architecture described in this README and in:
architecture.mdprotocol.mdeconomics.mdAny remaining references to Conplane, central control-plane APIs, or WG-based per-node tunnels are historical context only and should be updated or removed as the mesh implementation progresses.
MIT
39 activities