Skip to main content
RagPipeline (sync) and AsyncRagPipeline (async) connect the Autoplay event stream to your vector store with minimal code. You provide two functions — embed and upsert — and the pipeline handles the rest.

Sync pipeline


Async pipeline


With a SessionSummarizer

Attach a SessionSummarizer to automatically condense actions before embedding. This keeps your vector store entries compact and your context window small.
When the summarizer fires (every 10 actions), the LLM-generated summary is embedded and upserted — not the raw action batch.

Compatible vector stores

The upsert callable works with any vector store. Examples:

What gets upserted

Event typeID usedText embedded
ActionsPayloadsession_idpayload.to_text() — numbered action list
SummaryPayloadsession_idpayload.to_text() — prose summary
Client summary (via SessionSummarizer)session_idLLM-generated summary text
Each event type upserts with the same session_id as the key — so your vector store always has one up-to-date entry per session.

Constructor

RagPipeline(embed, upsert, summarizer=None)

embed
Callable[[str], list[float]]
required
Any embedding function. Receives payload.to_text() and must return a vector.
upsert
Callable[[str, list[float], dict], None]
required
Writes the embedding to your vector store. Called with (session_id, vector, metadata).
summarizer
SessionSummarizer | None
default:"None"
Optional SessionSummarizer. When set, actions are summarised before embedding.

AsyncRagPipeline(embed, upsert, summarizer=None)

Same parameters but embed and upsert are async callables.

Callbacks

MethodDescription
.on_actions(payload)Wire to client.on_actions(...)
.on_summary(payload)Wire to client.on_summary(...)