Symptom
A tool declared with @tool(args_schema=InputModel) and a runtime: ToolRuntime argument raises TypeError: demo_tool() missing 1 required positional argument: 'runtime' from demo_tool.invoke. InputModel only has query.
Evidence what you'll see
- The failing call passes
queryandruntimeintoinvoke. The stack ends inlangchain_core/tools/structured.pycallingself.func. - The same function without
args_schema, withqueryannotated andruntime: ToolRuntimeon the signature, returns. A comment on 29 Oct 2025 reports the failure on langchain 1.0.2 and langchain-core 1.0.1.
Why it happens
Injected arguments were kept only when they appeared in the schema, so a custom args_schema that omits ToolRuntime or InjectedToolCallId dropped them. Pull request 33999 injects those arguments even when the custom schema omits them. The other fields still go through the schema.
Affected versions
langchain-core 1.0.0, langchain 1.0.0, Python 3.13.1, Darwin kernel 24.6.0, arm64. A comment reports the same TypeError on langchain 1.0.2 and langchain-core 1.0.1.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
- Call
demo_tool.invokewithqueryand aToolRuntime. It returns, and it does not raiseTypeError: demo_tool() missing 1 required positional argument: 'runtime'. The schema still validatesquery.
If it still fails
- A comment on 7 Nov 2025 says a
BaseModelargument can missruntimeeven withoutargs_schema, and shows a wrapper plusInjectedToolArg. A comment on 23 Dec 2025 says that wrapper did not work on their pins, langchain-core^1.0.5and langchain^1.0.7. - A comment on 3 Dec 2025 says langchain 1.1.0 still failed for a
BashToolsubclass that setsargs_schema, insidetool_node.pyat_inject_tool_args. The merged fix in this issue is pull request 33999, in langchain-core 1.0.6. The linked issue does not describe a further change for that subclass.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it