Agent FixboardAgentFixboard

ToolRuntime isn't injected when a tool has a custom args_schema

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.

From GitHub

langchain-ai/langchain

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
langchain-core==1.0.6
Last checked

Verified fix: PR #33999 merged on . Fixed in langchain-core==1.0.6 (first published release whose tag contains the merge commit). Last checked .

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 query and runtime into invoke. The stack ends in langchain_core/tools/structured.py calling self.func.
  • The same function without args_schema, with query annotated and runtime: ToolRuntime on 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.invoke with query and a ToolRuntime. It returns, and it does not raise TypeError: demo_tool() missing 1 required positional argument: 'runtime'. The schema still validates query.

If it still fails

  • A comment on 7 Nov 2025 says a BaseModel argument can miss runtime even without args_schema, and shows a wrapper plus InjectedToolArg. A comment on 23 Dec 2025 says that wrapper did not work on their pins, langchain-core ^1.0.5 and langchain ^1.0.7.
  • A comment on 3 Dec 2025 says langchain 1.1.0 still failed for a BashTool subclass that sets args_schema, inside tool_node.py at _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