Workfx QA Agent

In this section, we introduce a representative use case featuring a simple Agent Flow designed specifically for Workfx-related questions. Key points include:

  • The agent receives user input in the form of questions.

  • It performs targeted retrieval from the Workfx introduction document using a predefined knowledge search process.

  • The agent generates relevant answers based strictly on retrieved content.

  • The system is restricted to a single domain to ensure all responses align with Workfx’s official documentation.

Overview of Flow Structure

The execution logic of this flow is as follows:

  • Question Classifier Node The flow begins by determining whether the user’s question is related to Workfx.

  • Workfx-Related Questions

    • If the question is relevant to Workfx, the system invokes the knowledge search tool defined in the “Tool-Flow Tool” section;

    • The tool performs retrieval and returns related content;

    • The agent then generates a natural language response based on the retrieved result.

  • Unrelated Questions

    • If the question is not related to Workfx, a Code Node is used to return a fixed message such as: “Sorry, I can only answer questions related to Workfx.”

Question Classifier Node

Model Configuration

  • Model: gpt-4o-mini

Chat History

  • Input Variable: "User Query"

Classes

  • CLASS 1: Questions about Workfx Introduction

  • CLASS 2: Questions having nothing to do with Workfx Introduction

Tool Node

Tool Metadata

  • Name: Knowledge Base Search Tool for Workfx

  • Description: Introduction KB Search Tool

Tool Selection

  • Selected Tool: Workfx Introduction KB Search Tool

Tool Parameters

  • Query Prompt: </> system.query

the user's original input (User Query) is passed directly to the knowledge search tool as the query parameter, without any additional processing or intermediate transformation.

Code Node

Configuration

  • Input Variables: None (the node operates independently)

  • Output Field: result

  • Function: Outputs a fixed message when the question is unrelated to WorkFX, informing the user that the system cannot respond.

Output Code Logic

def main() -> dict:
    return {
        "result": "Sorry, this question is not related to WorkFX, so I can't answer it."
    }

LLM Node

Prompt Template

This prompt guides the LLM to generate an answer based on the retrieved content from the tool:

{{#tool-1751255820523.text#}}
Here is some information about WorkFX.
Based on this information, please answer the following question.
{{#system.query#}}
  • Line 1: Inserts the content returned by the knowledge search tool (text field)

  • Line 2: Provides context that the answer should be based on that information

  • Line 3: Inserts the original user query (system.query)

Output Variable

  • final_answer (or the default output field used by the platform)

Input Variables

  • Implicitly bound:

    • tool-1751255820523.text (from the knowledge tool)

    • system.query (user input)

Answer Node

The final answer in this flow comes from one of two sources:

  • Source: LLM Node

  • Output Field: final_answer

  • Condition: Used when the question is related to WorkFX

  • Logic:

    • Read the generated answer from the LLM Node (final_answer)

    • Set it as the response output from the End Node

Code Node Output – For Unrelated Questions

  • Source: Code Node

  • Output Field: result

  • Condition: Used when the question is not related to WorkFX

  • Logic:

    • Read the predefined message from Code Node (result)

    • Set it as the response output from the End Node

Last updated

Was this helpful?