## Summary When invoking a tool with a `ToolCall`, the `tool_call_id` is extracted but was **not forwarded** to callback handlers in `on_tool_start`. This made it impossible for callback handlers to correlate tool executions with the original LLM tool calls. This fix adds `tool_call_id=tool_call_id` to both: - Sync `run()` method's `on_tool_start` call - Async `arun()` method's `on_tool_start` call ## Changes - **`libs/core/langchain_core/tools/base.py`**: Added `tool_call_id` parameter to `on_tool_start` calls (2 lines) - **`libs/core/tests/unit_tests/test_tools.py`**: Added 6 comprehensive tests covering: - Sync tool invocation via `invoke()` - Async tool invocation via `ainvoke()` - `tool_call_id` is `None` when invoked without a ToolCall - Empty string `tool_call_id` edge case - Direct `run()` method - Direct `arun()` method ## Test plan - [x] All 147 existing tests pass - [x] 6 new tests added and passing - [x] Linting passes Fixes #34168 --- This PR was developed with AI assistance (Claude). --------- Co-authored-by: Mason Daugherty <github@mdrxy.com> Co-authored-by: Mason Daugherty <mason@langchain.dev>
Packages
Important
This repository is structured as a monorepo, with various packages located in this libs/ directory. Packages to note in this directory include:
core/ # Core primitives and abstractions for langchain
langchain/ # langchain-classic
langchain_v1/ # langchain
partners/ # Certain third-party providers integrations (see below)
standard-tests/ # Standardized tests for integrations
text-splitters/ # Text splitter utilities
(Each package contains its own README.md file with specific details about that package.)
Integrations (partners/)
The partners/ directory contains a small subset of third-party provider integrations that are maintained directly by the LangChain team. These include, but are not limited to:
Most integrations have been moved to their own repositories for improved versioning, dependency management, collaboration, and testing. This includes packages from popular providers such as Google and AWS. Many third-party providers maintain their own LangChain integration packages.
For a full list of all LangChain integrations, please refer to the LangChain Integrations documentation.