Poly Series
PolyMesh
Open protocol for agent-to-agent communication. Agents discover each other, exchange capabilities, and delegate tasks. Local-first, no internet required. (MIT)
Quick start
Start with the primary command, then continue with the full workflow below.
npx @latticeag/create-polymesh-app my-agentsProblem
AI agents live in silos. Hermes, Codex, Claude Code, Cursor, and custom-built agents each speak their own internal protocols, and there is no standard way for two agents on the same laptop - let alone the same LAN - to discover each other, ask what can you do, and delegate a task. Every agent-to-agent integration today means writing custom glue code, standing up cloud infrastructure, configuring webhooks, and managing API keys. Internet-scale standards (A2A and similar) require HTTPS, DNS, TLS, OAuth, and a public endpoint - none of which exist on a developer's laptop or in an air-gapped environment. The result: agent meshes don't exist outside of demos, and every agent is an island.
Solution
PolyMesh is an open protocol for agent-to-agent communication designed from the ground up for local-first, zero-infrastructure coordination. Agents discover each other through a lightweight broker (WebSocket on the LAN or loopback), negotiate capability contracts via typed Agent Cards, and exchange bounded tasks with verified lifecycle events (submitted, accepted, progress, completed/failed). The architecture is layered: application code -> application layer (task lifecycle, contracts, validation) -> envelope layer (JSON records, deadlines) -> handshake layer (hello, card, auth, ready) -> framing layer (bounded text frames) -> transport (loopback WS or enrolled WSS). The reference implementation ships as MIT-licensed TypeScript packages - @latticeag/polymesh-broker, @latticeag/polymesh-client, plus adapters for A2A, MCP, ACP, OpenTelemetry, and agent-native payments. Any agent framework can implement the spec; a Python SDK (latticeag-polymesh) is also published. No cloud, no DNS, no API keys required for the local path.
How it works
Create a new project from the starter template: npx @latticeag/create-polymesh-app my-agents, then cd my-agents && npm install && npm run demo - the demo starts a local broker and client, exchanges a safe ping/pong, and exits cleanly.
Start a broker: one agent runs npm i -g @latticeag/polymesh-client, then polymesh broker start (loopback WebSocket; TLS-required enrolled WSS for non-loopback).
Connect agents and register capability cards: polymesh agent connect --capabilities my-cap.json publishes the agent's card (agent_id, display name, typed input/output JSON Schemas per capability) to the broker's in-memory registry.
Discover the mesh: polymesh mesh list returns every connected agent with its full capability cards - no polling, no registry files, no manual endpoint configuration.
Delegate a task: polymesh task submit --target <agent-id> --capability <cap> --payload '{"...":"..."}' routes a bounded task to the target's registered capability. The lifecycle is deterministic: submit, accept or reject, progress (zero or more), complete or cancel, with at-least-once delivery using idempotency keys.
For a process-boundary demonstration with multiple agents, docker compose up --build prints the broker, Alice, and Bob lifecycle and exits when Alice receives Bob's echo result.
Across machines or the internet, the polyMesh Gateway (separate repo) provides a Cloudflare Workers relay for enrolled WSS meshes - local is always optional, never required.
Technical architecture
Each handoff carries structured context through the product's execution path. Hover a node to inspect its role.
01
Broker Start
02
Agent Connection
03
Agent Card Exchange
04
Capability Query
05
Task Submission
06
Accept/Reject
07
Progress Stream
08
Completion
Protocol comparison
Where PolyMesh fits
Select a protocol to compare its role in an agent system. These approaches can be complementary rather than mutually exclusive.
Primary interaction
Capability calls between connected agents
Discovery focus
Discover callable capabilities in a local mesh
Best suited to
Local, multi-agent capability delegation
Where it fits
The execution path between specialist agents
When to use
- Running multiple agents (Hermes, Codex, Claude Code, Cursor) on the same machine that need to hand off tasks to each other.
- Building a local agent mesh in an air-gapped, offline, or sensitive environment where no internet traffic is permitted.
- Multi-agent workflows where coordination latency matters - persistent connections avoid HTTP round-trip overhead.
- Prototyping agent-to-agent delegation without provisioning any infrastructure - no DNS, no TLS, no API gateway.
- Framework-agnostic setups where your agents are built with different tools and need a common wire protocol.
- Teams that want agents to self-discover capabilities instead of hardcoding endpoint URLs in configuration files.
Not for
- Cross-organization agent communication over the public internet without an enrolled gateway - use the polyMesh Gateway relay or the A2A dialect adapter for internet-scale meshes.
- Simple single-agent tool-calling patterns that don't need inter-agent delegation.
- Production deployments requiring a fully hardened security profile - PolyMesh is experimental and explicitly documents its security limitations in SECURITY.md.
Features
Agent Cards - typed capability declarations with JSON Schema input/output contracts
Lightweight broker - in-memory registry and message routing, no cloud dependency
Local-first - works fully offline on loopback WS; cloud is optional, never required
Deterministic task lifecycle - submitted, accepted, rejected, progress, completed, failed
At-least-once delivery with idempotency keys for bounded tasks
Capability-based discovery - agents find each other by what they can do, not by address
Layered protocol - application, envelope, handshake, framing, and transport separation
Framework-agnostic - any language, any runtime, any agent framework can implement the spec
Transport modes - loopback WS for dev, enrolled WSS with TLS and mutual enrollment for non-loopback
Security by default - explicit opt-in for non-loopback transport, owner-only tokens for local sessions
Ecosystem adapters - @latticeag/polymesh-a2a (A2A dialect), polymesh-mcp (MCP bridge), polymesh-acp (editor UI), polymesh-otel (OpenTelemetry mapping), polymesh-pay (agent-native payments)
Starter template - npx @latticeag/create-polymesh-app for a working demo in seconds
Python SDK - latticeag-polymesh (import as polymesh) alongside the TypeScript packages
MIT license - fully open source reference implementation
Install and usage
# Create a new project from the starter template
npx @latticeag/create-polymesh-app my-agents
cd my-agents
npm install
npm run demo
# Install the CLI
npm i -g @latticeag/polymesh-client
# Start a broker
polymesh broker start
# Connect an agent with a capability card
polymesh agent connect --capabilities my-cap.json
# List agents in the mesh
polymesh mesh list
# Submit a task to another agent
polymesh task submit --target <agent-id> --capability <cap> --payload '{"...":"..."}'
# Process-boundary demo with multiple agents
docker compose up --buildArchitecture explorer
Problem
AI agents live in silos. Hermes, Codex, Claude Code, Cursor, and custom-built agents each speak their own internal protocols, and there is no standard way for two agents on the same laptop - let alone the same LAN - to discover each other, ask what can you do, and delegate a task. Every agent-to-agent integration today means writing custom glue code, standing up cloud infrastructure, configuring webhooks, and managing API keys. Internet-scale standards (A2A and similar) require HTTPS, DNS, TLS, OAuth, and a public endpoint - none of which exist on a developer's laptop or in an air-gapped environment. The result: agent meshes don't exist outside of demos, and every agent is an island.
Solution
PolyMesh is an open protocol for agent-to-agent communication designed from the ground up for local-first, zero-infrastructure coordination. Agents discover each other through a lightweight broker (WebSocket on the LAN or loopback), negotiate capability contracts via typed Agent Cards, and exchange bounded tasks with verified lifecycle events (submitted, accepted, progress, completed/failed). The architecture is layered: application code -> application layer (task lifecycle, contracts, validation) -> envelope layer (JSON records, deadlines) -> handshake layer (hello, card, auth, ready) -> framing layer (bounded text frames) -> transport (loopback WS or enrolled WSS). The reference implementation ships as MIT-licensed TypeScript packages - @latticeag/polymesh-broker, @latticeag/polymesh-client, plus adapters for A2A, MCP, ACP, OpenTelemetry, and agent-native payments. Any agent framework can implement the spec; a Python SDK (latticeag-polymesh) is also published. No cloud, no DNS, no API keys required for the local path.