---
title: "rag_pipeline"
description: "Retrieve relevant information and generate a grounded, evidence-cited response."
canonical: "https://acs.synapti.ai/workflows/rag-pipeline/"
last_updated: "2026-11-16T03:28:14Z"
---

# Retrieve relevant information and generate a grounded, evidence-cited response.

Generated from [schemas/workflow_catalog.yaml](https://github.com/synaptiai/agent-capability-standard/blob/main/schemas/workflow_catalog.yaml) at commit 18c38b74ac21.

- Workflow id: `rag_pipeline`
- Risk: low
- Catalog: reference workflows
- Declares Standard 1.1.0
- Steps: 7

Retrieval-Augmented Generation pipeline inspired by OASF Category 6 (RAG).
Searches for relevant documents, extracts pertinent passages, generates a
response from them, anchors that response to the retrieved evidence, and
cites sources.
This pattern ensures generated content is grounded in retrieved facts rather
than relying solely on parametric knowledge.

**Figure: Steps of rag_pipeline: 7 steps.** Read top to bottom: no step changes state; steps 1, 2 and 4 say what to do on failure; and the highest step risk is low, at steps 1, 2, 3, 4, 5, 6 and 7.

| # | Capability | Layer | Role | Gates | On failure | Reads from | Risk |
| --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | `search` | PERCEIVE |  |  | request_more_context |  | low |
| 2 | `retrieve` | PERCEIVE |  |  | request_more_context | 1 | low |
| 3 | `detect` | UNDERSTAND |  |  |  | 2 | low |
| 4 | `generate` | SYNTHESIZE |  |  | stop | 3 | low |
| 5 | `ground` | MODEL |  |  |  | 1, 4 | low |
| 6 | `explain` | REASON |  |  |  | 4, 5 | low |
| 7 | `audit` | VERIFY |  |  |  | 4, 5 | low |

## Inputs

**Figure: Inputs of rag_pipeline.** 1 input, 1 required (filled pin) and 0 optional (outlined pin).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `user_query` | string | Yes | The user query to answer using retrieved information |

## Steps

1. [`search`](https://acs.synapti.ai/capabilities/search/index.md): Find relevant documents matching the query. Stores `search_out`. (risk low)
2. [`retrieve`](https://acs.synapti.ai/capabilities/retrieve/index.md): Fetch full content of relevant documents. Stores `retrieve_out`. (risk low)
3. [`detect`](https://acs.synapti.ai/capabilities/detect/index.md): Extract relevant passages from retrieved documents. Stores `detect_out`. (risk low)
4. [`generate`](https://acs.synapti.ai/capabilities/generate/index.md): Produce a response synthesized from the relevant passages. Stores `generate_out`. (risk low)
5. [`ground`](https://acs.synapti.ai/capabilities/ground/index.md): Anchor the generated response to the retrieved evidence with provenance. Stores `ground_out`. (risk low)
6. [`explain`](https://acs.synapti.ai/capabilities/explain/index.md): Cite sources and provide reasoning chain for the response. Stores `explain_out`. (risk low)
7. [`audit`](https://acs.synapti.ai/capabilities/audit/index.md): Record retrieval provenance and generation lineage. Stores `audit_out`. (risk low)

## Data flow

**Figure: Which step reads which stored output.** 6 steps read the output of earlier steps, 9 reads in all; step 5 (ground) reads the most, from 2 steps.

- Step 2 reads from step 1.
- Step 3 reads from step 2.
- Step 4 reads from step 3.
- Step 5 reads from steps 1 and 4.
- Step 6 reads from steps 4 and 5.
- Step 7 reads from steps 4 and 5.

## Risk

Declared, computed and highest step risk are all low; the highest-risk step is step 1 (search), with 6 others at the same level. The step map above gives each step's risk.

## Success criteria

- Relevant documents found and retrieved
- Response grounded in retrieved evidence
- Sources cited with provenance

## Validate it

```sh
python tools/validate_workflows.py --catalog schemas/workflow_catalog.yaml
```

## Workflow YAML

```yaml
rag_pipeline:
  goal: Retrieve relevant information and generate a grounded, evidence-cited response.
  risk: low
  description: |
    Retrieval-Augmented Generation pipeline inspired by OASF Category 6 (RAG).
    Searches for relevant documents, extracts pertinent passages, generates a
    response from them, anchors that response to the retrieved evidence, and
    cites sources.
    This pattern ensures generated content is grounded in retrieved facts rather
    than relying solely on parametric knowledge.
  success:
  - Relevant documents found and retrieved
  - Response grounded in retrieved evidence
  - Sources cited with provenance
  steps:
  - capability: search
    purpose: Find relevant documents matching the query.
    risk: low
    mutation: false
    requires_checkpoint: false
    requires_approval: false
    timeout: null
    retry:
      max: 2
      backoff: exponential
    store_as: search_out
    input_bindings:
      query: ${user_query}
    failure_modes:
    - condition: No relevant documents found
      when: ${search_out.results} == []
      action: request_more_context
      recovery: Broaden search terms or ask user for additional context.
  - capability: retrieve
    purpose: Fetch full content of relevant documents.
    risk: low
    mutation: false
    requires_checkpoint: false
    requires_approval: false
    timeout: null
    retry:
      max: 2
      backoff: exponential
    store_as: retrieve_out
    input_bindings:
      target: ${user_query}
      references: "${search_out.results: array<object>}"
    failure_modes:
    - condition: Document retrieval fails
      on_error: [R401, R402]
      action: request_more_context
      recovery: The run ends with the retrieval error; try alternative sources in a new run.
  - capability: detect
    purpose: Extract relevant passages from retrieved documents.
    domain: relevance
    risk: low
    mutation: false
    requires_checkpoint: false
    requires_approval: false
    timeout: null
    retry: null
    store_as: detect_out
    input_bindings:
      data: "${retrieve_out.data: object}"
      pattern: ${user_query}
    failure_modes: []
  - capability: generate
    purpose: Produce a response synthesized from the relevant passages.
    risk: low
    mutation: false
    requires_checkpoint: false
    requires_approval: false
    timeout: null
    retry: null
    store_as: generate_out
    input_bindings:
      specification:
        question: ${user_query}
        passages: "${detect_out.matches: array<object>}"
    failure_modes:
    - condition: Insufficient evidence for coherent response
      when: ${detect_out.matches} == []
      action: stop
      recovery: Report that available evidence is insufficient and cite what was found.
  - capability: ground
    purpose: Anchor the generated response to the retrieved evidence with provenance.
    risk: low
    mutation: false
    requires_checkpoint: false
    requires_approval: false
    timeout: null
    retry: null
    store_as: ground_out
    input_bindings:
      claim: "${generate_out.content: string}"
      sources: "${search_out.results: array<object>}"
    failure_modes: []
  - capability: explain
    purpose: Cite sources and provide reasoning chain for the response.
    risk: low
    mutation: false
    requires_checkpoint: false
    requires_approval: false
    timeout: null
    retry: null
    store_as: explain_out
    input_bindings:
      conclusion:
        response: "${generate_out.content: string}"
        evidence: "${ground_out.evidence: array<object>}"
        gaps: "${ground_out.gaps: array<object>}"
    failure_modes: []
  - capability: audit
    # NOTE: audit has mutation: true in the ontology (writes audit log),
    # but workflows mark it mutation: false because the mutation is
    # append-only and non-destructive — it cannot corrupt existing data.
    purpose: Record retrieval provenance and generation lineage.
    risk: low
    mutation: false
    requires_checkpoint: false
    requires_approval: false
    timeout: null
    retry: null
    store_as: audit_out
    input_bindings:
      event:
        type: rag_pipeline
        query: ${user_query}
        grounded: ${ground_out.grounded}
        response: "${generate_out.content: string}"
    failure_modes: []
  risk_propagation:
    strategy: max_step_risk
    computed_risk: low
  data_flow:
    pattern: step_outputs_are_addressable
    rule: Each step output is stored under store_as and may be referenced by later steps.
  inputs:
    user_query:
      type: string
      required: true
      description: The user query to answer using retrieved information
```
