aiokafka
Kafka integration with asyncio
What it is and what it does
aiokafka is an asyncio-native client for Apache Kafka that lets you produce and consume messages using Python's async/await syntax. It provides two main classes: AIOKafkaProducer for sending messages asynchronously and AIOKafkaConsumer for subscribing to topics and processing messages in an async loop. The consumer supports group coordination for load-balanced consumption across multiple consumer instances.
The library is built on top of asyncio and integrates with the async ecosystem, making it suitable for applications that already use async patterns. It handles cluster discovery, partition leadership, and group management automatically. The package depends on async-timeout, packaging, and typing_extensions, and supports Python 3.10 through 3.14.
Use it for:
- Build async event-driven applications that consume from Kafka topics and process messages concurrently.
- Implement high-throughput asynchronous message producers for real-time data pipelines.
- Create microservices that coordinate via Kafka consumer groups with automatic load balancing.
- Integrate Kafka messaging into FastAPI or other async web frameworks for event streaming.
- Process streaming data in async Python applications without blocking the event loop.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
aiokafka is an asyncio-based client library for Apache Kafka that provides asynchronous producer and consumer APIs for publishing and consuming messages.
Yes. aiokafka is actively maintained, has no known vulnerabilities, and offers a clean async API for Kafka integration. The medium install friction is standard for compiled packages. Choose it if you need Kafka support in an asyncio-based application; it's the primary async Kafka client for Python.
Install
aiokafka on PyPI
pip
pip install aiokafkauv
uv add aiokafkapoetry
poetry add aiokafkaInstalling aiokafka
Before you install
Medium install friction due to compiled wheels across multiple Python versions and platforms. The package is actively maintained with a recent release and 1397 repository stars, indicating stable ongoing support.
License in practice
Licensed under Apache-2.0 (permissive), allowing use in commercial and proprietary projects with minimal restrictions beyond attribution and liability disclaimers.
Quickstart
pip install aiokafka
from aiokafka import AIOKafkaProducer
import asyncio
async def send():
producer = AIOKafkaProducer(bootstrap_servers='localhost:9092')
await producer.start()
await producer.send_and_wait("my_topic", b"message")
await producer.stop()
asyncio.run(send())
Requires a running Kafka broker accessible at the bootstrap_servers address; requires Python 3.10 or later.
Verify before relying
- Whether the package supports Kafka protocol versions beyond 0.11 mentioned in the consumer documentation.
- Performance characteristics and throughput limits under typical production loads.
- Compatibility with Kafka security features (SASL, SSL/TLS) beyond what the description mentions.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 3 — async-timeout, packaging, typing_extensions |
| Maintenance | actively maintained — 107 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 10,535,919/month — #1,446 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aiokafka-0.14.0-cp310-cp310-macosx_10_9_x86_64.whl; aiokafka-0.14.0-cp310-cp310-macosx_11_0_arm64.whl; aiokafka-0.14.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; aiokafka-0.14.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; aiokafka-0.14.0-cp310-cp310-win32.whl; aiokafka-0.14.0-cp310-cp310-win_amd64.whl; aiokafka-0.14.0-cp311-cp311-macosx_10_9_x86_64.whl; aiokafka-0.14.0-cp311-cp311-macosx_11_0_arm64.whl; aiokafka-0.14.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; aiokafka-0.14.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; aiokafka-0.14.0-cp311-cp311-win32.whl; aiokafka-0.14.0-cp311-cp311-win_amd64.whl; aiokafka-0.14.0-cp312-cp312-macosx_10_13_x86_64.whl; aiokafka-0.14.0-cp312-cp312-macosx_11_0_arm64.whl; aiokafka-0.14.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; aiokafka-0.14.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; aiokafka-0.14.0-cp312-cp312-win32.whl; aiokafka-0.14.0-cp312-cp312-win_amd64.whl; aiokafka-0.14.0-cp313-cp313-macosx_10_13_x86_64.whl; aiokafka-0.14.0-cp313-cp313-macosx_11_0_arm64.whl
Tags
More Distributed Computing packages
gRPC Python is an HTTP/2-based RPC framework…
permissive · top 100 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
cloudpickleCloudpickle extends Python's standard pickle…
permissive · top 1,000 on PyPI
smart-openProvides a unified, open()-compatible Python…
permissive · top 1,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
rayRay is a distributed computing framework that…
permissive · top 1,000 on PyPI
kafkaA pure-Python client library for Apache Kafka…
permissive · top 15,000 on PyPI
kafka-connect-pyA command-line tool and Python client for…
permissive · top 15,000 on PyPI
kafka-pythonPure-Python Apache Kafka client library…
permissive · top 1,000 on PyPI
kafka-python-ngA Python client library for Apache Kafka that…
permissive · top 5,000 on PyPI
confluent-kafkaProvides a high-performance Python client for…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-aiokafkaAdds distributed tracing instrumentation to…
permissive · top 5,000 on PyPI
faust-streamingFaust-streaming is a Python library for…
permissive · top 15,000 on PyPI
aiormqaiormq is a pure Python AMQP 0.9.1 client…
permissive · top 5,000 on PyPI
apache-airflow-providers-apache-kafkaIntegrates Apache Kafka with Apache Airflow,…
permissive · top 5,000 on PyPI
matrice-commonmatrice_common provides authentication, RPC…
permissive · top 5,000 on PyPI