new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

LangChain · Agents · all subjects

middleware & retrieval

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Long-term memory storage foundation

Long-term memory is built on LangGraph stores, which save data as JSON documents organized by namespace and key.

Memory storage organization structure

Each memory in a store is organized under a custom namespace (similar to a folder) and a distinct key (like a file name). Namespaces often include user or org IDs or other labels that make it easier to organize information. This structure enables hierarchical organization of memories. Cross-namespace searching is supported through content filters.

Memory store backends

Long-term memory can use InMemoryStore for in-process storage or PostgreSQL with langgraph-checkpoint-postgres for persistent database storage. The PostgreSQL backend requires installation of psycopg (Psycopg 3) with optional binary extras.

PostgreSQL package installation

To use PostgreSQL for long-term memory in Python, install langgraph-checkpoint-postgres and psycopg[binary] using pip or uv. The psycopg[binary] extra is recommended for most users.

PostgreSQL package installation for JavaScript

To use PostgreSQL for long-term memory in JavaScript, install @langchain/langgraph-checkpoint-postgres using npm.

Three levels of prompt caching in LangChain

Prompt caching can be engaged at three levels: (1) Implicit provider caching where providers automatically pass on cost savings with no configuration required (examples: OpenAI, Gemini); (2) Provider-level explicit controls where you manually indicate cache points for greater control (examples: ChatOpenAI via prompt_cache_key, Anthropic content-block cache_control, Gemini, AWS Bedrock cachePoint blocks); (3) LangChain middleware where middleware optimizes caching of stable system prompt and tool content (examples: AnthropicPromptCachingMiddleware, BedrockPromptCachingMiddleware).

Give your agent this brain