Skip to main content

Simple agent

This flow demonstrates using an Agent in a flow. An Agent uses an LLM as its "brain" to select among the connected tools and complete its tasks.

In this flow, the Agent reasons using a connected Language model component. The Agent selects the Calculator tool for simple math problems, and the URL tool to search a URL for content.

Prerequisites

Open Langflow and start a new flow

  1. From the Langflow dashboard, click New Flow.

  2. Select Simple Agent.

The Simple Agent flow is created.

Simple agent starter flow

Run the simple agent flow

  1. Add your OpenAI API key to the Agent component.

    Optionally, create a global variable for the OpenAI API key.

    1. In the OpenAI API Key field, click Globe, and then click Add New Variable.
    2. In the Variable Name field, enter openai_api_key.
    3. In the Value field, paste your OpenAI API Key (sk-...).
    4. Click Save Variable.
  2. To run the flow, click Playground.

  3. To confirm the tools are connected, ask the agent, What tools are available to you? The response is similar to the following:


    _10
    I have access to the following tools:
    _10
    Calculator: Perform basic arithmetic operations.
    _10
    fetch_content: Load and retrieve data from specified URLs.
    _10
    fetch_content_text: Load and retrieve text data from specified URLs.
    _10
    as_dataframe: Load and retrieve data in a structured format (dataframe) from specified URLs.
    _10
    get_current_date: Returns the current date and time in a selected timezone.

  4. Ask the agent a question. For example, ask it to create a tabletop character using your favorite rules set. The agent tells you when it's using the URL-fetch_content_text tool to search for rules information, and when it's using CalculatorComponent-evaluate_expression to generate attributes with dice rolls. The final output should be similar to this:


    _10
    Final Attributes
    _10
    Strength (STR): 10
    _10
    Constitution (CON): 12
    _10
    Size (SIZ): 14
    _10
    Dexterity (DEX): 9
    _10
    Intelligence (INT): 11
    _10
    Power (POW): 13
    _10
    Charisma (CHA): 8

Now that your query has completed the journey from Chat input to Chat output, you have completed the Simple Agent flow.

Search