Starter template for the Tashi Vertex Swarm Challenge 2026 — The Stateful Handshake warm-up, using FoxMQ and Python.
FoxMQ is a Byzantine fault-tolerant MQTT 5.0 broker powered by Vertex consensus. Any standard MQTT client library works against it — messages are consensus-ordered by Vertex before delivery, so every subscriber sees the exact same event sequence.
- Python 3.8+
- A running FoxMQ broker (see setup below)
Linux (amd64)
curl -LO https://github.com/tashigit/foxmq/releases/download/v0.3.1/foxmq_0.3.1_linux-amd64.zip
unzip foxmq_0.3.1_linux-amd64.zip
chmod +x foxmqmacOS (Apple Silicon + Intel universal)
curl -LO https://github.com/tashigit/foxmq/releases/download/v0.3.1/foxmq_0.3.1_macos-universal.zip
unzip foxmq_0.3.1_macos-universal.zip
chmod +x foxmqWindows (PowerShell)
curl -LO https://github.com/tashigit/foxmq/releases/download/v0.3.1/foxmq_0.3.1_windows-amd64.zip
Expand-Archive foxmq_0.3.1_windows-amd64.zip .Then set up and run:
# Generate address book (1 node for local testing)
./foxmq address-book from-range 127.0.0.1 19793 19793
# Create a user for each agent
./foxmq user add agent_a
./foxmq user add agent_b
# Start the broker
./foxmq run --secret-key-file=foxmq.d/key_0.pemdocker network create foxmq_net
docker run --rm \
-v ./foxmq.d/:/foxmq.d/ \
ghcr.io/tashigit/foxmq:latest \
address-book from-list 172.18.0.2:19793
docker run --rm \
-v ./foxmq.d/:/foxmq.d/ \
ghcr.io/tashigit/foxmq:latest \
user add agent_a
docker run -d --name foxmq-0 \
--network foxmq_net \
-p 1883:1883 \
-v ./foxmq.d/:/foxmq.d/ \
ghcr.io/tashigit/foxmq:latest \
run --secret-key-file=/foxmq.d/key_0.pemFor high availability in production, use 4+ nodes (formula:
3N + 1where N = failures tolerated).
pip install -r requirements.txt# Terminal 1 – Agent A
python node.py --host 127.0.0.1 --port 1883 \
--username agent_a --password <PASSWORD_A> \
--agent-id agent_a
# Terminal 2 – Agent B
python node.py --host 127.0.0.1 --port 1883 \
--username agent_b --password <PASSWORD_B> \
--agent-id agent_bYou should see both agents printing [RECV] lines as messages come through FoxMQ's BFT consensus layer.
Extend node.py to complete the warm-up:
- Handshake — publish a
HELLOJSON payload toswarm/helloon connect - Heartbeats — publish a
HEARTBEATpayload toswarm/stateon a timer - Replicated state — maintain
{ peer_id, last_seen_ms, role, status }updated from incoming messages - Trigger action — have Agent A change its
role; Agent B must mirror it in <1 second - Stale detection — mark a peer as
"stale"if itslast_seen_msis >10 s old - Recovery — show the agent reconnecting and state resuming automatically
Look for # TODO comments in node.py to know where to add your logic.
Agent A publishes → local FoxMQ node → Vertex consensus → all FoxMQ nodes → Agent B
↑
fair ordering happens here (BFT, sub-100ms)
Because ordering is handled by Vertex, your on_message handler will fire in the same order on every connected agent — no extra coordination needed.
Record a short terminal session (30–60 s) showing:
- Discovery + handshake
- Active heartbeats
- State replication (role change mirrored)
- A killed-then-recovered agent
Drop it in Discord #shipping-log to claim your Stateful Handshake badge!
Docs: FoxMQ