pyzmq (ZeroMQ Python)
Python bindings for ZeroMQ, a high-performance asynchronous messaging library. ZeroMQ provides patterns (pub-sub, push-pull, req-rep, router-dealer) for building distributed systems without a message broker. Used in Jupyter kernels, agent-to-agent communication, and high-throughput data pipelines. Supports TCP, IPC (Unix sockets), and in-process transport.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
No encryption by default — all messages in plaintext. CurveZMQ provides strong encryption but requires manual key management. Default deployments should be treated as internal-only.
⚡ Reliability
Best When
You need ultra-low-latency messaging between processes or machines with flexible patterns (pub-sub, pipeline, req-rep) and no broker dependency.
Avoid When
You need message persistence, acknowledgment guarantees, or managed cloud messaging — RabbitMQ, Kafka, or NATS are better for those requirements.
Use Cases
- • Build high-throughput pub-sub agent communication where agents subscribe to topic streams without a central broker
- • Implement pipeline patterns (PUSH/PULL) for distributing agent work across multiple workers without Kafka or RabbitMQ overhead
- • Create inter-process communication between agent components on the same host using Unix socket IPC transport with near-zero overhead
- • Build request-reply patterns for agent service calls with built-in load balancing across worker pool via ROUTER/DEALER sockets
- • Enable Jupyter-style kernel communication where agent orchestrators communicate with code execution kernels over ZMQ
Not For
- • Message persistence and durability — ZeroMQ is a transport layer with no message storage; use RabbitMQ or Kafka for durable messaging
- • Teams unfamiliar with socket programming — ZeroMQ requires understanding socket patterns and connection semantics; higher-level messaging solutions are simpler
- • Cloud-native microservices — gRPC or HTTP/2 have better tooling for service mesh, observability, and platform integration
Interface
Authentication
No built-in auth in base ZeroMQ. CurveZMQ provides elliptic-curve encryption and authentication. PLAIN auth available but sends credentials in plaintext. Production use should enable CurveZMQ.
Pricing
ZeroMQ and pyzmq are open source and free.
Agent Metadata
Known Gotchas
- ⚠ PUB/SUB slow joiner syndrome — subscribers miss messages published before the subscription is established; add a sleep(0.1) after connect() or use a synchronization pattern
- ⚠ ZMQ sockets are NOT thread-safe — never share a socket across threads; create per-thread sockets and use PAIR or PUSH/PULL for inter-thread communication
- ⚠ recv() is blocking by default — use NOBLOCK flag or poller (zmq.Poller) to avoid blocking agent event loops
- ⚠ Socket HWM (High Water Mark) drops messages silently when queues are full — set appropriate HWM or handle zmq.EAGAIN to detect dropped messages
- ⚠ Closing sockets during context termination can hang if messages are in-flight — use linger=0 on socket close or ctx.term() may block indefinitely
- ⚠ IPC transport on Windows uses TCP loopback (no Unix sockets) — 'ipc://' addresses work on Linux/macOS only; use 'tcp://127.0.0.1:' for cross-platform IPC
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for pyzmq (ZeroMQ Python).
Scores are editorial opinions as of 2026-03-06.