Skip to main content

Tool components in Langflow

Tools are typically connected to agent components at the Tools port. Agents use LLMs as a reasoning engine to decide which of the connected tool components to use to solve a problem.

Tools in agentic functions are, essentially, functions that the agent can call to perform tasks or access external resources. A function is wrapped as a Tool object, with a common interface the agent understands. Agents become aware of tools through tool registration, where the agent is provided a list of available tools, typically at agent initialization. The Tool object's description tells the agent what the tool can do.

The agent then uses a connected LLM to reason through the problem to decide which tool is best for the job.

Use a tool in a flow

Tools are typically connected to agent components at the Tools port.

The simple agent starter project uses URL and Calculator tools connected to an agent component to answer a user's questions. The OpenAI LLM acts as a brain for the agent to decide which tool to use.

Simple agent starter flow

To make a component into a tool that an agent can use, enable Tool mode in the component. Enabling Tool mode modifies a component input to accept calls from an agent. If the component you want to connect to an agent doesn't have a Tool mode option, you can modify the component's inputs to become a tool. For an example, see Make any component a tool.

Astra DB Tool

The Astra DB Tool allows agents to connect to and query data from Astra DB collections.

Inputs

NameTypeDescription
Tool NameStringThe name used to reference the tool in the agent's prompt.
Tool DescriptionStringA brief description of the tool. This helps the model decide when to use it.
Collection NameStringThe name of the Astra DB collection to query.
TokenSecretStringThe authentication token for accessing Astra DB.
API EndpointStringThe Astra DB API endpoint.
Projection FieldsStringThe attributes to return, separated by commas. Default: "*".
Tool ParametersDictParameters the model needs to fill to execute the tool. For required parameters, use an exclamation mark (for example, !customer_id).
Static FiltersDictAttribute-value pairs used to filter query results.
LimitStringThe number of documents to return.

Outputs

The Data output is primarily used when directly querying Astra DB, while the Tool output is used when integrating with LangChain agents or chains.

NameTypeDescription
DataList[Data]A list of Data objects containing the query results from Astra DB. Each Data object contains the document fields specified by the projection attributes. Limited by the number_of_results parameter.
ToolStructuredToolA LangChain StructuredTool object that can be used in agent workflows. Contains the tool name, description, argument schema based on tool parameters, and the query function.

Astra DB CQL Tool

The Astra DB CQL Tool allows agents to query data from CQL tables in Astra DB.

The main difference between this tool and the Astra DB Tool is that this tool is specifically designed for CQL tables and requires partition keys for querying, while also supporting clustering keys for more specific queries.

Inputs

NameTypeDescription
Tool NameStringThe name used to reference the tool in the agent's prompt.
Tool DescriptionStringA brief description of the tool to guide the model in using it.
KeyspaceStringThe name of the keyspace.
Table NameStringThe name of the Astra DB CQL table to query.
TokenSecretStringThe authentication token for Astra DB.
API EndpointStringThe Astra DB API endpoint.
Projection FieldsStringThe attributes to return, separated by commas. Default: "*".
Partition KeysDictRequired parameters that the model must fill to query the tool.
Clustering KeysDictOptional parameters the model can fill to refine the query. Required parameters should be marked with an exclamation mark (for example, !customer_id).
Static FiltersDictAttribute-value pairs used to filter query results.
LimitStringThe number of records to return.

Outputs

NameTypeDescription
DataList[Data]A list of Data objects containing the query results from the Astra DB CQL table. Each Data object contains the document fields specified by the projection fields. Limited by the number_of_results parameter.
ToolStructuredToolA LangChain StructuredTool object that can be used in agent workflows. Contains the tool name, description, argument schema based on partition and clustering keys, and the query function.

Bing Search API

This component allows you to call the Bing Search API.

Inputs

NameTypeDescription
bing_subscription_keySecretStringBing API subscription key
input_valueStringSearch query input
bing_search_urlStringCustom Bing Search URL (optional)
kIntegerNumber of search results to return

Outputs

NameTypeDescription
resultsList[Data]List of search results
toolToolBing Search tool for use in LangChain

Calculator Tool

This component creates a tool for performing basic arithmetic operations on a given expression.

Inputs

NameTypeDescription
expressionStringThe arithmetic expression to evaluate (e.g., 4*4*(33/22)+12-20).

Outputs

NameTypeDescription
resultToolCalculator tool for use in LangChain

This component allows you to evaluate basic arithmetic expressions. It supports addition, subtraction, multiplication, division, and exponentiation. The tool uses a secure evaluation method that prevents the execution of arbitrary Python code.

Combinatorial Reasoner

This component runs Icosa's Combinatorial Reasoning (CR) pipeline on an input to create an optimized prompt with embedded reasons. Sign up for access here: https://forms.gle/oWNv2NKjBNaqqvCx6

Inputs

NameDisplay NameDescription
promptPromptInput to run CR on
openai_api_keyOpenAI API KeyOpenAI API key for authentication
usernameUsernameUsername for Icosa API authentication
passwordPasswordPassword for Icosa API authentication
model_nameModel NameOpenAI LLM to use for reason generation

Outputs

NameDisplay NameDescription
optimized_promptOptimized PromptA message object containing the optimized prompt
reasonsSelected ReasonsA list of the selected reasons that are embedded in the optimized prompt

Glean Search API

This component allows you to call the Glean Search API.

Inputs

NameTypeDescription
glean_api_urlStringURL of the Glean API
glean_access_tokenSecretStringAccess token for Glean API authentication
queryStringSearch query input
page_sizeIntegerNumber of results per page (default: 10)
request_optionsDictAdditional options for the API request (optional)

Outputs

NameTypeDescription
resultsList[Data]List of search results
toolToolGlean Search tool for use in LangChain

Google Search API

This component allows you to call the Google Search API.

Inputs

NameTypeDescription
google_api_keySecretStringGoogle API key for authentication
google_cse_idSecretStringGoogle Custom Search Engine ID
input_valueStringSearch query input
kIntegerNumber of search results to return

Outputs

NameTypeDescription
resultsList[Data]List of search results
toolToolGoogle Search tool for use in LangChain

Google Serper API

This component allows you to call the Serper.dev Google Search API.

Inputs

NameTypeDescription
serper_api_keySecretStringAPI key for Serper.dev authentication
input_valueStringSearch query input
kIntegerNumber of search results to return

Outputs

NameTypeDescription
resultsList[Data]List of search results
toolToolGoogle Serper search tool for use in LangChain

Python Code Structured Tool

This component creates a structured tool from Python code using a dataclass.

The component dynamically updates its configuration based on the provided Python code, allowing for custom function arguments and descriptions.

Inputs

NameTypeDescription
tool_codeStringPython code for the tool's dataclass
tool_nameStringName of the tool
tool_descriptionStringDescription of the tool
return_directBooleanWhether to return the function output directly
tool_functionStringSelected function for the tool
global_variablesDictGlobal variables or data for the tool

Outputs

NameTypeDescription
result_toolTool │ Structured tool created from the Python code

Python REPL Tool

This component creates a Python REPL (Read-Eval-Print Loop) tool for executing Python code.

Inputs

NameTypeDescription
nameStringThe name of the tool (default: "python_repl")
descriptionStringA description of the tool's functionality
global_importsList[String]List of modules to import globally (default: ["math"])

Outputs

NameTypeDescription
toolToolPython REPL tool for use in LangChain

Retriever Tool

This component creates a tool for interacting with a retriever in LangChain.

Inputs

NameTypeDescription
retrieverBaseRetrieverThe retriever to interact with
nameStringThe name of the tool
descriptionStringA description of the tool's functionality

Outputs

NameTypeDescription
toolToolRetriever tool for use in LangChain

SearXNG Search Tool

This component creates a tool for searching using SearXNG, a metasearch engine.

Inputs

NameTypeDescription
urlStringThe URL of the SearXNG instance
max_resultsIntegerMaximum number of results to return
categoriesList[String]Categories to search in
languageStringLanguage for the search results

Outputs

NameTypeDescription
result_toolToolSearXNG search tool for use in LangChain

Search API

This component calls the searchapi.io API. It can be used to search the web for information.

For more information, see the SearchAPI documentation.

Inputs

NameDisplay NameInfo
engineEngineThe search engine to use (default: "google")
api_keySearchAPI API KeyThe API key for authenticating with SearchAPI
input_valueInputThe search query or input for the API call
search_paramsSearch parametersAdditional parameters for customizing the search

Outputs

NameDisplay NameInfo
dataSearch ResultsList of Data objects containing search results
toolSearch API ToolA Tool object for use in LangChain workflows

Serp Search API

This component creates a tool for searching using the Serp API.

Inputs

NameTypeDescription
serpapi_api_keySecretStringAPI key for Serp API authentication
input_valueStringSearch query input
search_paramsDictAdditional search parameters (optional)

Outputs

NameTypeDescription
resultsList[Data]List of search results
toolToolSerp API search tool for use in LangChain

Wikipedia API

This component creates a tool for searching and retrieving information from Wikipedia.

Inputs

NameTypeDescription
input_valueStringSearch query input
langStringLanguage code for Wikipedia (default: "en")
kIntegerNumber of results to return
load_all_available_metaBooleanWhether to load all available metadata (advanced)
doc_content_chars_maxIntegerMaximum number of characters for document content (advanced)

Outputs

NameTypeDescription
resultsList[Data]List of Wikipedia search results
toolToolWikipedia search tool for use in LangChain

Wolfram Alpha API

This component creates a tool for querying the Wolfram Alpha API.

Inputs

NameTypeDescription
input_valueStringQuery input for Wolfram Alpha
app_idSecretStringWolfram Alpha API App ID

Outputs

NameTypeDescription
resultsList[Data]List containing the Wolfram Alpha API response
toolToolWolfram Alpha API tool for use in LangChain

Yahoo Finance News Tool

This component creates a tool for retrieving news from Yahoo Finance.

Inputs

This component does not have any input parameters.

Outputs

NameTypeDescription
toolToolYahoo Finance News tool for use in LangChain

Hi, how can I help you?