For AI agents and developers: machine-readable getting-started guide and automated Salesforce org setup (/llms.txt).

Setting up nanoRag

Getting Started with nanoRag

nanoRag is a Salesforce CLI plugin that builds BM25 document libraries and attaches them to your Agentforce agent. The library and index live in your org as ContentDocument and StaticResource records — no embeddings, no vector database, no Data Cloud.

Want to try it without installing anything? Try in your org →

1. Install the Salesforce CLI

Verify the installation:

Run this command:

1
sf --version

Expected output: @salesforce/cli/

2. Install the nanoRag plugin

Requires Python 3.10+.

1
2
3
git clone https://github.com/ankita13makker/nanoRAG.git
cd nanoRAG
sf plugins link plugins/sf-nanorag

The plugin creates its own virtual environment and installs Python dependencies on link.

Verify the installation:

Run this command:

1
sf nanorag --help

Expected output: A list of nanorag subcommands (install, build, attach, …)

3. Authenticate Your Org

The org needs Agentforce enabled and a NextGen (AgentScript) agent.

1
sf org login web --alias myOrg

Verify your org connection:

Run this command:

1
sf org display user

Expected output: Your org username and alias

4. Deploy the Apex Runtime

One-time per org. Installs the Apex classes that score queries at runtime.

1
sf nanorag install --target-org myOrg

5. Build a Library

1
2
3
sf nanorag build --target-org myOrg \
  --library-name product_docs \
  --files ./docs/guide.pdf ./docs/faq.docx

Supported formats: PDF, DOCX, PPTX, XLSX, MD, TXT, and 30+ others.

6. Attach to Your Agent

1
2
3
sf nanorag attach --target-org myOrg \
  --library-name product_docs \
  --agent-developer-name My_Service_Agent

Your agent can now retrieve from the library. Test a query:

1
2
3
sf nanorag search --target-org myOrg \
  --library-name product_docs \
  --query "how do I cancel"

When to Use BM25 vs. Embeddings

nanoRag uses BM25 — fast, deterministic keyword search. Use it when:

  • Users search with the same words that appear in your documents
  • Your corpus is product docs, policy manuals, runbooks, or API references
  • You have under ~10k documents

Reach for an embedding-based RAG instead when:

  • You need synonym matching (user says "cancel," doc says "terminate")
  • Your corpus is multilingual and users mix languages
  • You need long-form generative answers, not retrieved passages

The agent action signature is the same either way — start with BM25 and swap backends later if recall feels shallow.

Reference

CommandPurpose
sf nanorag searchTest search against a library
sf nanorag detachRemove a library from an agent
sf nanorag library listList libraries in the org
sf nanorag library deleteDelete a library
sf nanorag file addAdd files, rebuild the index
sf nanorag file deleteRemove files, rebuild the index
sf nanorag skill installInstall the matching Claude Code skill

All commands accept --json for structured output. Source: github.com/ankita13makker/nanoRAG.