Skip to main content

Overview

Available starting with FlowX.AI 5.6.0
The Context Retrieval node is a specialized Integration Designer workflow node that performs RAG (Retrieval-Augmented Generation) searches against a Knowledge Base. Unlike the Custom Agent node, Context Retrieval does not call an LLM — it retrieves and returns matching chunks directly, giving you full control over how the results are processed downstream.
Use Context Retrieval when you want to separate the retrieval step from the generation step. This lets you inspect, filter, or transform retrieved chunks before passing them to an AI node for response generation.

When to use Context Retrieval vs Custom Agent

ScenarioRecommended node
You need the AI to reason about retrieved information and generate a responseCustom Agent with Knowledge Base enabled
You want raw chunks to process, filter, or route in your workflowContext Retrieval
You need to combine chunks from multiple Knowledge BasesContext Retrieval (one per KB) + downstream merge
You want a simple question-answer flow with RAGCustom Agent with Knowledge Base enabled

Configuration

Knowledge Base

Knowledge Base
select
required
Select one or more Knowledge Base resource references to query.

Source

Source
enum
The source type to query.Options:
  • KNOWLEDGE_BASE — Search the selected Knowledge Base (default)
  • MEMORY — Search conversation memory
Default: KNOWLEDGE_BASE

Search type

Search Type
enum
The search algorithm used to find relevant chunks.Options:
  • HYBRID — Combines semantic and keyword search for balanced results (default)
  • SEMANTIC — Uses vector similarity for meaning-based search
  • KEYWORD — Uses traditional keyword matching
Default: HYBRID

Query parameters

Top K
number
Maximum number of chunks to return.Default: 5
Minimum Relevance
number
Minimum relevance score threshold, expressed as a percentage (0–100). Only chunks with a relevance score above this threshold are returned. The value is divided by 100 internally.Default: 0
Use Re-Rank
boolean
When turned on, applies re-ranking to the retrieved chunks for improved result ordering.Default: false

Advanced filters

Advanced Filters
boolean
Toggle to turn on property-based filtering on Knowledge Base chunks.Default: false
Advanced Filter
string
A JSON expression defining property-based filters to narrow search results. Only available when Advanced Filters is turned on.

Operation prompt

The operation prompt defines the query text sent to the Knowledge Base. It supports ${} placeholder syntax for dynamic values from workflow input and configuration parameters. Example:
${userQuery}
Both runtime input variables and configuration parameters are available for placeholder resolution.

Output format

The Context Retrieval node returns an array of chunk objects. Each chunk contains:
FieldTypeDescription
chunkContentstringThe text content of the retrieved chunk
chunkMetadataobjectMetadata associated with the chunk (key-value pairs)
relevanceScorenumberSimilarity score between the query and the chunk (0–1)
contentSourcestringThe name of the content source the chunk belongs to

Example output

[
  {
    "chunkContent": "The onboarding process requires identity verification...",
    "chunkMetadata": {
      "source": "onboarding-guide.pdf",
      "page": "3"
    },
    "relevanceScore": 0.92,
    "contentSource": "Product Documentation"
  },
  {
    "chunkContent": "KYC checks must be completed within 48 hours...",
    "chunkMetadata": {
      "source": "compliance-policy.pdf",
      "page": "12"
    },
    "relevanceScore": 0.85,
    "contentSource": "Compliance Policies"
  }
]

Error handling

If the Context Retrieval node fails, the workflow produces a WORKFLOW_NODE_CONTEXT_RETRIEVAL_ERROR error. Common causes include:
The referenced Knowledge Base does not exist or is not accessible.Solution: Verify the Knowledge Base exists in your project or dependencies and that you have the required permissions.
The operation prompt resolved to an empty or invalid query.Solution: Check that the ${} placeholders in your operation prompt reference valid input or config variables.
The RAG search exceeded the configured timeout.Solution: The default timeout is 300 seconds (flowx.ai-service.nodeRunnerTimeoutSeconds). Consider simplifying your query or reducing the topK value.

Best practices

Optimizing Context Retrieval:
  • Start with HYBRID search type for the best balance of precision and recall
  • Set a minimum relevance threshold (e.g., 70%) to filter out low-quality matches
  • Enable re-ranking when result quality is more important than latency
  • Use advanced filters to narrow results to specific content sources or metadata values
  • Keep topK reasonable (3–10) to avoid overwhelming downstream nodes with too much context
Building RAG pipelines:
  • Chain Context Retrieval → Script Node → Custom Agent to build custom RAG flows with intermediate processing
  • Use the relevanceScore field to implement your own relevance filtering logic in a Script node
  • Combine results from multiple Context Retrieval nodes (querying different KBs) using a Script node before passing to generation

Last modified on March 16, 2026