Skip to main content

Building a Complex Business Agent Assistant with Workflow

In SERVICEME NEXT, Agents created using the basic method are more suitable for simple Q&A scenarios and have relatively limited functionality. If you need to handle more complex business logic or implement multi-step operations, you can build advanced Agents through Workflow to meet richer business requirements.

This section will demonstrate how to use Workflow to build a complex process through a specific example.

Scenario Example: Sensitive Word Extraction from Contract Content

In real business scenarios, contract texts are usually lengthy and complex. If manual comparison is required line by line to identify whether they contain sensitive words, it is not only time-consuming and labor-intensive, but also prone to omissions, especially when there are many sensitive words, making accuracy even harder to guarantee.

With Workflow capabilities, you can build an intelligent Agent that supports file upload, content parsing, sensitive word identification, and annotation.

Through this process, users can quickly understand the sensitive information in contracts without manual review, greatly improving review efficiency and accuracy.

✅ Tip: This type of Agent is especially suitable for scenarios such as legal review, content moderation, and compliance management.

Prepare the Sensitive Word Data Source

Before formally building the workflow, you need to prepare the sensitive word data first. In this example, the sensitive words are stored in a database, so you need to add the database as a data source through the Data module and complete data synchronization.

Prerequisites for Data Preparation

  • Sensitive word data has already been written into the database (the table name is SensitiveWords).
  • The database type is SQLServer and is accessible over the network.

Steps to Add a Data Source

  1. Enter the Data module
    • Open the SERVICEME platform and click “Data” in the left navigation bar.
    • Select “Data Source” to enter the data source management page.

  1. Add a data source
    • Click the “Add Data Source” button in the upper-right corner.
    • In the pop-up configuration window, fill in the following information:
      • Data Source Name: for example, Sensitive Word
      • Database Type: select SQLServer
      • Connection Information: including host, port, username, password, and database name
    • Click “Test Connection”. After confirming the connection is successful, click “Confirm” to complete the addition.

  1. Select a data table
    • Return to the data source list and click the data source item you just created.
    • The system will display the available data tables in the database. Select the table containing sensitive words (such as SensitiveWords) and click “Confirm” to add it.

  1. Synchronize the data catalog
    • In the left menu, select “Data Catalog”, find and click the Sensitive Word data source.
    • Perform the “Sync” operation to ensure the platform obtains the latest data.

After completing the above steps, the sensitive word data source is configured. In the following workflow, you can access this data table through nodes to implement sensitive word extraction and comparison for contract content.

Create the “Sensitive Word Extraction” Agent Through Workflow

  1. Go to the SERVICEME NEXT homepage, click AI Studio in the left navigation bar, and enter the Agent interface.
  2. Click “Create Assistant” in the upper-right corner and choose “Create with Advanced Orchestration”.
  3. Fill in the following basic information:
    • Assistant Name: enter Sensitive Word Extraction
    • Agent Avatar: choose one from the system built-in avatars (custom upload is currently not supported)
    • Category: select the business category, such as Legal and Compliance
    • Description: for example, Sensitive Word Extraction
  4. After completing the form, click “Create” to successfully generate the workflow Agent.

Configure the “Sensitive Word Extraction” Agent

📌 Planning Before Orchestration

The core goal of this workflow is to enable the Agent to automatically identify sensitive words in contract files uploaded by users. To achieve this, we need to guide users to upload contract files and parse their contents into processable text; at the same time, we need to load sensitive word data from the configured database, and use the model to intelligently compare the contract content with the sensitive words to identify matches and their positions. Finally, the model outputs the recognition results and returns them to the user. The entire process covers key steps such as file processing, data source invocation, model recognition, and result output, making it suitable for automated text review business scenarios.

📌 Node Configuration and Connection Instructions

In this Workflow example, the input and output of each node are configured by referencing the results of the previous node. To achieve the goal of sensitive word extraction, this process mainly involves the following nodes: start node, file processing node, data source node, model node, and end node. The configuration and connection method of each node will be explained in sequence below.

Configuration Process

  1. Start node input description

The start node can select two inputs:

  • USER_FILE: the file uploaded by the user in the current round.
  • USER_IMAGES: the image uploaded by the user in the current round.

These two inputs will serve as reference sources for subsequent nodes and will be used for file processing and model recognition.

  1. File processing node configuration

This node is responsible for processing the contract file uploaded by the user, including text extraction, chunking, and vectorization.

The configuration steps are as follows:

  • Add a File Processing node to the canvas.
  • Use a connection line to connect the Start node and the File Processing node.
  • Click the file processing node to enter the configuration interface and set the following:
    • Input Reference: set USER_INPUT as a reference in the following format:
      Start/USER_INPUT
    • File Reference: click “Add File” and select
      USER_FILE (that is, the contract file uploaded by the user)
    • TopK Setting: choose an appropriate TopK (such as 3~5).
      • TopK indicates the maximum number of text segments returned by the model during text vector matching.
      • Recommendation: if TopK is too low, key content may be missed; if it is too high, it may affect the model’s ability to focus.

  1. Data source node configuration

This node is used to introduce the sensitive word data table created earlier for subsequent comparison.

The configuration steps are as follows:

  • Add a Data Source node to the canvas and connect it to the Start node.
  • Click the node and configure the data source information:
    • Select the data source as: Sensitive Word
    • Set the input reference as: Start/USER_INPUT (the user’s input instruction)

The output of this node is the sensitive word list required by the model.

  1. Model node configuration

This node is the core processing module of the workflow, responsible for intelligently comparing the contract text with the sensitive words and returning the results.

The configuration steps are as follows:

  1. Add a Model node and connect it to both the file processing node and the data source node.
  2. Model selection: gpt-4.1
  3. Tool selection: no external tools are required in this scenario, so this can be skipped.
  4. Add MCP: MCP is not required in this scenario, so this can be skipped.
  5. Input references:
    • input: reference the output of the file processing node, in the following format:
      FileHandler/output
    • param2: reference the output of the data source node, in the following format:
      DataSource/output
  6. Prompt configuration:
    • System Message:
      Analyze the file in {{input}} and compare it with the sensitive words in {{param2}}. If there are sensitive words in the file, output the sensitive words along with their positions.
    • User Message:
      Analyze the file in {{input}} and compare it with the sensitive words in {{param2}}. If there are sensitive words in the file, output the sensitive words along with their positions.

✅ Tip: The system message is used to provide behavioral instructions to the model, while the user message simulates actual user input. Here, the two are identical for more stable results.

  1. Output node configuration

This node is used to return the model’s processing result to the end user.

The configuration steps are as follows:

  1. Connect the Model node to the End node.
  2. Click the end node and set the input reference:
    • Input content: reference the model node output, in the following format: Model/output
  3. In the output content configuration, enter: {{output}}

✅ Tip: Entering only {{output}} as the final output can better preserve the model’s output. If needed, you can also specify the output of particular content.

The complete configuration is as follows:

How to Use the “Sensitive Word Extraction” Agent Assistant

  • The user uploads a contract file in the chat interface.
  • The Agent automatically completes text parsing and accurately detects sensitive words within it.
  • The system returns the sensitive words along with their positions.
  • Through this process, users can quickly understand the sensitive information in contracts without manual review, greatly improving review efficiency and accuracy.