Relaystation logo Relaystation

Recipes · bundle

Agent RAG Memory

Durable, searchable memory for your agent — no vector DB to run

Ingest any text into a prepaid vector index inside a baton (Relaystation's durable storage object), then ask questions and get grounded answers. Memory persists across sessions and can be handed to other agents. One provider, one balance — no infrastructure to stand up.

Cost per run: $0.01–0.02 (ingest ~$0.01/doc batch, query+answer ~$0.01)

Success rate: 5/5 (single provider, one payment path; answer step is grounded-only, no hallucinated sources)

Services used

Service Provider Price Category
Create Vector Baton Relaystation from $0.001 Storage (once per memory)
Embed Text Relaystation $0.002 / 10 KB Embeddings (ingest + raw-text queries)
Write Vectors Relaystation $0.002 / batch of 10 Indexing (ingest)
Vector Query Relaystation $0.005 / query Retrieval
Grounded Answer Relaystation cost + 6% (~$0.001–0.005) Synthesis (optional)

Workflow

Ingest in one call: POST /v1/bundles/rag-ingest with { text, batonId? } — chunks, embeds, and writes vectors server-side (creates the vector baton if absent, returns its id). Bills the sum of steps.

Query in one call: POST /v1/bundles/rag-query with { batonId, question, answer?: true } — vector query, optionally followed by a grounded answer. Bills the sum of steps.

Manual alternative (step by step)

  1. Once: POST /v1/baton (preset: vector) to create the memory — keep the baton id
  2. Ingest: chunk text → POST /v1/llm/embed (batch) → POST /v1/baton/{id}/vectors
  3. Query: POST /v1/baton/{id}/vectors/query with raw text (embeds inline) — top-k matches with scores
  4. [Optional] Synthesize: POST /v1/llm/answer with the retrieved chunks as context
  5. To share the memory with another agent, mint a read token on the baton and hand off the id + token

Prompt

You are an agent with durable external memory on Relaystation (x402, Base USDC; or an API key).
To remember: POST /v1/bundles/rag-ingest with your material as text — it chunks, embeds, and
writes to your vector baton in one call (creates the baton on first use; persist the returned
baton id — it is your memory address across sessions).
To recall: POST /v1/bundles/rag-query with { batonId, question } — top-k matches with scores;
add answer: true for a synthesized answer grounded only in what was retrieved.
If the matches answer the question, respond directly, citing which stored chunks you used.
If a query returns no matches above ~0.5 similarity, say you have no memory of it rather than
guessing. Manual path (same price, more control): chunk ~1–2 KB → POST /v1/llm/embed →
POST /v1/baton/{id}/vectors; query via POST /v1/baton/{id}/vectors/query. Payments: each call
is a single x402 payment; sub-cent remainders auto-credit to your wallet balance and are spent
on your next call.

← All recipes