> For the complete documentation index, see [llms.txt](https://docs.workfx.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.workfx.ai/workfx-companion-agent-knowledge/use-cases/use-cases.md).

# 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

<figure><img src="/files/nvfusuOj1ESp4izxfjAm" alt=""><figcaption></figcaption></figure>

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**

<div data-full-width="false"><figure><img src="/files/jCznQz87ivK9MvwcRy03" alt=""><figcaption></figcaption></figure></div>

**Model Configuration**

* **Model**: `gpt-4o-mini`

**Chat History**

* **Input Variable**: `"User Query"`&#x20;

**Classes**

* **CLASS 1**: Questions about Workfx Introduction
* **CLASS 2**: Questions having nothing to do with Workfx Introduction

## **Tool Node**

<figure><img src="/files/rDqwKQhe6gfexkx93v3k" alt=""><figcaption></figcaption></figure>

### **Tool Metadata**

* **Name**: Knowledge Base Search Tool for Workfx
* **Description**: Introduction KB Search Tool

### &#x20;**Tool Selection**

* **Selected Tool**: `Workfx Introduction KB Search Tool`&#x20;

### **Tool Parameters**

* **Query Prompt**: `</> system.query`&#x20;

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**

<figure><img src="/files/8LnXZYVuvee3oVagC06m" alt=""><figcaption></figcaption></figure>

**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**

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

## **LLM Node**

<figure><img src="/files/NuY0zRhDhoRI6Oqq9WJ9" alt=""><figcaption></figcaption></figure>

### **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:

### **LLM Node Output – For Related Questions**

* **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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.workfx.ai/workfx-companion-agent-knowledge/use-cases/use-cases.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
