Repository navigation
LangchainTool.from_config blanks the name and description a config leaves out #7900
Description
🔴 Required Information
Describe the Bug:
LangchainToolConfig defaults name and description to '' (src/google/adk/integrations/langchain/langchain_tool.py:211,214), and LangchainTool.__init__ treats anything other than None as an override (:110,117). So a YAML agent that sets only tool gets a tool with an empty name and an empty description, and a config that sets only one of them blanks the other.
Two such tools in one agent both declare name=''. The second replaces the first in tools_dict, so the first can no longer be called, and the model is told about two functions with no name and no description.
docs/guides/integrations/langchain/langchain_tool/index.md describes both options as overrides of the Langchain tool's own metadata. CrewaiTool, whose config has the same '' defaults, falls back to the wrapped tool's values (src/google/adk/integrations/crewai/crewai_tool.py:52,58). Calling LangchainTool(tool) directly is not affected, because both parameters default to None there.
Steps to Reproduce:
- Install
google-adkfrommainat8cd3b12cwithlangchain-core(thev2.13.0tag has the same code). - Run the script under "Minimal Reproduction Code". It makes no model call and needs no API key.
Expected Behavior:
Options the config leaves out keep the wrapped tool's name and description:
[('add', 'Adds two numbers.'), ('subtract', 'Subtracts b from a.')]
Observed Behavior:
[('', ''), ('', '')]
Environment Details:
- ADK Library Version (pip show google-adk): 2.13.0,
mainat8cd3b12c - Desktop OS: Windows 11
- Python Version (python -V): Python 3.11.3
Model Information:
- Are you using LiteLLM: No
- Which model is being used: N/A, the script makes no model call (the
Runnerrun under "Logs" uses a scripted model)
🟡 Optional Information
Regression:
No. The '' defaults and the is not None checks have both been there since from_config was added in 1686cc5.
Logs:
The same kind of agent through InMemoryRunner, with a scripted model that records the request it receives:
WARNING: Duplicate tool name '': the previously registered tool is shadowed and can no longer be called.
tools: [('', ''), ('', '')]
declarations sent to the model:
name='' description=''
name='' description=''
tools_dict keys: ['']
Screenshots / Video:
N/A
Additional Context:
No test calls LangchainTool.from_config today.
Minimal Reproduction Code:
import pathlib
import tempfile
from google.adk.agents import config_agent_utils
from langchain_core.tools import tool
@tool
def add(a: int, b: int) -> int:
"""Adds two numbers."""
return a + b
@tool
def subtract(a: int, b: int) -> int:
"""Subtracts b from a."""
return a - b
CONFIG = """\
name: math_agent
model: gemini-2.5-flash
instruction: Do the maths.
tools:
- name: google.adk.integrations.langchain.LangchainTool
args:
tool: __main__.add
- name: google.adk.integrations.langchain.LangchainTool
args:
tool: __main__.subtract
"""
with tempfile.TemporaryDirectory() as folder:
path = pathlib.Path(folder, "root_agent.yaml")
path.write_text(CONFIG)
agent = config_agent_utils.from_config(str(path))
print([(t.name, t.description) for t in agent.tools])How often has this issue occurred?:
- Always (100%)
Activity