Skip to content

Crewai tools not working, i have tried nl2sql and pg search tool. #3078

@samy19980109

Description

@samy19980109

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Describe the bug
Crewai tools not working, i have tried nl2sql and pg search tool.

from google.adk.tools.crewai_tool import CrewaiTool
from google.adk import Agent
from crewai_tools import PGSearchTool, NL2SQLTool
import os
from dotenv import load_dotenv

load_dotenv()

nl2sqltool = NL2SQLTool(
    db_uri=f"postgresql://{os.getenv('DB_USER')}:{os.getenv('DB_PASSWORD')}@{os.getenv('DB_HOST')}:{os.getenv('DB_PORT')}/{os.getenv('DB_NAME')}",
    table_name=os.getenv('DB_TABLE_NAME')
)

nl2sql_crewai_tool = CrewaiTool(
    name="NL2SQLTool",
    description="A tool that converts natural language to SQL queries and executes them on a PostgreSQL database.",
    tool=nl2sqltool
)

root_agent = Agent(
    name="CrewAI_Root_Agent",
    description="An agent that can use various tools to assist with tasks.",
    instruction="You are a helpful assistant that can use tools to assist with tasks.",
    tools=[nl2sql_crewai_tool],
    model="gemini-2.5-flash-lite"
)

facing error: TypeError: NL2SQLTool._run() missing 1 required positional argument: 'sql_query'

To Reproduce
Please share a minimal code and data to reproduce your problem.
Steps to reproduce the behavior:

  1. Install '...'
  2. Run '....'
  3. Open 'adk web'
  4. Provie error or stacktrace:
2025-10-02 18:49:31,621 - INFO - google_llm.py:122 - Sending out request, model: gemini-2.5-flash-lite, backend: GoogleLLMVariant.VERTEX_AI, stream: False
2025-10-02 18:49:31,622 - INFO - models.py:8217 - AFC is enabled with max remote calls: 10.
2025-10-02 18:49:32,823 - INFO - google_llm.py:175 - Response received from the model.
2025-10-02 18:49:32,823 - WARNING - types.py:5697 - Warning: there are non-text parts in the response: ['function_call'], returning concatenated text result from text parts. Check the full candidates.content.parts accessor to get the full model response.
Using Tool: NL2SQLTool
2025-10-02 18:49:32,833 - ERROR - adk_web_server.py:1284 - Error in event_generator: NL2SQLTool._run() missing 1 required positional argument: 'sql_query'
Traceback (most recent call last):
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/cli/adk_web_server.py", line 1274, in event_generator
    async for event in agen:
    ...<7 lines>...
      yield f"data: {sse_event}\n\n"
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/runners.py", line 332, in run_async
    async for event in agen:
      yield event
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/runners.py", line 328, in _run_with_trace
    async for event in agen:
      yield event
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/runners.py", line 383, in _exec_with_plugin
    async for event in agen:
    ...<9 lines>...
      yield (modified_event if modified_event else event)
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/runners.py", line 317, in execute
    async for event in agen:
      yield event
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/agents/base_agent.py", line 248, in run_async
    async for event in agen:
      yield event
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/agents/base_agent.py", line 238, in _run_with_trace
    async for event in agen:
      yield event
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/agents/llm_agent.py", line 341, in _run_async_impl
    async for event in agen:
      self.__maybe_save_output_to_state(event)
      yield event
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 355, in run_async
    async for event in agen:
      last_event = event
      yield event
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 401, in _run_one_step_async
    async for event in agen:
    ...<3 lines>...
      yield event
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 491, in _postprocess_async
    async for event in agen:
      yield event
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 614, in _postprocess_handle_function_calls_async
    if function_response_event := await functions.handle_function_calls_async(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        invocation_context, function_call_event, llm_request.tools_dict
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/flows/llm_flows/functions.py", line 198, in handle_function_calls_async
    return await handle_function_call_list_async(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/flows/llm_flows/functions.py", line 244, in handle_function_call_list_async
    function_response_events = await asyncio.gather(*tasks)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/flows/llm_flows/functions.py", line 331, in _execute_single_function_call_async
    raise tool_error
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/flows/llm_flows/functions.py", line 316, in _execute_single_function_call_async
    function_response = await __call_tool_async(
                        ^^^^^^^^^^^^^^^^^^^^^^^^
        tool, args=function_args, tool_context=tool_context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/flows/llm_flows/functions.py", line 688, in __call_tool_async
    return await tool.run_async(args=args, tool_context=tool_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/tools/function_tool.py", line 157, in run_async
    return await self._invoke_callable(self.func, args_to_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/google/adk/tools/function_tool.py", line 174, in _invoke_callable
    return target(**args_to_call)
  File "/Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages/crewai/tools/base_tool.py", line 89, in run
    result = self._run(*args, **kwargs)
TypeError: NL2SQLTool._run() missing 1 required positional argument: 'sql_query'

Expected behavior
I expect the agent to be able to use crew ai nl2sql and pgsearch tool like the code i have shown above.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. macOS, Linux, Windows]: macOS
  • Python version(python -V): 3.13.2
  • ADK version(pip show google-adk):
 Name: google-adk
Version: 1.15.1
Summary: Agent Development Kit
Home-page: https://google.github.io/adk-docs/
Author: 
Author-email: Google LLC <[email protected]>
License: 
Location: /Users/samarthagarwal/dev/313adkvenv/lib/python3.13/site-packages
Requires: absolufy-imports, anyio, authlib, click, fastapi, google-api-python-client, google-cloud-aiplatform, google-cloud-bigtable, google-cloud-secret-manager, google-cloud-spanner, google-cloud-speech, google-cloud-storage, google-genai, graphviz, mcp, opentelemetry-api, opentelemetry-exporter-gcp-logging, opentelemetry-exporter-gcp-monitoring, opentelemetry-exporter-gcp-trace, opentelemetry-exporter-otlp-proto-http, opentelemetry-resourcedetector-gcp, opentelemetry-sdk, pydantic, python-dateutil, python-dotenv, PyYAML, requests, sqlalchemy, sqlalchemy-spanner, starlette, tenacity, typing-extensions, tzlocal, uvicorn, watchdog, websockets
Required-by:

Model Information:

  • Are you using LiteLLM: Yes
  • Which model is being used: gemini-2.5-flash-lite

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bot triaged[Bot] This issue is triaged by ADK bottools[Component] This issue is related to tools

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions