# Hanzo Stream — Hanzo AI

> Use standard Kafka producers and consumers with NATS JetStream as the backend.

Kafka Wire Protocol

# Hanzo Stream

A Kafka port in front of Hanzo PubSub

Stream speaks the Kafka binary protocol on 9092 and stores nothing itself. A produce becomes a message in a durable PubSub stream — topic orders, partition 0, is the stream kafka-orders-0 — and a fetch reads it back out. Your producers and consumers connect unchanged, and it runs inside your cluster, next to the store it fronts.

Kafka

Wire protocol

PubSub

Holds the log

Stateless

No broker disk

Durable

At-least-once

[Get Started](https://docs.hanzo.ai/docs/services/stream)[GitHub](https://github.com/hanzoai/stream)

## Your clients, our store

Keep the producers and consumers you have. Drop the cluster underneath them.

### It speaks Kafka

Produce, Fetch, ListOffsets, Metadata, OffsetCommit, OffsetFetch, FindCoordinator, JoinGroup, SyncGroup, Heartbeat, CreateTopics and ApiVersions, at the versions modern clients negotiate. kafka-python, sarama, confluent-kafka and franz-go all connect.

### The log lives in PubSub

One topic partition is one durable PubSub stream. Retention, replicas and disk are that stream&#x27;s settings, so the thing actually holding your events is a system you already run and already back up.

### Nothing to operate

One Go binary that keeps no state of its own. Restart it, run several, roll it mid-deploy — the log is somewhere else, so the gateway is never the piece you are afraid to touch.

### Offsets survive a restart

A group&#x27;s committed offsets live in a PubSub key-value bucket, so a consumer that dies comes back where it left off instead of at the top. Ask for an offset that has aged out and you get OFFSET_OUT_OF_RANGE, so the client resets rather than hangs.

### Offsets are stamped, not inferred

Every Kafka offset is written into the record batch header when the batch is produced, and read straight back from there. Deriving them from the store&#x27;s own sequence numbers works right up until the sequence has gaps in it — and then one record can make every fetch after it unreadable.

### Bad batches stop at the door

A produce whose batch chain does not line up is refused with INVALID_RECORD instead of being written and discovered later by a consumer that cannot get past it. The scan that recovers a partition&#x27;s bounds is capped, so a damaged topic degrades rather than stalls.

## One line changes: the bootstrap server

producer.py

```
import json from kafka import KafkaProducer, KafkaConsumer # The only line that changes producer = KafkaProducer( bootstrap_servers=["stream.hanzo.ai:9092"], value_serializer=lambda v: json.dumps(v).encode(), ) producer.send("events", {"type": "user.signup", "user_id": "usr_123"}) # Consumer groups work identically consumer = KafkaConsumer( "events", bootstrap_servers=["stream.hanzo.ai:9092"], group_id="my-service", auto_offset_reset="earliest", ) for message in consumer: process(message.value)
```

Open Source Revenue Sharing

### Up to 5% of compute goes back to open source

Every deployment is SBOM-verified. Contributors to franz-go earn a share of compute revenue — transparent, on-chain, and customizable by the community.

[Connect & Earn](https://hanzo.ai/open-source/dividends)[Learn More](https://hanzo.ai/open-source)

Open Source Compute Dividends

### Up to 5% of compute goes back to OSS authors

Every Hanzo deployment tracks software dependencies via SBOM. When your code powers compute on Hanzo, the authors get paid — automatically.

USDHanzo NetworkETHSOLUSDCmore

[Connect GitHub](https://console.hanzo.ai?ref=oss-dividends)[How payouts work](https://hanzo.ai/open-source/dividends)

## Point the bootstrap server at it

The clients stay as they are. The cluster underneath them goes away.

[Read the Docs](https://docs.hanzo.ai/docs/services/stream)[View on GitHub](https://github.com/hanzoai/stream)

## Open source

License: Apache-2.0[hanzoai/stream](https://github.com/hanzoai/stream)

## Get Stream

Event stream

[Deploy to Cloud](https://console.hanzo.ai/deploy)[Self-host](https://docs.hanzo.ai/docs/services/stream)
