Skip to content

AI Answers

AI Answers turns an existing AI Agent into a RAG-powered answer engine. An "answer" is a written response generated by the agent, grounded strictly in sources the agent retrieves itself through its own ai_search:rag_search tool, with inline [n] citations linking to those sources rendered as Drupal entities.

Key features

  • Live, streamed answers: text appears as the agent writes it, instead of waiting for the full answer.
  • Settings per agent: each AI Agent controls whether it's allowed to answer, which model it uses, how sources are shown, and what to say when it can't find one.
  • Follow-up questions: visitors can keep asking in the same conversation, with a limit on how much of the earlier chat gets reused.
  • Thumbs up / down feedback: visitors can rate an answer, and that feedback can optionally feed into Langfuse for observability.
  • Example questions and flexible placement: the question box can show clickable example questions, and can still reach its answer block even if the two aren't on the same page.
  • Separate Sources block: an optional block renders the reference list on its own, elsewhere on the page, instead of only inline with the answer.
  • Optional debugging details: site builders can grant a permission that shows extra tracing information alongside answers, for troubleshooting.

How it works

flowchart TD
    subgraph FE1["Browser: Question and Answer blocks"]
        A["1. Visitor types a question"]
        B["2. The Answer block sends it to the server"]
        A --> B
    end

    subgraph BE["Server: building the answer"]
        C["3. AI Answers picks up the request"]
        D["4. Checks the AI Agent is<br/>allowed to answer and has a<br/>way to search for sources"]
        E["5. Searches for sources and<br/>keeps only the good matches"]
        F["6. Asks the AI Agent to write<br/>an answer using those sources,<br/>citing them as [1] [2] ..."]
        G["7. Streams the answer back as<br/>it's written, finalizing the<br/>citations once it's done"]
        C --> D --> E --> F --> G
    end

    subgraph FE2["Browser: showing the reply"]
        H["8. The answer appears live,<br/>with sources listed and<br/>citation markers linked to them"]
        I["9. Visitor can rate the answer<br/>(optional thumbs up/down)"]
        H --> I
    end

    B --> C
    G --> H

    J(["↻ A follow-up question reuses<br/>the same conversation"])
    I -.-> J
    J -.-> B

This is the simplified version. See Architecture for the full pipeline, including the gates, the event-subscriber bridge, and the citation-finalization step referenced by step 7 above.

Sections

  • Getting started: cross-module requirements, enabling the module, configuring an agent for answers, placing blocks, and debugging a run via ai_logging.
  • Architecture: the request flow, the answer pipeline, the event-subscriber bridge into the agent loop, source processing, and the front-end contract.
  • Known gaps: limitations that are not yet fixed.