Simple agent
Build an agentic application using the Agent component.
An agent uses an LLM as its "brain" to select among the connected tools and complete its tasks.
The Agent component contains all of the elements you’ll need for creating an agent, including an LLM model selector, an Agent Instructions field, and a Current Date tool. Instead of managing additional components for LLM providers and prompts, you pick your model, enter instructions for the agent, and connect tools to the agent’s Tools port.
In this flow, the Agent reasons using an Open AI LLM to solve problems. It selects the Calculator tool for simpler math, and the URL tool for research. Using this simple agent as a starting point, connect more tools to create an agent to solve your specific problems.
Open Langflow and start a new flow
-
Click New Flow, and then select the Simple Agent flow. This opens a starter flow with the necessary components to run an agentic application using the Agent component.
The simple agent flow consists of these components:
-
The Text Input component accepts text input.
-
The Chat Output component prints the flow’s output to the chat.
-
The Agent component contains all of the elements required for creating an agent, including an agent prompt, an LLM selector, and a current-date tool.
-
The URL component fetches web content from multiple URLs.
-
The Calculator performs basic arithmetic operations.
Run the simple agent flow
-
Add your credentials to the Open AI component. The fastest and most secure way to add credentials is with Langflow’s Global Variables.
-
Click
Settings, and then click Global Variables. -
Click Add New.
-
Name your variable. Paste your API key in the Value field.
-
In the Apply To Fields field, select the field you want to globally apply this variable to.
-
Click Save Variable.
-
-
Click
Playground to start a chat session. -
Ask a question and include a URL where the agent can begin its research.
Summarize the steps and ingredients for this ramen recipe: https://www.seriouseats.com/rich-and-creamy-tonkotsu-ramen-broth-from-scratch-recipe If there's meat in the recipe, please suggest vegetarian substitutions.
The agent should respond with a helpful answer.
-
Enter a math problem, like
4 + 4
. The agent should respond with8
. -
Inspect the answers to see how the agent used the Calculator tool to solve the math problem, and the URL tool to research the recipe.
Your agent now has tools for performing a web search and doing basic math. You can solve many problems with just these capabilities.
For more ways to use tools with your agent, see Create a problem-solving-agent.