8000 Function is not found in the tools_dict · Issue #1532 · google/adk-python · GitHub
[go: up one dir, main page]

Skip to content
Function is not found in the tools_dict #1532
Open
@JinjiaoBigKingH

Description

@JinjiaoBigKingH

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

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

root_agent = LlmAgent(
    name="sql_agent",
    model=qwen_max_model,
    instruction=new_state_string_template_instruction_provider(SQL_AGENT_PROMPT_v2),
    tools=[search_table_from_server,
           execute_sql_from_server,
           gen_chart_json_by_sql_result]
)

Screenshots
running exception

2025-06-20 11:08:32,170 - ERROR - fast_api.py:804 - Error in event_generator: Function  is not found in the tools_dict.
Traceback (most recent call last):
  File "/Users/hhh/Documents/workspace/teamwork/market-gpt-python/.venv/lib/python3.13/site-packages/google/adk/cli/fast_api.py", line 793, in event_generator
    async for event in runner.run_async(
    ...<8 lines>...
      yield f"data: {sse_event}\n\n"
  File "/Users/hhh/Documents/workspace/teamwork/market-gpt-python/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 198, in run_async
    async for event in invocation_context.agent.run_async(invocation_context):
    ...<2 lines>...
      yield event
  File "/Users/hhh/Documents/workspace/teamwork/market-gpt-python/.venv/lib/python3.13/site-packages/google/adk/agents/base_agent.py", line 147, in run_async
    async for event in self._run_async_impl(ctx):
      yield event
  File "/Users/hhh/Documents/workspace/teamwork/market-gpt-python/.venv/lib/python3.13/site-packages/google/adk/agents/llm_agent.py", line 273, in _run_async_impl
    async for event in self._llm_flow.run_async(ctx):
      self.__maybe_save_output_to_state(event)
      yield event
  File "/Users/hhh/Documents/workspace/teamwork/market-gpt-python/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 282, in run_async
    async for event in self._run_one_step_async(invocation_context):
      last_event = event
      yield event
  File "/Users/hhh/Documents/workspace/teamwork/market-gpt-python/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 318, in _run_one_step_async
    async for event in self._postprocess_async(
    ...<4 lines>...
      yield event
  File "/Users/hhh/Documents/workspace/teamwork/market-gpt-python/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 390, in _postprocess_async
    async for event in self._postprocess_handle_function_calls_async(
    ...<2 lines>...
      yield event
  File "/Users/hhh/Documents/workspace/teamwork/market-gpt-python/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 465, 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/hhh/Documents/workspace/teamwork/market-gpt-python/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/functions.py", line 145, in handle_function_calls_async
    tool, tool_context = _get_tool_and_context(
                         ~~~~~~~~~~~~~~~~~~~~~^
        invocation_context,
        ^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        tools_dict,
        ^^^^^^^^^^^
    )
    ^
  File "/Users/hhh/Documents/workspace/teamwork/market-gpt-python/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/functions.py", line 415, in _get_tool_and_context
    raise ValueError(
        f'Function {function_call.name} is not found in the tools_dict.'
    )

model response:


2025-06-20 11:08:31,037 - INFO - agent.py:37 - after_model_callback llm request system prompts -> content=Content(parts=[Part(video_metadata=None, thought=None, inline_data=None, file_data=None, thought_signature=None, code_execution_result=None, executable_code=None, function_call=FunctionCall(id='call_09b1ff6f7ae24cf8986713', args={'question': '6月新增客户目标达成量最多的20个销售分别是谁'}, name='search_table_from_server'), function_response=None, text=None), Part(video_metadata=None, thought=None, inline_data=None, file_data=None, thought_signature=None, code_execution_result=None, executable_code=None, function_call=FunctionCall(id='1', args={}, name=''), function_response=None, text=None)], role='model') grounding_metadata=None partial=False turn_complete=None error_code=None error_message=None interrupted=None custom_metadata=None usage_metadata=None

Desktop (please complete the following information):

  • OS: [Mac]
  • Python version(3.12):
  • ADK version(1.3.0):

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0