How it works
Lola Send’s RAG implementation loads Markdown documents from a designated directory and splits them for granular retrieval. When an agent processes a message, it retrieves the most relevant passages from the knowledge base and includes them as context for the AI model — alongside the conversation history and system prompt. This dual approach — tool functions for real-time data (quotes, recipients, operations) and RAG for static knowledge (country lists, fee schedules, payer information) — ensures agents reference verified content for both dynamic and reference data.Implementation
RAG is implemented as a singletonMarkdownRAG instance shared across all agents:
ast.set_rag_retrieval(rag).
Document loading
Documents are loaded fromdocs/{PROJECT_NAME}.md, where PROJECT_NAME is set via environment variable. The split_table_rows=True option splits table-heavy documents by row, enabling precise retrieval of individual entries (e.g., a specific country’s fee schedule or a single payer’s details).
Per-agent activation
Each agent opts into RAG retrieval explicitly:Knowledge base configuration
Different deployments (brands, regions) can use different knowledge bases by changing the
PROJECT_NAME environment variable. This enables white-label deployments where each bank has its own approved content.
RAG grounds agent responses in verified content. Combined with tool functions for real-time data, this dual approach minimizes hallucination risk — agents reference approved documentation for static knowledge and live backend services for transactional data.
Security considerations
- Bank-maintained content: The bank provides and maintains the knowledge base documents. Lola Send retrieves from them but does not modify them.
- Read-only access: The RAG system loads documents at startup and serves them as retrieval context. Agents cannot write to or alter the knowledge base at runtime.
- Content isolation: Each deployment’s knowledge base is scoped by
PROJECT_NAME. One deployment’s content is not accessible to another. - No external retrieval: RAG retrieves from local Markdown files only — it does not fetch content from the internet or external sources.