How It Works
- The orchestrator identifies
FLOW_RETRIEVERentries in the chat’sdataSources[] - Each retriever source is executed in parallel via
performFlowRetrieverRAG() - The flow receives
{ query, connectionId, _retrieverInstructions }as inputs - The flow’s final output is parsed as structured documents
- Documents are merged into the RAG context for the LLM to cite
Execution Contract
Retriever flows receive these inputs automatically:| Input | Description |
|---|---|
query / user_input | The user’s latest message |
connectionId | Resolved data connection ID (fixed or user-selected) |
_retrieverInstructions | Natural-language instructions set by the chat admin |
_userId | Authenticated user’s ID |
_userUpn | Authenticated user’s UPN |
_userEmail | Authenticated user’s email |
Any flowParams.* | Additional parameters configured by the admin |
- JSON array —
[{ "title": "...", "content": "...", "url": "..." }] - JSON object with documents key —
{ "documents": [...] }or{ "results": [...] } - Plain text — Wrapped as a single document automatically
```json ... ```).
Connection Modes
| Mode | connectionMode | Behavior |
|---|---|---|
| Fixed (admin-set) | fixed | The admin selects a data connection at configuration time. It’s baked into flowParams.connectionId and used for every query. The sidebar shows a read-only label. |
| User selects at runtime | user | End users see a connection picker in the right sidebar. They choose a connection before each query. The selected ID is passed as runtimeConnectionIds. |
| Hybrid | hybrid | Admin sets a default connection, but users can override it at runtime from the sidebar. Falls back to the admin default if the user hasn’t chosen one. |
Configuring a Chat with Flow Retriever
- Open a chat’s Edit Form → Data Sources
- Check Flow Retriever
- Select a Retriever Flow from the dropdown (only flows with
flowType: retrieverappear) - Choose a Connection Mode:
- Fixed — pick a connection from the dropdown
- User selects at runtime — users choose in the sidebar
- Optionally add Retriever Instructions — natural-language guidance injected as
{{_retrieverInstructions}} - Save the chat
Creating a Retriever Flow
Retriever flows are standard Flow Designer flows with a few constraints:-
Set
flowTypetoretriever— In the flow editor, set the flow type to “Retriever”. This marks the flow as headless and makes it available in the Flow Retriever dropdown. -
No user interaction nodes — Retriever flows must not contain
FORM_PROMPTorHUMANnodes. They execute headlessly with no user interaction at execution time. -
Accept the standard inputs — The Start node should expect
query(the user’s search text) and optionallyconnectionIdand_retrieverInstructions. -
Return structured documents — The final LLM/output node should produce a JSON array of documents:
Example: Database Retriever Flow
A typical SQL retriever flow has this node graph:| # | Node Type | Purpose |
|---|---|---|
| 1 | Start | Receives { query, connectionId } |
| 2 | LLM | Converts the natural-language query into SQL using a system prompt with schema context. Receives {{_retrieverInstructions}} for domain-specific guidance. |
| 3 | Tool | Executes the generated SQL against the connectionId using the SQL tool provider |
| 4 | LLM | Formats the raw query results into the structured [{ title, content }] JSON array |
| 5 | End | Returns the formatted documents |
Bootstrapped Retriever Flows
Two example retriever flows are included and can be seeded via Admin → Bootstrap Assets ([#/admin/bootstrap]) → Bootstrap Flows:
| Flow | Group | Description |
|---|---|---|
| Database Retriever | Retriever Flows | NL→SQL→Execute→Format pipeline for relational databases |
| Cosmos DB Retriever | Retriever Flows | NL→Cosmos SQL→Execute→Format pipeline for Azure Cosmos DB |
Security
- Connection ACL — Every connection is checked against the user’s entitlements before execution
- Flow validation — Only flows with
flowType: retrieverare accepted - User identity injection —
_userId,_userUpn,_userEmailare injected server-side for row-level filtering - Timeout — Each flow execution has a 30-second timeout boundary
- Parallel execution — Multiple retriever sources execute in parallel; failures are isolated per-source
IDataSourceConfig Fields (Flow Retriever)
See Datasource Catalog → IDataSourceConfig Fields for the full field reference. Flow Retriever–specific fields are summarized below.
| Field | Type | Description |
|---|---|---|
type | 'flowretriever' | Identifies this as a flow retriever source |
flowId | string | FK to the retriever flow in the flows Cosmos container |
flowParams | Record<string, any> | Pre-configured inputs (e.g., { connectionId: '...' }) |
connectionMode | 'fixed' | 'user' | 'hybrid' | How the connection is resolved |
retrieverInstructions | string | NL instructions injected as {{_retrieverInstructions}} |
indexName | '' | Always empty — flow retrievers don’t use search indexes |