- A main Chat Driven workflow that uses an Intent Classification Agent to route messages
- Built-in session memory that carries financial data across conversation turns
- A knowledge base Q&A handler that answers mortgage questions from uploaded documents, using agentic search
- A data collection handler that captures the userβs financial data from free-text messages
- A personalized offer generator where a Custom Agent calls a workflow-as-tool for auditable calculations
- A small talk responder and fallback handler
Architecture overview
The app is a Chat Driven workflow that uses an Intent Classification Agent to classify each user message and route it to the right handler. Each intent maps to a separate output branch on the node, eliminating the need for a Condition node. Each handler is a Custom Agent with Send as Chat Reply enabled, which delivers the response directly to the Chat component and updates session memory.In Chat Driven workflows, responses are delivered to the user by Custom Agent nodes with Send as Chat Reply enabled, not by the End Flow node. The End Flow node has no body configuration.
Data model
In a Chat Driven workflow, the Start node provides Chat Session ID, User Message, and an optional UI Flow Context as dedicated input fields β you reference them as${sessionId}, ${userMessage}, and ${context} in downstream nodes. These are not keys you declare in the data model.
mainChat data model
The mainChat workflow does not need any chat-specific keys in its data model β everything comes from the Start node fields and from the offer toolβs output.mortgageOfferCalc data contract
The offer calculation workflow is exposed to the offer agent as a tool, so it declares an explicit input and output contract:Built-in session memoryChat Driven workflows retrieve the last 30 turns of the conversation automatically and send them to the model in full. Any Custom Agent node with Use conversation memory enabled receives this history as LLM context, so data mentioned in earlier turns (age, income, loan amount) is available to later turns without manual persistence. See Session state management and Chat-driven workflows β Session memory.
Prerequisites
Before starting, make sure you have:- Access to a FlowX Designer workspace with AI Platform enabled
- Familiarity with creating workflows in FlowX
- A Knowledge Base data source with mortgage-related documents uploaded (see Step 4)
Step 1: Build the main orchestration workflow
Create a workflow namedmainChat and select Chat Driven as the workflow type.
Review the Start node
The Start node is created automatically with three fields:- Chat Session ID β a UUID populated by the Chat component at runtime (referenced as
${sessionId}) - User Message β the userβs text message (referenced as
${userMessage}) - UI Flow Context β optional JSON object passed from the UI (referenced as
${context})
Add the Intent Classification Agent
From the node palette, drag an Intent Classification Agent node onto the canvas and connect it to the Start node. Configure the node: User Message:${userMessage}
Intents:
Response Key:
intentResult
The If No Intent Matches branch is a default output port that fires when the classifier canβt confidently match any intent. Itβs always present on the node β you connect it to the fallback handler in Step 2.

Each intent creates a separate output port on the node. When the agent classifies a message, the workflow continues along the matching branch β no Condition node needed. Leave Use conversation memory OFF so each message is classified on its own; turn it ON only if you want the classifier to resolve ambiguous follow-ups against prior turns.
Connect handler nodes to each branch
Add the following nodes and connect each to its corresponding intent output:Add the End Flow node
Add an End Flow node from the palette (it is not auto-created for Chat Driven workflows) and connect every handler branch to it. The End Flow node has no body configuration β responses are already delivered by the Custom Agent nodes upstream.Step 2: Build the inline handlers
Every handler in this tutorial is a Custom Agent placed directly in themainChat workflow.
Shared Custom Agent settingsEvery Custom Agent in
mainChat uses the same two defaults:- Use only referenced values as input: ON β keeps each call scoped to the values referenced with
${...}in the Context field and reduces token usage. - Include Task for Prompt Suggestions: OFF β turn ON only if you want AI-generated follow-up prompts shown in the Chat component.

answerSmalltalk (Custom Agent)
Add a Custom Agent node namedanswerSmalltalk to the Greetings branch.
Instructions:
The Instructions field is static β the node rejects
${...} references inside it with βThis field is static. Use Context for dynamic values.β Put dynamic values in the Context field, which accepts mixed text and ${...} keys. This split applies to every AI node in this tutorial.fallback (Custom Agent)
Add a Custom Agent node namedfallback on the No Match branch.
Instructions:
Step 3: Build the data input handler
The Data Input branch is a single Custom Agent namedhandleDataInput. With built-in session memory, the agent both captures the financial data from the message and confirms it back β no separate extraction script is needed.
Instructions:
Step 4: Build the knowledge base Q&A handler
The KB question branch is a single Custom Agent node namedknowledgeBaseQA, placed inline on the Intent 3 branch, with a Knowledge Base attached and Send as Chat Reply enabled.
Set up the Knowledge Base
1
Create a Knowledge Base data source
In the Integration Designer, add a new Knowledge Base data source. Name it something descriptive like
MortgageKnowledgeBase.2
Upload mortgage documents
Upload PDF documents covering product sheets (rates, terms, eligibility), FAQ documents (DTI, LTV), and regulatory guides (required documents, application process). Wait for automatic chunking and vector indexing to complete.
3
Test queries
Use the Knowledge Base test interface to verify that queries like βWhat is DTI?β and βWhat documents do I need?β return relevant chunks.
For detailed Knowledge Base setup, see the Knowledge Base integration documentation.
Configure the Custom Agent node
Add a Custom Agent node namedknowledgeBaseQA on the Intent 3 branch. Enable the Knowledge Base setting and select your MortgageKnowledgeBase data source.
Turn on Enable agentic knowledge base search. Instead of a single lookup, the agent issues several sub-queries per turn and merges the results, which improves recall on multi-part questions. Under Additional controls, keep Filtering options on Manual unless you want the model to write its own metadata filter at run time.
SaaS Β·
Available on SaaS with FlowX.AI . This feature is live on managed (SaaS) deployments now. Self-hosted deployments will receive it with the next LTS release family.

Under Hybrid search the Min Relevance Score slider does not filter results β a hybrid score is a rank, not a similarity. To gate strictly on relevance, use Semantic search, or bound retrieval with Number of Chunks and re-rank.
Step 5: Build the personalized offer handler
SaaS Β·Available on SaaS with FlowX.AI . This feature is live on managed (SaaS) deployments now. Self-hosted deployments will receive it with the next LTS release family.
Step 5a: Build the mortgageOfferCalc workflow
Create a workflow namedmortgageOfferCalc with Output Focused as the workflow type. Give it an input and output contract so it can be exposed as a tool:
- Input parameters:
age,income,loanAmount,loanDuration(all NUMBER) - Output parameter:
reportText(STRING)

reportText.

Keeping the numbers in a Script node rather than an LLM keeps them deterministic and auditable. For any recommendation, you can trace exactly which formula produced each figure.
Step 5b: Attach the workflow as a tool on the offer agent
Switch back tomainChat. On the Offer branch, add a Custom Agent node named answerPersonalisedOffer. Under Tools, click Add tool and select mortgageOfferCalc.

mainChat.
A workflow can be exposed as a tool only if it declares an input and output contract (Step 5a). When you write the tool description, name the arguments it needs and add a stop condition. An agent node is capped at 10 workflow-tool calls per run β past the cap the call is not dispatched and the agent is told to answer with what it already has, so the prompt is still what stops a model from re-calling a tool that already succeeded.
Step 6: Connect to the chat UI
1
Create a Chat-Driven UI Flow
Go to UI Flows and create a new UI Flow, selecting Chat-Driven as the experience type. Set
mainChat in the AI Conversational Workflow field.2
Add a Chat component
Add a Chat component to the page. In a Chat-Driven UI Flow it uses
mainChat by default β no per-component configuration needed.3
Test the chat
Click Run to preview the UI Flow and interact with the chatbot.

For details on configuring chat experiences with built-in session memory, see Chat-driven workflows. For the Chat component reference, see Chat component.
Testing
1
Test the mainChat workflow directly
Open
mainChat and click Run Workflow. In the test modal, provide a valid UUID for Chat Session ID (reuse the same one across runs to verify multi-turn memory) and a User Message.2
Test the full chat flow
Run the UI Flow that embeds the Chat component. With built-in session memory, financial details captured in earlier turns are available to later turns:

3
Test edge cases
What you learned
In this tutorial, you built a full-featured Chat Driven app that demonstrates:- Chat Driven workflow basics β dedicated Start node fields,
${userMessage}interpolation, simplified End Flow (guide) - Built-in session memory β multi-turn context without manually persisting conversation history
- Intent classification and routing β using an Intent Classification Agent to route messages to handler branches automatically (pattern)
- Agentic knowledge base search β grounding answers in uploaded documents with multi-query retrieval and re-rank (pattern)
- Workflow-as-tool β letting a Custom Agent call a deterministic calculation workflow for auditable, hybrid AI + business-rule recommendations (pattern)
Next steps
Chat-driven workflows
Full reference for Chat Driven workflows, AI Triggers, and session memory
AI patterns
Deep-dive into the patterns used in this tutorial
Node types reference
Detailed configuration reference for all AI node types
Knowledge Base integration
Create and manage Knowledge Bases for RAG

