Node Details

  • Name: chainTool

  • Type: ChainTool

  • Version: 1.0

  • Category: Tools

  • Description: Use a chain as allowed tool for agent

Parameters

  1. Chain Name

    • Type: string

    • Description: A unique identifier for the chain tool

    • Example: “state-of-union-qa”

  2. Chain Description

    • Type: string

    • Description: A detailed description of what the chain does and when it should be used

    • Example: “State of the Union QA - useful for when you need to ask questions about the most recent state of the union address.”

  3. Return Direct

    • Type: boolean

    • Optional: Yes

    • Description: Determines whether the tool should return its result directly or wrap it in a response

  4. Base Chain

    • Type: BaseChain

    • Description: The LangChain chain to be used as the core functionality of this tool

Input/Output

Input

The node takes in the following inputs during initialization:

  • Chain Name (string)

  • Chain Description (string)

  • Return Direct (boolean, optional)

  • Base Chain (BaseChain object)

Output

The node outputs a ChainTool object that can be used in agent configurations.

Functionality

The ChainTool node creates a tool that wraps a LangChain chain, allowing it to be used as part of an agent’s toolkit. This enables the agent to leverage complex chain-based operations when needed.

Key aspects of its functionality include:

  1. Naming and describing the tool for clear identification by the agent

  2. Integrating a BaseChain object as the core functionality

  3. Optional direct return of results, bypassing standard response formatting

Use Cases

This node is particularly useful in scenarios where you want to:

  • Incorporate specialized question-answering chains into a more general agent

  • Allow an agent to access and utilize complex, multi-step operations encapsulated in a chain

  • Provide agents with tools that can perform in-depth analysis or processing on specific topics or datasets

Example

A common use case might be creating a tool that uses a QA chain to answer questions about a specific document or topic, such as the State of the Union address mentioned in the placeholder. This tool could then be used alongside other tools in an agent designed to answer general questions about government and politics.