import { ... } from "@langchain/core/tools";Whether or not the tool is one of StructuredTool, RunnableTool or StructuredToolParams.
It returns is StructuredToolParams since that is the most minimal interface of the three,
while still containing the necessary properties to be passed to a LLM for tool calling.
Confirm whether the inputted tool is an instance of RunnableToolLike.
Confirm whether the inputted tool is an instance of StructuredToolInterface.
Confirm whether or not the tool contains the necessary properties to be considered a StructuredToolParams.
Creates a new StructuredTool instance with the provided function, name, description, and schema.
Schema can be provided as Zod or JSON schema, and both will be validated.
Abstract base class for toolkits in LangChain. Toolkits are collections
of tools that agents can use. Subclasses must implement the tools
property to provide the specific tools for the toolkit.
A tool that can be created dynamically from a function, name, and description, designed to work with structured data. It extends the StructuredTool class and overrides the _call method to execute the provided function when the tool is called.
Schema can be passed as Zod or JSON schema. The tool will not validate input if JSON schema is passed.
A tool that can be created dynamically from a function, name, and description.
Base class for Tools that accept input of any shape defined by a Zod schema.
Base class for Tools that accept input as a string.
Custom error class used to handle exceptions related to tool input parsing.
It extends the built-in Error class and adds an optional output
property that can hold the output that caused the exception.
Base interface for the input parameters of the DynamicTool and DynamicStructuredTool classes.
Interface for the input parameters of the DynamicStructuredTool class.
Interface for the input parameters of the DynamicTool class.
Interface that defines the shape of a LangChain structured tool.
A structured tool is a tool that uses a schema to define the structure of the arguments that the LLM generates as part of its ToolCall.
Schema for defining tools.
A special interface for tools that accept a string input, usually defined with the Tool class.
Parameters for the Tool classes.
Defines the type that will be passed into a tool handler function as a result of a tool call.
Conditional type that determines the return type of the StructuredTool.invoke method.
Runtime context automatically injected into tools.
When a tool function has a parameter named tool_runtime with type hint
ToolRuntime, the tool execution system will automatically inject an instance
containing:
state: The current graph statetoolCallId: The ID of the current tool callconfig: RunnableConfig for the current executioncontext: Runtime contextstore: BaseStore instance for persistent storagewriter: Stream writer for streaming outputNo Annotated wrapper is needed - just use runtime: ToolRuntime
as a parameter.
Base type that establishes the types of input schemas that can be used for LangChain tool definitions.