Langstream logo

Langstream

Free

Build robust LLM applications with true composability 🔗 ![GitHub Repo stars](https://img.shields.io/github/stars/rogeriochaves/langstream?style=social)

FreeFree tier
Inputs: textOutputs: text
Type
Open Source

About Langstream

LangStream is a lightweight, open-source Python library for building LLM applications, designed as a simpler alternative to LangChain. Instead of a massive feature set, it focuses on a single small core that is easy to learn, easy to adapt, well documented, fully typed, and truly composable. The fundamental building block is the 'Stream' — everything from an LLM to an output parser is a Stream, and streams can be composed together using functions like and_then, map, collect, join, and gather. LangStream leverages Python's AsyncGenerator for async streaming, enabling token-by-token output and seamless composition. Originally named LiteChain, it was renamed to LangStream. The library includes contrib modules for OpenAI (e.g., OpenAIChatStream) and is available via pip.

Key Features

Single small core, easy to learn and adapt
Fully typed and well documented
Async streaming using Python's AsyncGenerator
Composable Streams as the building block (and_then, map, collect, join, gather)
Lighter alternative to LangChain with fewer abstractions
Built-in OpenAI integration (OpenAIChatStream)
Supports token-by-token output and stream composition

Pros & Cons

Pros
  • Lightweight and minimalistic design, reducing complexity
  • True composability with Streams, making pipelines easy to build and reuse
  • Async streaming enables efficient token-by-token processing
  • Fully typed with good documentation, aiding developer experience
  • Open-source and free to use
Cons
  • Smaller community and fewer integrations compared to LangChain (417 stars on GitHub)
  • Limited to Python and currently only includes OpenAI contrib (may need custom development for other providers)
  • Relatively new project, so ecosystem and stability are evolving

Best For

Building chatbots with custom prompt instructions (e.g., emoji-only replies)Creating multi-step LLM pipelines by composing streams togetherImplementing translation or transformation chains between LLM outputsRapid prototyping of composable LLM applications

FAQ

What is LangStream?
LangStream is a lightweight Python library for building LLM applications, focusing on composability through Streams instead of chains. It is a simpler alternative to LangChain.
How does LangStream differ from LangChain?
LangStream has a single small core with fewer features, making it easier to learn and adapt. It uses streams as the fundamental building block and emphasizes true composability with async streaming.
What components are included in LangStream?
The core provides Stream building blocks and composition functions (and_then, map, collect, join, gather). Contrib modules include OpenAI support (OpenAIChatStream).
How do I install LangStream?
You can install it via pip: pip install langstream openai (the openai package is needed for OpenAI streams).
Is LangStream open-source?
Yes, it is open-source and hosted on GitHub under the MIT license (implied by repository).