MessagePack (msgpack)
MessagePackmsgpackAdvancedA binary serialization format that works much like JSON but is smaller and faster.
MessagePack is an open binary serialization format developed by Sadayuki Furuhashi for turning in-memory data into bytes that can be sent over a network or written to disk. Its data model is close to JSON's (numbers, strings, arrays, maps), but the encoding is more compact, parsing is faster, and raw bytes can be stored directly. Unlike Protobuf it needs no schema file, at the cost of no field checking; unlike Python's pickle, unpacking never runs code, which makes it safer for data arriving over the network. In Python you install the msgpack package, but it doesn't understand NumPy arrays, so it's often paired with the third-party msgpack-numpy library, which encodes an array as its raw bytes plus dtype and shape. In embodied AI, zerorpc uses it to pack arguments and return values, and openpi's WebSocket policy server and client use it to ship observations and actions. openpi carries its own small module adapted from msgpack-numpy that drops the original library's fallback to pickle for object-dtype arrays.
ExampleAn openpi client packs a dict of camera images and joint state (all NumPy arrays) into bytes with msgpack_numpy.Packer and sends it to the policy server over WebSocket; the server restores the arrays with unpackb, runs inference, and packs the action chunk back the same way.
- Also called
- msgpack, msgpack-numpy
- Related
- Protocol Buffers · zerorpc · openpi (Physical Intelligence) · WebSocket · Policy Server (Remote Inference) · ZeroMQ
- Sources
- MessagePack 官网 (Chinese)
MessagePack - Wikipedia
openpi 代码:openpi_client/msgpack_numpy.py (Chinese) - As of
- 2026-10