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

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