Skip to content

Conversation

@dumko2001
Copy link

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

@vercel
Copy link

vercel bot commented Nov 27, 2025

@dumko2001 is attempting to deploy a commit to the LangChain Team on Vercel.

A member of the Team first needs to authorize it.

@dumko2001 dumko2001 force-pushed the fix/tool-runtime-generic branch from 8abcea9 to 29f4d21 Compare November 27, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ToolRuntime[WithTypeArguments] not supported

1 participant