diff --git a/docs/docs/Components/mcp-client.md b/docs/docs/Components/mcp-client.md index cd698e731..2c1e3f087 100644 --- a/docs/docs/Components/mcp-client.md +++ b/docs/docs/Components/mcp-client.md @@ -9,7 +9,7 @@ import Icon from "@site/src/components/icon"; Langflow integrates with the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) as both an MCP server and an MCP client. -This page describes how to use Langflow as an MCP client with the [**MCP Tools** component](#use-the-mcp-tools-component) component and your [connected MCP servers](#manage-connected-mcp-servers). +This page describes how to use Langflow as an MCP client with the [MCP Tools](#use-the-mcp-tools-component) component and the [MCP servers](#manage-connected-mcp-servers) page in **Settings**. For information about using Langflow as an MCP server, see [Use Langflow as an MCP server](/mcp-server). diff --git a/docs/docs/Tutorials/agent.md b/docs/docs/Tutorials/agent.md new file mode 100644 index 000000000..f5d8b7629 --- /dev/null +++ b/docs/docs/Tutorials/agent.md @@ -0,0 +1,177 @@ +--- +title: Connect applications to agents +slug: /agent-tutorial +--- + +import Icon from "@site/src/components/icon"; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +This tutorial shows you how to connect a JavaScript application to a Langflow [agent](/agents). + +With the agent connected, your application can use any connected tools to retrieve more contextual and timely data without changing any application code. The tools are selected by the agent's internal LLM to solve problems and answer questions. + +## Prerequisites + +- [A running Langflow instance](/get-started-installation) +- [A Langflow API key](/configuration-api-keys) +- [An OpenAI API key](https://platform.openai.com/api-keys) +- [Langflow JavaScript client installed](/typescript-client) + +This tutorial uses an OpenAI LLM. If you want to use a different provider, you need a valid credential for that provider. + +## Create an agentic flow + +The following steps modify the [**Simple agent**](/simple-agent) template to connect [**Directory**](/components-data#directory) and [**Web search**](/components-data#web-search) components as tools for an **Agent** component. +The **Directory** component loads all files of a given type from a target directory on your local machine, and the **Web search** component performs a DuckDuckGo search. +When connected to an **Agent** component as tools, the agent has the option to use these components when handling requests. + +1. In Langflow, click **New Flow**, and then select the **Simple agent** template. +2. Remove the **URL** and **Calculator** tools, and then drag the [**Directory**](/components-data#directory) and [**Web search**](/components-data#web-search) components into your workspace. +3. In the **Directory** component's **Path** field, enter the directory path and file types that you want to make available to the **Agent** component. + + In this tutorial, the agent needs access to a record of customer purchases, so the directory name is `customer_orders` and the file type is `.csv`. Later in this tutorial, the agent will be prompted to find `email` values in the customer data. + + You can adapt the tutorial to suit your data, or, to follow along with the tutorial, you can download [`customer-orders.csv`](/files/customer_orders/customer_orders.csv) and save it in a `customer_orders` folder on your local machine. +4. In the [component header menu](/concepts-components#component-menus) for the **Directory** and **Web search** components, enable **Tool Mode** so you can use the components with an agent. + +5. For both tool components, connect the **Toolset** port to the Agent component's **Tools** port. +6. In the **Agent** component, enter your OpenAI API key. + + If you want to use a different provider or model, edit the **Model Provider**, **Model Name**, and **API Key** fields accordingly. + +7. To test the flow, click