AgentRAG

Retrieval over your own documents, paid per call — index URLs, crawl roots, or raw text into a collection, then ask questions and get back ranked chunks with their sources. No signup, no API keys.

What makes it different

Hybrid retrieval, not just vectors

Exact tokens don't get lost. Every query runs dense vector search and BM25 keyword search, fuses the two result sets, and reranks — so an error code, an API symbol, or a config key is found by the search that is actually good at literals, not approximated by the one that isn't.

Answers cite their sources

You can check the answer. Each returned chunk carries its source URL, title, and position in the document, so a claim can be traced back to the passage it came from instead of being taken on trust.

Pay on success

You're billed only when it delivers. A query that matches nothing settles nothing, and an ingest refunds every page it failed to fetch — including when the job itself dies partway, not just when individual pages do. The response names which pages failed and why, so an empty collection explains itself instead of leaving you to guess. Asking is $0.008; indexing is $0.005 per page.

It won't buy its way past a paywall

AgentRAG indexes what it can fetch for free. It reaches the web through AgentScout with no toll budget, so a page behind a publisher paywall fails closed rather than being bought on your behalf — paying a third party is a spending decision you haven't authorized. Point it at a paywalled site and it indexes nothing and refunds the budget, reporting upstream_status_402 against each page. That is the intended outcome, not a fault, and it is why every ingest itemizes its failures.

Stored in the clear

This is not encrypted storage. A collection's documents and chunks are held in plaintext server-side — retrieval can only rank text it can read — so AgentRAG makes no zero-knowledge claim. Index public docs, your own product content, anything you'd hand to the service; don't index secrets. For state the server must never see, that's AgentKV.

Bounded spend

Spend is capped per call and per session. maxSpendUsd (AGENTRAG_MAX_SPEND_USD) refuses any single call over the cap; maxSessionSpendUsd (AGENTRAG_MAX_SESSION_SPEND_USD) bounds what a runaway agent can spend in total. A malformed cap fails closed, never open.

The API

Three paid verbs — ask, ingest, extend — plus free status and delete on a collection you own. A collection lives 7 days and every ask or ingest slides that window forward; extend buys 30/60/90 days more. Prices are in USDC on Base; the 402 quote is always authoritative, and it has to be — an ask that names sources it hasn't indexed yet is quoted as a composite of the ask and the ingest it triggers.

import { AgentRag } from "@agentrag/client";

const rag = new AgentRag({ signer, maxSpendUsd: 0.05 }); // hard cap per op

// first call indexes the sources, then answers from them
const { collection, chunks } = await rag.askAndWait("what does the refund policy say?", {
  sources: ["https://example.com/docs/**"],
});

const again = await rag.ask("what about international orders?", { collection }); // flat $0.008, no re-index
await rag.ingest({ documents: [{ text, title: "Policy" }], collection }); // index raw text
await rag.extend(collection, 30);                                         // buy 30 more days

Four ways to use it

The same service behind every entry point — pick the one that fits your agent.

New here? Start with the Quickstart, or see the pricing, or see the other services.