Introduction

The Python SDK implements the BabelQueue standard so your Python services produce and consume the exact same strict JSON envelope as every other language in the ecosystem — no PHP serialize(), no language lock-in.

Python is the natural AI/ML & data consumer in a BabelQueue topology: let a Laravel app publish urn:babel:orders:created, and a Python worker picks it up to run scoring, enrichment or an ML pipeline — reading the same canonical envelope.

The package ships two layers: the zero-dependency core (the EnvelopeCodec, contracts and dead-letter helpers) and a small BabelQueue runtime that publishes and consumes over a broker for end-to-end apps.

What you get

  • Canonical wire envelope (schema_version: 1). job, trace_id, data, meta and attempts — byte-for-byte compatible with the other SDKs.
  • A trace_id on every message for cross-service correlation across your data and ML pipelines.
  • URN routing (urn:babel:<context>:<event>) so consumers route on a stable key, not a class name.
  • Pluggable transports chosen by URL scheme: memory:// (built in), redis:// (extra [redis]) and amqp:// (RabbitMQ, extra [amqp]).

The envelope

{
  "job": "urn:babel:orders:created",
  "trace_id": "7b3f9c2a-e41d-4f88-9b2a-1c0d5e6f7a8b",
  "data": { "order_id": 1042, "amount": 99.90 },
  "meta": { "id": "f1e2d3c4-b5a6-4789-90ab-cdef01234567", "queue": "default", "lang": "python", "schema_version": 1, "created_at": 1749132727000 },
  "attempts": 0
}

Continue to Installation.