Configure tools for agents
Configure tools connected to agents to extend their capabilities.
Edit a tool component's actions
To edit a tool's actions, in the tool component, click Edit Tools to modify its name
, description
, or enabled
metadata.
These fields help connected agents understand how to use the action, without having to modify the agent's prompt instructions.
For example, the URL component has two actions available when Tool Mode is enabled:
Tool Name | Description | Enabled |
---|---|---|
fetch_content | Fetch content from web pages recursively | true |
fetch_content_as_message | Fetch web content formatted as messages | true |
A Langflow Agent has a clear idea of each tool's capabilities based on the name
and description
metadata. The enabled
boolean controls the tool's availability to the agent. If you think an agent is using a tool incorrectly, edit a tool's description
metadata to help the agent better understand the tool.
Tool names and descriptions can be edited, but the default tool identifiers cannot be changed. If you want to change the tool identifier, create a custom component.
Use an agent as a tool
The agent component itself also supports Tool Mode for creating multi-agent flows.
Add an agent to your flow that uses a different OpenAI model for a larger context window.
- Create the Simple agent starter flow.
- Add a second agent component to the flow.
- Add your Open AI API Key to the Agent component.
- In the Model Name field, select
gpt-4.1
. - Click Tool Mode to use this new agent as a tool.
- Connect the new agent's Toolset port to the previously created agent's Tools port.
The new agent will use
gpt-4.1
for the larger tasks of scraping and searching information that require large context windows. The previously created agent will now use this agent as a tool, with its unique LLM and toolset.
- The new agent's actions can be edited to help the agent understand how to use it.
Click Edit Tools to modify its
name
,description
, orenabled
metadata. For example, the default tool name isAgent
. Edit the name toAgent-gpt-41
, and edit the description toUse the gpt-4.1 model for complex problem solving
. The connected agent will understand that this is thegpt-4.1
agent, and will use it for tasks requiring a larger context window.
Add custom components as tools
An agent can use custom components as tools.
-
To add a custom component to the agent flow, click New Custom Component.
-
Add custom Python code to the custom component. For example, to create a text analyzer component, paste the below code into the custom component's Code pane.
Python
_50from langflow.custom import Component_50from langflow.io import MessageTextInput, Output_50from langflow.schema import Data_50import re_50_50class TextAnalyzerComponent(Component):_50 display_name = "Text Analyzer"_50 description = "Analyzes and transforms input text."_50 documentation: str = "http://docs.langflow.org/components/custom"_50 icon = "chart-bar"_50 name = "TextAnalyzerComponent"_50_50 inputs = [_50 MessageTextInput(_50 name="input_text",_50 display_name="Input Text",_50 info="Enter text to analyze",_50 value="Hello, World!",_50 tool_mode=True,_50 ),_50 ]_50_50 outputs = [_50 Output(display_name="Analysis Result", name="output", method="analyze_text"),_50 ]_50_50 def analyze_text(self) -> Data:_50 text = self.input_text_50_50 # Perform text analysis_50 word_count = len(text.split())_50 char_count = len(text)_50 sentence_count = len(re.findall(r'\w+[.!?]', text))_50_50 # Transform text_50 reversed_text = text[::-1]_50 uppercase_text = text.upper()_50_50 analysis_result = {_50 "original_text": text,_50 "word_count": word_count,_50 "character_count": char_count,_50 "sentence_count": sentence_count,_50 "reversed_text": reversed_text,_50 "uppercase_text": uppercase_text_50 }_50_50 data = Data(value=analysis_result)_50 self.status = data_50 return data
- To use the custom component as a tool, click Tool Mode.
- Connect the custom component's tool output to the agent's tools input.
- Open the Playground and instruct the agent,
Use the text analyzer on this text: "Agents really are thinking machines!"
Response
_11AI_11gpt-4o_11Finished_110.6s_11Here is the analysis of the text "Agents really are thinking machines!":_11Original Text: Agents really are thinking machines!_11Word Count: 5_11Character Count: 36_11Sentence Count: 1_11Reversed Text: !senihcam gnikniht era yllaer stnegA_11Uppercase Text: AGENTS REALLY ARE THINKING MACHINES!
The agent correctly calls the analyze_text
action and returns the result to the Playground.
Make any component a tool
If the component you want to use as a tool doesn't have a Tool Mode button, add tool_mode=True
to one of the component's inputs, and connect the new Toolset output to the agent's Tools input.
Langflow supports Tool Mode for the following data types:
DataInput
DataFrameInput
PromptInput
MessageTextInput
MultilineInput
DropdownInput
For example, the components as tools example above adds tool_mode=True
to the MessageTextInput
input so the custom component can be used as a tool.
_10inputs = [_10 MessageTextInput(_10 name="input_text",_10 display_name="Input Text",_10 info="Enter text to analyze",_10 value="Hello, World!",_10 tool_mode=True,_10 ),_10]
Use flows as tools
An agent can use flows that are saved in your workspace as tools with the Run flow component.
- To add a Run flow component, click and drag a Run flow component to your workspace.
- Select the flow you want the agent to use as a tool.
- Enable Tool Mode in the component. The Run flow component displays your flow as an available action.
- Connect the Run flow component's tool output to the agent's tools input.
- Ask the agent,
What tools are you using to answer my questions?
Your flow should be visible in the response as a tool. - Ask the agent to specifically use the connected tool to answer your question. The connected flow returns an answer based on your question. For example, a Basic Prompting flow connected as a tool returns a different result depending upon its LLM and prompt instructions.