Aside: AI memory on 80K+ devicesHow Aside powers AI memory across 80,000+ devices · 113M documents · 24.8B tokens · 150+ countries

Read moreRead the case study
Moss
usemossStart Free
  1. Integrations
  2. /
  3. LangChain

Moss + LangChain

Real-Time Retrieval for LangChain Agents

Get StartedTalk to an Engineer

About LangChain

LangChain is the most popular framework for building LLM-powered applications. Moss provides a MossRetriever class that implements LangChain's BaseRetriever interface, plus a get_moss_tool() function for agentic workflows. Replace cloud vector database calls with sub-10ms local search without changing your chain architecture.

Why Use Moss with LangChain

01

Native BaseRetriever

MossRetriever implements BaseRetriever — drop into any LangChain RAG chain or LCEL pipeline

02

Agent-Ready Tool

get_moss_tool() wraps Moss as a LangChain Tool for ReAct and function-calling agents

03

Sub-10 ms Latency

Sub-10 ms retrieval replaces 300–900 ms cloud vector DB round-trips

04

Hybrid Search

Hybrid search via alpha parameter: blend semantic similarity with BM25 keyword matching

05

Async-First

Async-first: ainvoke() for Jupyter notebooks and async agent loops

Quick Start

Explore docs
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from moss_langchain import MossRetriever

retriever = MossRetriever(
    project_id="your-project-id",
    project_key="your-project-key",
    index_name="your-index-name",
    top_k=3,
    alpha=0.5,
)

# Use in async contexts (recommended)
docs = await retriever.ainvoke("What is the return policy?")
for doc in docs:
    print(doc.page_content, doc.metadata["score"])

Get Started in 3 Steps

01

Install dependencies

Run pip install moss langchain langchain-openai python-dotenv to set up your environment.

02

Create a MossRetriever

Initialize MossRetriever with your project credentials and index name. The retriever auto-loads the index on first query.

03

Use in your chain or agent

Call retriever.ainvoke(query) in RAG chains, or wrap the retriever as a LangChain tool for ReAct and function-calling agents.

Frequently asked questions

Ready to ship faster AI products?

Moss gives you production-ready semantic retrieval without infrastructure complexity.

Test performanceTalk to an Engineer
Moss
AICPA SOC 2 Type 2HIPAA

Product

Founding AgentLocal Search

Use Cases

Voice AIAI CopilotsIn-App SearchOn-Device AI

Company

PricingBlogCareersBrand Kit

Resources

DocsGlossaryBenchmarks

Integrations

DSPyElevenLabsLangChainLiveKitMCP ServerNext.jsPipecatVAPIVercel AI SDKVitePress

© 2026 MOSS

Privacy PolicyTerms of ServiceTrust Center