Skip to content

Errors regarding the use of the tool #34045

@as775116191

Description

@as775116191

Checked other resources

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-cli
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-perplexity
  • langchain-prompty
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Example Code (Python)

from langchain.tools import tool, ToolRuntime
from langchain_openai import ChatOpenAI

model = ChatOpenAI(model="gpt-5-pro-2025-10-06", streaming=False, output_version="responses/v1"class CreateNewTopicArgs(BaseModel):
    topic_data: dict

@tool(description="create_new_topic", args_schema=CreateNewTopicArgs)
def create_new_topic(topic_data: dict, runtime: ToolRuntime[Context]):
    meeting_id = runtime.context.meeting_id
    with open(f"temp/{meeting_id}.json", "r") as f:
        json_data = json.load(f)
        json_data.append(topic_data)
        with open(f"temp/{meeting_id}.json", "w") as f:
            json.dump(json_data, f)
        return "a new topic create"

summery_agent = create_agent(
    model=model,
    system_prompt="""
You are a “Meeting Stage Summary Agent,” responsible for converting segments of meeting transcripts into structured data organized by “topic dimensions,” while maintaining topic continuity across multiple meeting segments.
You do not engage in small talk; you focus solely on useful information related to business, decisions, issues, and actions.

Your goals:

Identify one or more “topics” mentioned in a meeting segment.

Convert each topic into structured data, keeping only information valuable for subsequent collaboration (such as problems, objectives, consensus, disagreements, decisions, action items, unresolved issues, etc.).

Compare new meeting transcripts with previously generated topic data to determine whether:

they continue existing topics (incremental updates to old topics), or

they introduce new topics (which should be added without altering existing ones).

Fabrication of information is strictly forbidden: do not include anything that cannot be confirmed from the current meeting segment + previously structured data.

Possible inputs you may receive:

A segment of meeting transcript (each line formatted as: [index]: [text])

Summary data of previously identified topics (if available)

Your workflow:

If no previous topic summary exists, identify all topics in the meeting segment and convert each into structured data.

If previous topic summaries exist, compare the new meeting transcript with the existing topic data to determine whether the topics are continued or new.

If a topic shift occurs, review all historical topics to check for relevant associations; if associations exist, refer to them when generating new topic data.

If the segment continues an existing topic, update the old topic with incremental changes.
    """,
    context_schema=Context,
    tools=[create_new_topic]
)

result = summery_agent.invoke({
            "messages": [
                HumanMessage(content="This is the latest meeting minutes:......")
            ]
        })

Error Message and Stack Trace (if applicable)

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "E:\code\meeting\app\agent\summary_agent\agent.py", line 155, in <module>
    result = summery_agent.invoke({
             ^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\pregel\main.py", line 3050, in invoke
    for chunk in self.stream(
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\pregel\main.py", line 2633, in stream
    for _ in runner.tick(
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\pregel\_runner.py", line 167, in tick
    run_with_retry(
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\pregel\_retry.py", line 42, in run_with_retry
    return task.proc.invoke(task.input, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\_internal\_runnable.py", line 656, in invoke
    input = context.run(step.invoke, input, config, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\_internal\_runnable.py", line 400, in invoke
    ret = self.func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\prebuilt\tool_node.py", line 727, in _func
    outputs = list(
              ^^^^^
  File "C:\Users\wayneChen\AppData\Roaming\uv\python\cpython-3.11.7-windows-x86_64-none\Lib\concurrent\futures\_base.py", line 619, in result_iterator    
    yield _result_or_cancel(fs.pop())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wayneChen\AppData\Roaming\uv\python\cpython-3.11.7-windows-x86_64-none\Lib\concurrent\futures\_base.py", line 317, in _result_or_cancel  
    return fut.result(timeout)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wayneChen\AppData\Roaming\uv\python\cpython-3.11.7-windows-x86_64-none\Lib\concurrent\futures\_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wayneChen\AppData\Roaming\uv\python\cpython-3.11.7-windows-x86_64-none\Lib\concurrent\futures\_base.py", line 401, in __get_result       
    raise self._exception
  File "C:\Users\wayneChen\AppData\Roaming\uv\python\cpython-3.11.7-windows-x86_64-none\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langchain_core\runnables\config.py", line 546, in _wrapped_fn
    return contexts.pop().run(fn, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\prebuilt\tool_node.py", line 942, in _run_one
    return self._execute_tool_sync(tool_request, input_type, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\prebuilt\tool_node.py", line 891, in _execute_tool_sync
    content = _handle_tool_error(e, flag=self._handle_tool_errors)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\prebuilt\tool_node.py", line 404, in _handle_tool_error
    content = flag(e)  # type: ignore [assignment, call-arg]
              ^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\prebuilt\tool_node.py", line 361, in _default_handle_tool_errors
    raise e
  File "E:\code\meeting\.venv\Lib\site-packages\langgraph\prebuilt\tool_node.py", line 844, in _execute_tool_sync
    response = tool.invoke(call_args, config)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langchain_core\tools\base.py", line 605, in invoke
    return self.run(tool_input, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langchain_core\tools\base.py", line 932, in run
    raise error_to_raise
  File "E:\code\meeting\.venv\Lib\site-packages\langchain_core\tools\base.py", line 898, in run
    response = context.run(self._run, *tool_args, **tool_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\meeting\.venv\Lib\site-packages\langchain_core\tools\structured.py", line 93, in _run
    return self.func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: create_new_topic() missing 1 required positional argument: 'runtime'
During task with name 'tools' and id '23e0e222-4890-fe62-e689-2f9499c2fb78'

Description

Since upgrading to version 1.0, my LangChain has been unable to call tools. It keeps showing an error saying that the runtime parameter is missing, even though the documentation states that it should be injected automatically. I also tried copying and running the sample code from the documentation, but the same error occurred. I have tried uninstalling and reinstalling LangChain, and I also created a completely new project and followed the installation instructions, but nothing worked. So I’m seeking help and hope to get some guidance. Thank you.

System Info

System Information

OS: Windows
OS Version: 10.0.22621
Python Version: 3.11.7 (main, Jan 8 2024, 06:21:35) [MSC v.1929 64 bit (AMD64)]

Package Information

langchain_core: 1.0.7
langchain: 1.0.8
langsmith: 0.4.43
langchain_openai: 1.0.3
langgraph_sdk: 0.2.9

Optional packages not installed

langserve

Other Dependencies

httpx: 0.28.1
jsonpatch: 1.33
langgraph: 1.0.3
openai: 2.8.1
opentelemetry-api: 1.37.0
opentelemetry-exporter-otlp-proto-http: 1.37.0
opentelemetry-sdk: 1.37.0
orjson: 3.11.4
packaging: 25.0
pydantic: 2.12.4
pyyaml: 6.0.3
requests: 2.32.5
requests-toolbelt: 1.0.0
rich: 14.2.0
tenacity: 9.1.2
tiktoken: 0.12.0
typing-extensions: 4.15.0
zstandard: 0.25.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugRelated to a bug, vulnerability, unexpected error with an existing featurelangchainRelated to the package `langchain`

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions