mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-17 21:25:46 +02:00
**Description:** This PR fixes an issue where injection types (like `ToolRuntime`) were not recognized by `ToolNode` when used with generic type arguments (e.g., `ToolRuntime[MyContext]`). Previously, the `_is_injection` check relied solely on `isinstance` and `issubclass`, which fail for `typing._GenericAlias` objects. This update adds a check using `typing.get_origin()` to correctly identify the base class of generic types, ensuring the runtime is injected correctly even when type hints are present. **Issue:** Fixes #6465 **Dependencies:** None **Twitter handle:** @SidharthRajmoh2 --------- Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>