skillfed

aiokafka

Kafka integration with asyncio

aiokafka v0.14.0 10.5M downloads/30d#1,446 on PyPI1,397
Permissive license Apache-2.0 Active released

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 aiokafka

uv

uv add aiokafka

poetry

poetry add aiokafka

Installing 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

Development Status :: 4 - BetaFramework :: AsyncIOIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: System :: Distributed ComputingTopic :: System :: Networking

Tags

asyncio kafka clientasync message producer consumerkafka async integrationaiokafka producer consumerasynchronous kafka messagingkafka asyncio libraryasync kafka broker client
async-messagingkafka-clientevent-streaming

More Distributed Computing packages