LangSmith
ObservabilityPython SDK IntegrationTrace MemoAir memory retrieval in LangSmith so you can inspect which memories, graph facts, and reasoning paths were injected before the model answered.
Install
pip install "memoair[langsmith]"If you already use MemoAir through LangChain, install both optional extras with pip install "memoair[langchain,langsmith]".
LangChain Apps
LangChain automatically traces retrievers, tools, and model calls when LangSmith tracing is enabled. Use MemoAir's existing LangChain primitives and set the LangSmith environment variables.
export LANGSMITH_TRACING=trueexport LANGSMITH_API_KEY="lsv2_..."export LANGSMITH_PROJECT="memoair-agent"export MEMOAIR_API_KEY="memoair_pk_..."export MEMOAIR_WORKSPACE_ID="ws_default"from langchain_openai import ChatOpenAIfrom memoair import MemoAirfrom memoair.integrations.langchain import MemoAirMemory client = MemoAir(user_id="alice")memory = MemoAirMemory(client=client, group_id="user:alice") agent = ChatOpenAI(model="gpt-4o")context = memory.get_context("What should I remember before answering?") response = agent.invoke([ ("system", f"Use this MemoAir context when helpful:\n{context}"), ("user", "Which backend framework should I use?"),]) memory.save_interaction( user_message="Which backend framework should I use?", assistant_message=str(response.content),)Direct SDK Tracing
For non-LangChain apps, wrap MemoAir search in a LangSmith retriever span. The helper returns LangSmith-compatible documents so retrieved memories get dedicated document rendering in the trace.
from memoair import MemoAirfrom memoair.integrations.langsmith import trace_memoair_search client = MemoAir( api_key="memoair_pk_...", workspace_id="ws_default", user_id="alice",) documents = trace_memoair_search( client, "What does Alice prefer for backend work?", user_id="alice", workspace_id="ws_default", scope="all", limit=5, metadata={"environment": "production", "agent": "support-bot"},) context = "\n".join(doc["page_content"] for doc in documents)What appears in LangSmith: each MemoAir result is rendered as a retriever document with memory ID, note ID, score, scope, user ID, workspace ID, and graph evidence metadata.
Evaluate Memory Quality
LangSmith RAG evaluations map cleanly onto memory apps. Use retrieved MemoAir documents as the evidence set, then score whether retrieval was relevant and whether the final answer stayed grounded in memory.
# Evaluation dimensions to track in LangSmith:# 1. Retrieval relevance: are the returned memories useful for the user question?# 2. Groundedness: is the assistant answer supported by retrieved MemoAir context?# 3. Save quality: should this turn create or update a long-term memory?What You Get
memoair, user, workspace, project, profile, or deployment environment.