# ag2ai/faststream

FastStream is an asynchronous Python framework for building event-driven applications. It brings together message broker integration, dependency injection, validation, testing utilities, and AsyncAPI documentation generation in a single toolkit

Repository: https://github.com/ag2ai/faststream
Canonical: https://ross.abutalabs.com/products/faststream
Homepage: http://faststream.ag2.ai/latest/
Language: Python
License: Apache-2.0
License Family: permissive
Topics: asyncio, kafka, python, rabbitmq, asyncapi, distributed-systems, faststream, nats, redis, stream-processing, mqtt, mqtt-broker
Last push: 2026-08-26T18:22:49+00:00

## Health v2 (maintenance only)
Score: 98/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 96, longevity 97
- inputs: {"age_days": 1371, "days_push": 7, "days_rel": 26, "gap_med": 10, "n_releases_24m": 48}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5316, forks 383 (observed 2026-08-28T04:09:15.530562+00:00)

## What it is
FastStream is an asynchronous Python framework for building event-driven applications on top of message brokers like Kafka, RabbitMQ, NATS, Redis, and MQTT. It provides decorator-based producers/consumers, Pydantic or msgspec validation, dependency injection, in-memory testing without a broker, OpenTelemetry/Prometheus observability, and automatic AsyncAPI documentation generation.

## Use cases
- build kafka consumers in python
- produce and consume rabbitmq messages with validation
- generate asyncapi docs from code
- test message handlers without a running broker
- build streaming microservices with nats jetstream
- add opentelemetry tracing to message consumers
- integrate kafka subscribers into a fastapi app
- publish test messages to a broker from the cli

## When to choose
- you want FastAPI-style ergonomics for message brokers instead of HTTP
- you need AsyncAPI contracts generated automatically from handlers
- you want broker-agnostic code across Kafka, RabbitMQ, NATS, Redis, and MQTT
- you need broker testing in CI without containers
- you want built-in observability middleware for event-driven services

## When to avoid
- you need a broker not covered by Kafka, RabbitMQ, NATS, Redis, or MQTT
- you want a heavy streaming platform with built-in state stores or stream processing engines like Flink
- your project is synchronous and cannot use asyncio
- you need direct low-level control and prefer raw broker clients

## Facets
- artifact type: framework
- maturity: active
- function: message-queue, serialization, testing, api-framework, middleware, tracing, monitoring, cli, documentation
- domain: microservices, backend, developer-tools
- platform: python, cross-platform, cli
- tags: kafka, rabbitmq, nats, redis-streams, mqtt, asyncapi, event-driven, pydantic, msgspec, fastapi-integration, opentelemetry, stream-processing, messaging, data-engineering, docker

## Member repositories
- ag2ai/faststream (main) score 98

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:15.530562+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:58:56.489061+00:00, confidence not recorded.
  - readme: https://github.com/ag2ai/faststream (fetched 2026-08-28T04:09:15.530562+00:00, sha 0219bfe3d1a2)
  - homepage: http://faststream.ag2.ai/latest/ (fetched 2026-08-29T08:53:43.247202+00:00, sha 1f84e74052f7)
  - site_page: http://faststream.ag2.ai/latest/getting-started (fetched 2026-08-29T08:53:43.250742+00:00, sha 064b1161c6e0)
  - site_page: http://faststream.ag2.ai/latest/getting-started/contributing/CONTRIBUTING (fetched 2026-08-29T08:53:43.252813+00:00, sha 70ac99085421)
  - site_page: https://faststream.ag2.ai/latest/getting-started/observability/opentelemetry (fetched 2026-08-29T08:53:43.254668+00:00, sha f770d35c6639)
  - site_page: https://faststream.ag2.ai/latest/getting-started/subscription/msgspec (fetched 2026-08-29T08:53:43.256406+00:00, sha 5f8668c11a35)
  - site_page: http://faststream.ag2.ai/latest/getting-started/subscription/test (fetched 2026-08-29T08:53:43.258279+00:00, sha 60449e43c87f)
  - site_page: http://faststream.ag2.ai/latest/getting-started/cli (fetched 2026-08-29T08:53:43.260439+00:00, sha fc5d6a186448)
  - site_page: http://faststream.ag2.ai/latest/getting-started/integrations/fastapi (fetched 2026-08-29T08:53:43.262187+00:00, sha bdf3a0838a98)
  - registry_pypi: https://pypi.org/pypi/faststream/json (fetched 2026-08-29T08:53:43.264801+00:00, sha 1969afd529eb)
- Data as of 2026-08-30T08:39:29.467469+00:00.
