[PR #5252] langgraph[change]: solidify public/private differentiations #4329

Closed
opened 2026-02-20 17:50:01 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/5252

State: closed
Merged: Yes


Addresses https://github.com/langchain-ai/langgraph/issues/5017 (for the langgraph lib). Should also be done for other libs, though lower prio.

The value in making things explicitly public/private here is that private APIs are much easier to change than public ones. Before langgraph v1 we should solidify what is public and what is private.

This also helps us decide what data structures should be documented and included in API refs.

Migration guide

Old Import New Import Status
from langgraph.pregel.types import ... from langgraph.types import ... ⚠️ Deprecated - Will be removed in V2
from langgraph.constants import Send from langgraph.types import Send ⚠️ Deprecated - Will be removed in V2
from langgraph.constants import Interrupt from langgraph.types import Interrupt ⚠️ Deprecated - Will be removed in V2
from langgraph.channels import <ErrorClass> from langgraph.errors import <ErrorClass> Removed - All errors now centralized in langgraph.errors
from langgraph.constants import TAG_NOSTREAM_ALT N/A Removed - Deprecated constant removed

General Patterns

  • StateGraph / CompiledStateGraph are public
  • Pregel / RemoteGraph are public
  • Relevant types in langgraph.types are public (like Send, Command)
  • Unless there's a good reason, most other things should be private utilities.

Significant changes

  1. Added __all__ to all __init__.py files in langgraph submodules, enumerating explicitly public structures.
  2. Added __all__ to public .py files in submodules with relevant exports
  3. Removed the utils folder in favor of a _internal module with _ prefixed files.
  4. A few things removed from types.py that I didn't add backwards compat imports for, let me know if you think any of them should stay!

Deprecations

  1. Imports from langgraph.pregel.types
  2. Imports of Send and Interrupt from langgraph.constants

Removals

  1. Removed backwards compat import of errors re-exported from langgraph.channels. They are all accessible via langgraph.errors.
  2. Removed deprecated constant TAG_NOSTREAM_ALT

Notes (internal/for contributors)

  • Eventually some of the stuff in _internal could probably be moved to pregel. This feels low stakes and can be done at any time, maybe while relevant pieces of code are being touched.
  • I'd like to reorganize pregel constants and such, but that can come with an internal config refactor.
  • Should decide on where PregelExecutableTask lives long term

This also sets the stage for future removal of Runnable and RunnableConfig throughout the codebase (probably, post v1)

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/5252 **State:** closed **Merged:** Yes --- Addresses https://github.com/langchain-ai/langgraph/issues/5017 (for the `langgraph` lib). Should also be done for other libs, though lower prio. The value in making things explicitly public/private here is that private APIs are much easier to change than public ones. Before langgraph v1 we should solidify what is public and what is private. This also helps us decide what data structures should be documented and included in API refs. ## Migration guide | Old Import | New Import | Status | |------------|------------|--------| | `from langgraph.pregel.types import ...` | `from langgraph.types import ...` | ⚠️ Deprecated - Will be removed in V2 | | `from langgraph.constants import Send` | `from langgraph.types import Send` | ⚠️ Deprecated - Will be removed in V2 | | `from langgraph.constants import Interrupt` | `from langgraph.types import Interrupt` | ⚠️ Deprecated - Will be removed in V2 | | `from langgraph.channels import <ErrorClass>` | `from langgraph.errors import <ErrorClass>` | ❌ Removed - All errors now centralized in `langgraph.errors` | | `from langgraph.constants import TAG_NOSTREAM_ALT` | N/A | ❌ Removed - Deprecated constant removed | ## General Patterns * `StateGraph` / `CompiledStateGraph` are public * `Pregel` / `RemoteGraph` are public * Relevant types in `langgraph.types` are public (like `Send`, `Command`) * Unless there's a good reason, most other things should be private utilities. ## Significant changes 1. Added `__all__` to all `__init__.py` files in `langgraph` submodules, enumerating explicitly public structures. 2. Added `__all__` to public `.py` files in submodules with relevant exports 3. Removed the `utils` folder in favor of a `_internal` module with `_` prefixed files. 4. A few things removed from `types.py` that I didn't add backwards compat imports for, let me know if you think any of them should stay! ## Deprecations 1. Imports from `langgraph.pregel.types` 2. Imports of `Send` and `Interrupt` from `langgraph.constants` ## Removals 1. Removed backwards compat import of errors re-exported from `langgraph.channels`. They are all accessible via `langgraph.errors`. 2. Removed deprecated constant `TAG_NOSTREAM_ALT` ## Notes (internal/for contributors) * Eventually some of the stuff in `_internal` could probably be moved to `pregel`. This feels low stakes and can be done at any time, maybe while relevant pieces of code are being touched. * I'd like to reorganize pregel constants and such, but that can come with an internal config refactor. * Should decide on where `PregelExecutableTask` lives long term This also sets the stage for future removal of `Runnable` and `RunnableConfig` throughout the codebase (probably, post v1)
yindo added the pull-request label 2026-02-20 17:50:01 -05:00
yindo closed this issue 2026-02-20 17:50:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4329