Download all docs

Recipe: Realtime Slack RAG Assistant

This recipe answers questions in Slack from your own knowledge base. A slack listener receives a message, a vector index retrieves the most relevant passages, a lab composes an answer grounded in those passages, and the reply goes back to the channel. It is retrieval-augmented generation, wired end to end from real elements.

The problem it solves

A bare LLM in a chat channel makes things up — it has no access to your documents and no memory of your domain. You want answers anchored to source material you control, delivered where your team already works. This recipe puts retrieval in front of generation, so every reply is built from passages you actually indexed.

Elements

ElementRole
slackReceives the inbound question and sends the answer back.
vectorSemantic index over your knowledge; returns the nearest passages.
labGenerates the grounded answer from the retrieved context.
documentSource-of-truth knowledge base the index is built from.

Flow

  1. Create a document store and load your knowledge base with write or import. Build the searchable index with the document’s vectorize operation (or maintain a vector element directly with insert / batch_embed).
  2. Create a slack connector. When its trigger (input) port is left unwired, Slack acts as a listener via the Events API — it receives messages and emits them downstream.
  3. On each inbound message, retrieve context with the vector index’s search operation (k-nearest-neighbors) or hybrid_search to blend semantic and keyword matching. You get back the passages most relevant to the question.
  4. Create a lab and call its chat (or invoke) operation with the user’s question plus the retrieved passages as context. The lab produces an answer grounded in what you supplied.
  5. Reply with the Slack connector’s send operation, posting the answer back to the originating channel.
  6. Wire the steps together with an automation — it references slack, vector, and lab as steps, so the receive → search → generate → send sequence runs as one flow.

What this shows

Slack is a bidirectional connector — the same element receives the question and sends the answer, with direction decided by wiring topology, not by two separate integrations. The retrieval step is a first-class vector element you can inspect and re-index, so “why did it answer that?” has a concrete, queryable answer: the passages search returned. Grounding lives in the data layer, generation lives in the lab, and the channel is just where the conversation happens.

Next pages