# Creation

## Ways to create an AgentFlow

WorkFX AI provides two ways to create an AgentFlow:

* Select from existing templates and clone them into your own agent
* Build one from scratch

## **Usage Example**

In the following example, we will use the creation of a travel assistant as a case to demonstrate how to create an agentflow that helps users plan their travel itineraries.

### **Open it from the "Agent" page**

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2Fa0XJpL9gcSaRXQdpD9DB%2F205c50d1-dba8-48e4-9d8a-b03532f2c46e.png?alt=media&#x26;token=0a9eebf4-e25b-4380-b192-42d30e9378af" alt=""><figcaption></figcaption></figure>

Then, go to the **Agent** page to find the "Default Chat Flow" you just cloned. Click to open and configure it.

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FhXLoFisHits75u8eDQfY%2F0ecc4dfe-8e19-4f0c-99c9-2cba578f4937.png?alt=media&#x26;token=bd24e402-b20e-42eb-a274-c1d87405f797" alt=""><figcaption></figcaption></figure>

You will see a simple example composed of three nodes: **Start Node → LLM Node → Answer Node**This structure represents the flow starting from user input, processed by the language model, and then delivered as the final response to the user.

### **Configure the Start Node**

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FjD1Drnm3sAI2q86BjINH%2F288ef196-c055-4a03-97b2-46f63d1946c8.png?alt=media&#x26;token=a615c6de-0b80-49df-833b-c9de2ccdfcfc" alt=""><figcaption></figcaption></figure>

Click on the "**StartNode**" to display its configuration panel on the right. In the configuration panel, you can view the variables under the InputField section. Click "Add" to add a new input variable.

\
Here, you can configure input variables in addition to the user's original input (query). These variables are typically used for API calls, but in this case, they are not needed and can be skipped for now\.At the top, you can select the variable type. Below, you can configure the following information:

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2F7SFhJvTPUgoeVnGIuYbz%2F5f14ed46-ae4a-46f3-85bd-53d718c43236.png?alt=media&#x26;token=abff1361-43bb-4c59-a595-b5249274b7f4" alt="" width="375"><figcaption></figcaption></figure>

* **Variable Name:** A unique identifier used to reference this input within the workflow.
* **Label Name: A** label name is a user-facing variable name that offers greater flexibility. It can include common special characters such as spaces,  making the interface more intuitive and user-friendly.
* **Description (Optional):** Additional information or instructions to help the user understand the purpose of this input.
* **Max Length: The** maximum number of characters allowed for this input. Used to control the size and format of the user input.

### **Configure the LLM Node**

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FxWb2ddpqyvdl7SEzKAF2%2F942fdece-8972-461e-96cb-b7557ebfdf0a.png?alt=media&#x26;token=25e827af-f668-47e3-8666-52f8d891ffad" alt=""><figcaption></figcaption></figure>

Click the "**LLM Node**" to open the configuration panel on the right.You can select the model to use and configure some simple parameters (most of the time, the default settings are sufficient).Below, you can input the system prompt and user prompt, as well as configure the number of chat history turns to reference. Here are the parameter settings for this example:

* **Model Settings**
  * **Model:** o3-mini
  * **Temperature:** 0.7
  * **Max Tokens:** 1000
* **Chat History:** 10
* **System:**

```
#Role Definition
You are a reliable travel planning assistant. Your task is to generate a detailed travel itinerary based on online information and the user's specific needs.
```

* **User:**

```
#Info
    The user's requirements are: 
#Output
    Based on the above, please provide the following:
    Suggested travel itinerary (organized by day)
        Recommended attractions for each day (include opening hours, ticket prices, and suggested visit duration)
        Recommended local food (with restaurant names and addresses)
        Transportation suggestions (intercity and local travel)
        Accommodation suggestions (with pros and cons)
        Important tips (weather, clothing, cultural taboos, etc.)
```

<br>

### **Configure the Answer Node**

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2F0Sdu6y8JrcX2DesbERdI%2Fb33caf77-d8dc-442a-b1f0-7c5fc644a847.png?alt=media&#x26;token=4d5e31d9-72f6-4ffb-af79-1fec8f27605a" alt=""><figcaption></figcaption></figure>

Click the "**Answer Node"** to open the configuration panel on the right.Click the “**\</>**” button to select the output from a previous node and embed it into the final response.In this example, simply output the result from the previous LLM Node directly. As shown in the diagram, click on “**text**” under the LLM Node.

### **Try it**

\
Now, a basic AgentFlow is complete. You can try it out with the following steps:

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2FhXLoFisHits75u8eDQfY%2F0ecc4dfe-8e19-4f0c-99c9-2cba578f4937.png?alt=media&#x26;token=bd24e402-b20e-42eb-a274-c1d87405f797" alt=""><figcaption></figcaption></figure>

<figure><img src="https://vxqhv8tzaua.feishu.cn/space/api/box/stream/download/asynccode/?code=NWZhYTJjZDU0MDlmOTk5Y2RmZjk5MGJkNzc2ZmQ3NGRfam1QMXE0OHR4Y293ZHVWU000eHdDTFYyTmRiaUpERmFfVG9rZW46RnlqVWJ3am1Rb0FBTEl4SjRVV2NsWnJObjZjXzE3NDg2NzE5Mzk6MTc0ODY3NTUzOV9WNA" alt=""><figcaption></figcaption></figure>

1. Click "**Draft**" to save the current flow.
2. Click "**Preview**" to test how this AgentFlow works.
3. Enter your travel requirements in the input box below, and the AgentFlo\w will begin to run, generating a simple travel guide.

<figure><img src="https://4046886348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYf4L4Z4IuV1CQn3whQYb%2Fuploads%2F1cSO0hIZC6zs8uJ9F4SU%2Fda7142ab-5d68-442a-937f-29307ce96a70.png?alt=media&#x26;token=654c9a32-d0c5-4077-986a-37daabea2a53" alt=""><figcaption></figcaption></figure>
