-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
When attempting to wrap a custom LangChain structured tool with Google ADK, I encounter an error stating that a mandatory parameter called config is missing. However, I did not define any config parameter in my tool. The example from the docs using TavilySearch works fine, but my custom defined structured tool from LangChain produces this error.
from google.adk.agents import Agent
from google.adk.tools.langchain_tool import LangchainTool
from langchain_core.tools.structured import StructuredTool
from pydantic import BaseModel
def add(x, y) -> int:
return x + y
class add_schema(BaseModel):
x: int
y: int
test_langchain_tool = StructuredTool.from_function(
add,
name="add",
description="Adds two numbers",
args_schema=add_schema,
)
root_agent = Agent(
model="gemini-2.0-flash-001",
name="test_app",
description="A helpful assistant for user questions.",
instruction="You are a helpful assistant for user questions, you have access to a tool that adds two numbers.",
tools=[LangchainTool(tool=test_langchain_tool)],
)
Desktop (please complete the following information):
-
OS: Windows 11
-
Python version: 3.13
-
ADK version: 0.4.0
Additional context
I have tried both regular tools and structured tools from LangChain, but the same issue persists. Since I already have all my tools defined in LangChain, I would prefer to be able to work with them directly in ADK.
I have attached screenshots of the conversation and the error messages, as well as the code snippet where the error occurs. The error specifically mentions a missing mandatory parameter called config, but this parameter was not defined by me in my tool definition. I have discovered a workaround by defining a tool callback that modifies the arguments and adds an argument called config with any arbitrary value. However, this doesn't seem like a proper solution to the underlying issue.