begin.mdx


Overview

The begin.mdx file documents the Begin component, which serves as the starting point in a workflow for an agent within the system. This component is automatically included whenever a new agent is created—either from a template or from scratch—and is mandatory, meaning there can be only one Begin component per workflow and it cannot be deleted.

The primary purpose of the Begin component is to set an opening greeting in conversational workflows and configure input parameters (global variables) that the agent requires to operate. It manages how the workflow is triggered and defines the starting context for user interaction.


Detailed Documentation

Begin Component

Purpose

Usage


Configuration Details

Mode

Defines how the workflow is triggered:

Opening Greeting

Global Variables

Global variables are parameters collected from the user or client to customize the agent’s processing. They are configured within the Begin component and can be mandatory or optional.

Attributes of Global Variables

Attribute

Description

Name (Required)

Descriptive label for the variable to clarify its usage.

Type (Required)

Defines the kind of input expected. Options include:

  • Single-line text

  • Paragraph text

  • Dropdown options (requires at least one dropdown option)

  • File upload

  • Number

  • Boolean (toggle on/off)

Key (Required)

Unique identifier used to reference the variable programmatically.

Optional

Toggle to mark the variable as optional (if not required).

Notes on File Upload Variables


Interaction with APIs

To programmatically pass parameters to the Begin component, clients can use:

This allows external applications or services to initiate conversations or tasks with pre-defined global variable values.


Important Implementation Details


Frequently Asked Questions (FAQ)

Is the uploaded file stored in a knowledge base?

No. Files uploaded via the Begin component inputs are not stored or processed with knowledge base models (OCR, DLR, TSR) or chunking methods in RAGFlow.

What is the file size limit for uploads?

There is no explicit file size limit enforced by the agent itself, but model providers impose token limits (e.g., 8k to 128k tokens). Uploaded files exceeding these limits will have their content truncated.

Are Docker environment variables relevant for file upload limits here?

No. Environment variables such as MAX_CONTENT_LENGTH and client_max_body_size affect uploads to knowledge bases or File Management only and do not apply to Begin component uploads.


Example Usage

Suppose you create an agent to assist users with onboarding. The Begin component’s configuration might look like:

The agent will start by greeting the user and require the userName variable while optionally accepting a file upload for the profile picture.


Mermaid Diagram: Begin Component Structure

classDiagram
    class BeginComponent {
        +mode: String
        +openingGreeting: String
        +globalVariables: List<GlobalVariable>
        +configureMode(mode: String)
        +setOpeningGreeting(greeting: String)
        +addGlobalVariable(variable: GlobalVariable)
    }

    class GlobalVariable {
        +name: String
        +type: String
        +key: String
        +optional: Boolean
    }

    BeginComponent "1" o-- "*" GlobalVariable : contains

Interaction with the System


Summary

The begin.mdx file provides comprehensive documentation of the Begin component, emphasizing its role as the mandatory starting point in agent workflows. It covers configuration options including modes, greetings, and global variables, with detailed explanations of each. The component integrates tightly with client APIs and establishes the initial conditions for agent interaction.

This documentation aids developers and users in understanding how to configure and utilize the Begin component effectively, ensuring consistent agent behavior and proper parameter management from the outset.