Skip to content

Conversation

@Ryanakml
Copy link

@Ryanakml Ryanakml commented Jan 1, 2026

Summary

This PR fixes a bug in BaseTool where additional kwargs (such as ToolRuntime or system-injected arguments) were not being passed to the internal _run and _arun methods. The execution logic now correctly inspects the function signature and injects matching arguments from the provided kwargs.

Fixes
Fixes #34558

Validation

  • Verified with a reproduction script: ToolRuntime is now correctly injected.
  • All 158 units tests in libs/core/tests/unit_tests/test_tools.py passed.
  • Successfully ran make format and make lint in libs/core.

Generative AI Disclaimer
I used Gemini to assist in identifying the logic gap in base.py, formulating the reproduction script, and drafting this PR description.

@Ryanakml Ryanakml requested a review from eyurtsev as a code owner January 1, 2026 10:13
@github-actions github-actions bot added core `langchain-core` package issues & PRs fix For PRs that implement a fix labels Jan 1, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 1, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 13 untouched benchmarks
⏩ 21 skipped benchmarks1


Comparing Ryanakml:fix/tool-runtime-injection (f772c38) with master (3d687ea)

Open in CodSpeed

Footnotes

  1. 21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@mdrxy mdrxy changed the title fix(core): inject additional kwargs into BaseTool _run and _arun fix(core): inject additional kwargs into BaseTool _run and _arun Jan 8, 2026
@github-actions github-actions bot added fix For PRs that implement a fix and removed fix For PRs that implement a fix labels Jan 8, 2026
@mdrxy mdrxy self-assigned this Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core `langchain-core` package issues & PRs fix For PRs that implement a fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ToolRuntime isn't injected into BaseTool subclass's _run

2 participants