--- title: Connect applications to agents slug: /agent-tutorial --- import Icon from "@site/src/components/icon"; This tutorial shows you how to connect a JavaScript application to a [Langflow agent](/agents). With an agent, 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 * [Install and start Langflow](/get-started-installation) * Create a [Langflow API key](/api-keys-and-authentication) * Install the [Langflow JavaScript client](/typescript-client) * Create an [OpenAI API key](https://platform.openai.com/api-keys) This tutorial uses an OpenAI LLM. If you want to use a different provider, you need a valid credential for that provider. ## Create an agent flow The following steps modify the **Simple Agent** template to connect a [**Read File** component](/read-file) and a [**Web Search** component](/web-search) as tools for an **Agent** component. The **Read File** component loads a file you upload to Langflow, 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 add **Read File** and **Web Search** components to your flow. 3. In the **Read File** component, upload the file you want to make available to the **Agent** component. In this tutorial, the agent needs access to a record of customer purchases. 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.csv). Upload `customer-orders.csv` to the **Read File** component by clicking the file upload field and selecting the file. Later in this tutorial, the agent will be prompted to find `email` values in the customer data. 4. In the **Read File** and **Web Search** [components' header menus](/concepts-components#component-menus), enable **Tool Mode** so you can use the components with an agent. 5. Connect the **Read File** and **Web Search** components' **Toolset** ports 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