Python bindings for the LangChain agent streaming protocol
Actively maintained. Last release 11 days ago, commits in 12 of the last 26 weeks. A safe choice.
pip install langchain-protocollangchain-protocol
Python bindings for the LangChain agent streaming protocol.
This package provides generated TypedDict and Literal definitions for the
protocol's commands, events, results, and payload shapes. It does not include a
runtime client, transport, or helper APIs — it is intended as a source of
typing primitives only.
The types are generated from protocol.cddl, the source of truth for
the wire format. See the streaming protocol overview for the
full design, channel model, and transport details.
Installation
pip install langchain-protocol
Usage
from langchain_protocol import Command, SubscribeParams
params: SubscribeParams = {
"channels": ["messages", "lifecycle"],
}
subscribe: Command = {
"id": 1,
"method": "subscription.subscribe",
"params": params,
}
What this package includes
TypedDictdefinitions for commands, events, results, and payload shapesLiteraland union aliases for protocol enums and tagged unions- A
py.typedmarker so type checkers pick up the bundled annotations