docs/versioned_docs/version-1.8.0/Components/bundles-langchain.mdx
import Icon from "@site/src/components/icon";
<Icon name="Blocks" aria-hidden="true" /> Bundles contain custom components that support specific third-party integrations with Langflow.
This page describes the components that are available in the LangChain bundle.
:::warning Security
Setting allow_dangerous_code to true allows the agent to execute arbitrary, LLM-generated Python code at runtime on the Langflow server.
This code can do anything that Python can do, so use this option only with trusted data and in a secure environment.
For more information, see CVE-2024-21513.
:::
This component is based on the Agent core component.
This component creates a CSV agent from a CSV file and LLM. For more information, see the LangChain CSV agent documentation.
| Name | Type | Description |
|---|---|---|
| allow_dangerous_code | Input parameter. | Default: false. Set to true to allow the agent to execute arbitrary Python code. For more information, see the CSV Agent security warning. |
| llm | LanguageModel | Input parameter. The language model to use for the agent. |
| path | File | Input parameter. The path to the CSV file. |
| agent_type | String | Input parameter. The type of agent to create. |
| agent | AgentExecutor | Output parameter. The CSV agent instance. |
This component is based on the Agent core component.
This component creates an OpenAI Tools Agent. For more information, see the LangChain OpenAI agent documentation.
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | Input parameter. The language model to use. |
| tools | List of Tools | Input parameter. The tools to give the agent access to. |
| system_prompt | String | Input parameter. The system prompt to provide context to the agent. |
| input_value | String | Input parameter. The user's input to the agent. |
| memory | Memory | Input parameter. The memory for the agent to use for context persistence. |
| max_iterations | Integer | Input parameter. The maximum number of iterations to allow the agent to execute. |
| verbose | Boolean | Input parameter. This determines whether to print out the agent's intermediate steps. |
| handle_parsing_errors | Boolean | Input parameter. This determines whether to handle parsing errors in the agent. |
| agent | AgentExecutor | Output parameter. The OpenAI Tools agent instance. |
| output | String | Output parameter. The output from executing the agent on the input. |
This component is based on the Agent core component.
This component creates an agent for interacting with OpenAPI services. For more information, see the LangChain OpenAPI toolkit documentation.
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | Input parameter. The language model to use. |
| openapi_spec | String | Input parameter. The OpenAPI specification for the service. |
| base_url | String | Input parameter. The base URL for the API. |
| headers | Dict | Input parameter. The optional headers for API requests. |
| agent_executor_kwargs | Dict | Input parameter. The optional parameters for the agent executor. |
| agent | AgentExecutor | Output parameter.The OpenAPI agent instance. |
This component fetches prompts from the LangChain Hub.
Like the Prompt Template core component, additional fields are added to the component for each variable in the prompt.
For example, the default prompt efriis/my-first-prompt adds fields for profession and question.
| Name | Display Name | Description |
|---|---|---|
| langchain_api_key | Your LangChain API Key | Input parameter. The LangChain API Key to use. |
| langchain_hub_prompt | LangChain Hub Prompt | Input parameter. The LangChain Hub prompt to use. |
| prompt | Build Prompt | Output parameter. The built prompt message returned by the build_prompt method. |
This component is based on the Agent core component.
This component creates an agent for interacting with SQL databases. For more information, see the LangChain SQL agent documentation.
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | Input parameter. The language model to use. |
| database | Database | Input parameter. The SQL database connection. |
| top_k | Integer | Input parameter. The number of results to return from a SELECT query. |
| use_tools | Boolean | Input parameter. This determines whether to use tools for query execution. |
| return_intermediate_steps | Boolean | Input parameter. This determines whether to return the agent's intermediate steps. |
| max_iterations | Integer | Input parameter. The maximum number of iterations to run the agent. |
| max_execution_time | Integer | Input parameter. The maximum execution time in seconds. |
| early_stopping_method | String | Input parameter. The method to use for early stopping. |
| verbose | Boolean | Input parameter. This determines whether to print the agent's thoughts. |
| agent | AgentExecutor | Output parameter. The SQL agent instance. |
The LangChain SQL Database component establishes a connection to an SQL database.
This component is different from the SQL Database core component, which executes SQL queries on SQLAlchemy-compatible databases.
The LangChain bundle includes the following text splitter components:
This component is based on the Agent core component.
This component creates an agent for structured tool calling with various language models. For more information, see the LangChain tool calling documentation.
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | Input parameter. The language model to use. |
| tools | List[Tool] | Input parameter. The list of tools available to the agent. |
| system_message | String | Input parameter. The system message to use for the agent. |
| return_intermediate_steps | Boolean | Input parameter. This determines whether to return the agent's intermediate steps. |
| max_iterations | Integer | Input parameter. The maximum number of iterations to run the agent. |
| max_execution_time | Integer | Input parameter. The maximum execution time in seconds. |
| early_stopping_method | String | Input parameter. The method to use for early stopping. |
| verbose | Boolean | Input parameter. This determines whether to print the agent's thoughts. |
| agent | AgentExecutor | Output parameter. The tool calling agent instance. |
This component is based on the Agent core component.
This component creates an XML Agent using LangChain. The agent uses XML formatting for tool instructions to the LLM. For more information, see the LangChain XML Agent documentation.
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | Input parameter. The language model to use for the agent. |
| user_prompt | String | Input parameter. The custom prompt template for the agent with XML formatting instructions. |
| tools | List[Tool] | Input parameter. The list of tools available to the agent. |
| agent | AgentExecutor | Output parameter. The XML Agent instance. |
Other components in the LangChain bundle include the following:
import PartialLegacy from '@site/docs/_partial-legacy.mdx';
<PartialLegacy />The following LangChain components are in legacy status:
To replace these components, consider other components in the LangChain bundle or general Langflow components, such as the Agent component or the SQL Database component.