{"record":{"id":"9dbda41821481552","repo":"langchain-ai/langchain","slug":"stream-events-version-v3-is-only-supported-on-r","errorCode":null,"errorMessage":"stream_events(version='v3') is only supported on Runnable subclasses that implement the v3 streaming protocol (BaseChatModel, CompiledGraph). Got: {type(self).__name__}","messagePattern":"stream_events\\(version='v3'\\) is only supported on Runnable subclasses that implement the v3 streaming protocol \\(BaseChatModel, CompiledGraph\\)\\. Got: (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/runnables/base.py","lineNumber":1740,"sourceCode":"            exclude_tags: Exclude events from `Runnable` objects with matching tags.\n            **kwargs: Additional keyword arguments to pass to the `Runnable`.\n\n        Raises:\n            NotImplementedError: Always. Subclasses override this method for supported\n                versions.\n\n        \"\"\"\n        # Base impl always raises; consume args so they don't trip ARG002.\n        del input, config, include_names, include_types, include_tags\n        del exclude_names, exclude_types, exclude_tags, kwargs\n        if version == \"v3\":\n            msg = (\n                \"stream_events(version='v3') is only supported on Runnable subclasses \"\n                \"that implement the v3 streaming protocol \"\n                \"(BaseChatModel, CompiledGraph). \"\n                f\"Got: {type(self).__name__}\"\n            )\n            raise NotImplementedError(msg)\n        msg = (\n            f\"stream_events(version={version!r}) is not supported. \"\n            \"Use astream_events() for v1/v2, or stream_events(version='v3') \"\n            \"on a supported subclass.\"\n        )\n        raise NotImplementedError(msg)\n\n    def transform(\n        self,\n        input: Iterator[Input],\n        config: RunnableConfig | None = None,\n        **kwargs: Any | None,\n    ) -> Iterator[Output]:\n        \"\"\"Transform inputs to outputs.\n\n        Default implementation of transform, which buffers input and calls `astream`.\n\n        Subclasses must override this method if they can start producing output while","sourceCodeStart":1722,"sourceCodeEnd":1758,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/runnables/base.py#L1722-L1758","documentation":"Raised by the base `Runnable.stream_events` (the synchronous variant) when called with `version=\"v3\"` on a Runnable that does not implement the v3 streaming protocol. As with the async variant, only `BaseChatModel` and `CompiledGraph` implement v3; the base class consumes its arguments (to avoid unused-arg lint) and raises `NotImplementedError`, naming the actual class via `type(self).__name__`.","triggerScenarios":"`chain.stream_events(inp, version=\"v3\")` on a `RunnableSequence`, `RunnableLambda`, plain prompt, or any custom Runnable outside the two supported families. The `version == \"v3\"` branch raises immediately (synchronously, not on iteration).","commonSituations":"Porting async v3 event code to a synchronous entry point; agent frameworks exposing a sync `stream_events` facade over arbitrary user chains; smoke-testing v3 on simple LCEL pipelines before wiring real models.","solutions":["Use `version=\"v2\"` with `astream_events` (sync `stream_events` does not support v1/v2 at all — see the companion error)","Stream from a `BaseChatModel` instance or a compiled LangGraph (`CompiledGraph`) if v3 semantics are required","Wrap the unsupported chain in a LangGraph node so the top-level object implements the v3 protocol"],"exampleFix":"# before\nfor ev in my_sequence.stream_events(inp, version=\"v3\"):\n    ...  # NotImplementedError: only supported on BaseChatModel, CompiledGraph\n\n# after\nfor ev in compiled_graph.stream_events(inp, version=\"v3\"):\n    ...  # supported","handlingStrategy":"validation","validationCode":"from langchain_core.language_models import BaseChatModel\n\ndef supports_sync_v3(target: object) -> bool:\n    try:\n        from langgraph.pregel import CompiledGraph\n        return isinstance(target, (BaseChatModel, CompiledGraph))\n    except ImportError:\n        return isinstance(target, BaseChatModel)","typeGuard":null,"tryCatchPattern":"try:\n    for ev in target.stream_events(inp, version=\"v3\"):\n        ...\nexcept NotImplementedError:\n    for ev in target.stream(inp):  # degrade to plain token streaming\n        ...","preventionTips":["Reserve sync stream_events(version='v3') for chat models and compiled graphs","Prefer the async API for cross-Runnable compatibility","Feature-check the target before selecting the v3 path"],"tags":["runnables","streaming","stream-events","notimplementederror","sync-api"],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}