Skip to content

[langchain]: When using @tool(args_schema=...) and runtime: ToolRuntime at the same time, an error will be reported #1241

@xueyunlong12589

Description

@xueyunlong12589

Type of issue

issue / bug

Language

Python

Description

I defined a tool as follows:

class WeatherInput(BaseModel):
    """Input for weather queries."""
    location: str = Field(description="City name or coordinates")

@tool(args_schema=WeatherInput)
def get_weather(location: str,runtime: ToolRuntime) -> str:
    """Get current weather"""

but when I run a simple create_agent, the error report: TypeError: get_weather() missing 1 required positional argument: 'runtime'

Metadata

Metadata

Assignees

No one assigned

    Labels

    langchainFor docs changes to LangChain

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions