What LangChain already keeps
Conversation history is usually held in a message list or chat history store for the current thread, and retrievers fetch passages from a vector store. Neither decides which of two conflicting facts is current, nor keeps what was true at a given date.
Where Auld fits
Expose Auld as two tools: recall_memory before answering anything history-dependent, and save_memory when the user states a fact worth keeping. Keep thread history in LangChain; keep durable, cross-thread facts in Auld.
| Concern | LangChain | Auld |
|---|---|---|
| Current conversation | Yes | Not needed |
| Facts across sessions and channels | Your code | Yes |
| Which fact is current after a change | Your code | Yes, with history |
| What was true on a date | Your code | Yes (asOf) |
| Who may see a memory | Your code | Identities and audiences |
| Source for each statement | Your code | Returned with every memory |
Implementation sequence
Add the HTTP helper
A small module with
rememberandrecallusing your project key.Wrap them as tools
Use the
@tooldecorator so the model sees a name, description and typed arguments.Bind the user id outside the model
Pass the authenticated user id from your request context, never from model output.
Instruct when to recall
In the system prompt, tell the agent to call recall before answering about prior commitments, preferences or account state.
Example
import os, requests
AULD = os.environ["AULD_API_BASE"] # e.g. https://YOUR-AULD-HOST
HEADERS = {"Authorization": f"Bearer {os.environ['AULD_API_KEY']}"}
def auld_post(path: str, body: dict) -> dict:
r = requests.post(f"{AULD}/v1/{path}", json=body, headers=HEADERS, timeout=30)
r.raise_for_status()
return r.json()
def remember(text: str, user_id: str, source_id: str, occurred_at: str) -> str:
"""Store a dated record for one user. Returns the job id."""
return auld_post("records", {"sourceId": source_id, "text": text,
"occurredAt": occurred_at, "author": user_id,
"visibility": f"user:{user_id}"})["jobId"]
def recall(query: str, user_id: str, max_tokens: int = 2000) -> str:
"""Current memories with sources, formatted for a prompt."""
res = auld_post("recall", {"query": query, "viewer": user_id, "maxTokens": max_tokens})
return "\n".join(f"- {m['text']} ({m['sources'][0]['title']}, {m['sources'][0]['occurredAt'][:10]})"
for m in res["memories"]) or "No relevant memory."from langchain_core.tools import tool
from memory_client import remember, recall # the helper above
def memory_tools(user_id: str):
@tool
def recall_memory(query: str) -> str:
"""Look up what is known about this user: past decisions, preferences, account facts."""
return recall(query, user_id)
@tool
def save_memory(fact: str, when: str) -> str:
"""Save a durable fact the user stated, with the ISO date it applies from."""
remember(fact, user_id, source_id=f"chat-{user_id}-{when}", occurred_at=when)
return "saved"
return [recall_memory, save_memory]
# agent = create_agent(model, tools=memory_tools(current_user.id), ...)Illustrative example · standard HTTP · check the framework’s current docs for exact signatures
Or connect the MCP server
If your LangChain setup can use MCP tools, point it at the Auld MCP endpoint instead of writing wrappers. The model gets remember, recall, forget and memory_status. Use wrappers when you need to inject the user id yourself or post-process results; use MCP for speed of setup.
Custom integration recipe using standard HTTP/MCP tools
- This recipe wires LangChain’s own tool interface to the Auld REST API or MCP server; there is nothing Auld-specific to install.
- Bind the viewer id from your authentication layer, not from model output.
- Ingestion is asynchronous — poll the job before depending on a just-sent fact in tests.
- Recall returns up to your plan’s token limit (8,000 on Pay as you go and Flex).
Frequently asked questions
Should I replace my vector store?
No. Keep the vector store for static documents. Use Auld for facts about people, accounts and projects that change over time.
Can the model choose the user id?
It should not. Close over the authenticated id when you build the tools, as in the example, so a prompt cannot request another user’s memory.