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

  1. 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.

starter flow simple agent

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

  1. Add your credentials to the Open AI component. The fastest and most secure way to add credentials is with Langflow’s Global Variables.

    1. Click settings Settings, and then click language Global Variables.

    2. Click Add New.

    3. Name your variable. Paste your API key in the Value field.

    4. In the Apply To Fields field, select the field you want to globally apply this variable to.

    5. Click Save Variable.

  2. Click play_arrow Playground to start a chat session.

  3. 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.

  4. Enter a math problem, like 4 + 4. The agent should respond with 8.

  5. 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.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com