
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
@atomicmemory/langchain
Advanced tools
AtomicMemory adapter for LangChain JS - memory tools and framework-agnostic retrieve/ingest helpers around an injected MemoryClient.
AtomicMemory adapter for LangChain JS. Thin wrappers around an injected MemoryClient from @atomicmemory/sdk.
The adapter exposes two surfaces:
| Surface | Use when |
|---|---|
Helpers — searchMemory() / ingestTurn() | You want to call AtomicMemory inside a LangChain callback, an LCEL RunnableLambda, or any other code path. Framework-agnostic. |
createMemoryTools() | You want AtomicMemory as agent-callable tools (memory_search, memory_ingest) consumable by createToolCallingAgent, LangGraph's tool node, or any @langchain/core/tools-compatible runner. |
The adapter does not own provider configuration — pass an already-constructed MemoryClient.
pnpm add @atomicmemory/langchain @atomicmemory/sdk @langchain/core zod
@langchain/core and zod are declared as peerDependencies so you can pin them at the version your LangChain graph already uses.
import { MemoryClient } from '@atomicmemory/sdk';
import { createMemoryTools } from '@atomicmemory/langchain';
const memory = new MemoryClient({
providers: { atomicmemory: { apiUrl: process.env.ATOMICMEMORY_URL!, apiKey: process.env.ATOMICMEMORY_KEY! } },
});
await memory.initialize();
const { searchTool, ingestTool } = createMemoryTools(memory, {
scope: { user: 'pip', namespace: 'my-app' },
defaultLimit: 5,
});
// Hand the tools to any LangChain agent runner:
const tools = [searchTool, ingestTool /*, ...your other tools */];
Scope is fixed at factory time — the agent cannot rebind to other users by passing different arguments.
import { searchMemory, ingestTurn } from '@atomicmemory/langchain';
const { context, results } = await searchMemory(memory, {
query: latestUserMessage,
scope: { user: 'pip' },
limit: 8,
});
if (context) {
// Prepend `context` to your prompt, attach as a system message, etc.
}
// After the model call:
await ingestTurn(memory, {
messages: turn.messages,
completion: turn.responseText,
scope: { user: 'pip' },
});
The default formatter wraps retrieved memories in a delimited block with an explicit "reference, not instructions" header — a mitigation against instruction-shaped content hijacking the model, not a guarantee. Override per call:
await searchMemory(memory, {
query,
scope,
formatter(results) {
return `# Prior context\n\n${results
.map((r) => `- [${r.memory.createdAt.toISOString()}] ${r.memory.content}`)
.join('\n')}`;
},
});
ingestTurn() excludes system messages by default — applications typically use them for hidden instructions and policies that should never become durable memory. Opt in explicitly if your system messages are genuinely user-authored content worth remembering:
await ingestTurn(memory, {
messages,
completion,
scope,
includeRoles: ['system', 'user', 'assistant', 'tool'],
});
Scope fields follow the SDK's Scope type — user, agent, namespace, thread. At least one must be provided; the SDK rejects scopeless requests.
Apache-2.0.
FAQs
AtomicMemory adapter for LangChain JS - memory tools and framework-agnostic retrieve/ingest helpers around an injected MemoryClient.
We found that @atomicmemory/langchain demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.