
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@sapiom/langchain
Advanced tools
🕗 Deprecated. Sapiom has moved to a new agent-first platform. This package is not recommended for new projects and receives maintenance fixes only. Build on the new packages instead —
@sapiom/agentand@sapiom/tools, with the@sapiom/cliand@sapiom/mcpdeveloper tools. See the SDK README.
LangChain v1.x Integration: For LangChain v0.3.x, use
@sapiom/langchain-classicinstead.
LangChain v1.x integration for Sapiom SDK.
npm install @sapiom/langchain langchain
Note: The
createAgentAPI shown below is part of LangChain v1.x.
import { createAgent } from "langchain";
import { createSapiomMiddleware } from "@sapiom/langchain";
const agent = createAgent({
model: "gpt-4",
tools: [getWeather, sendEmail],
middleware: [
createSapiomMiddleware({
apiKey: process.env.SAPIOM_API_KEY,
}),
],
});
// All model and tool calls are automatically tracked!
const result = await agent.invoke({
messages: [{ role: "user", content: "What's the weather in Tokyo?" }],
});
createSapiomMiddleware({
// Required (or use SAPIOM_API_KEY env var)
apiKey: "sk-...",
// Control behavior
enabled: true, // Enable/disable tracking
failureMode: "open", // 'open' (graceful) | 'closed' (strict)
// Default trace/agent info
traceId: "my-workflow", // Groups related transactions
agentId: "AG-001", // Tag with existing agent
agentName: "my-agent", // Find-or-create agent by name
});
await agent.invoke(
{ messages: [...] },
{
context: {
sapiomTraceId: "conversation-456",
sapiomAgentId: "AG-002",
},
}
);
| Mode | Behavior |
|---|---|
open (default) | Log errors, continue without tracking |
closed | Throw errors, block operations |
Authorization denials always throw regardless of failure mode.
For LangChain v0.x (< 1.0.0), use @sapiom/langchain-classic:
npm install @sapiom/langchain-classic
See @sapiom/langchain-classic for documentation.
MIT © Sapiom
FAQs
LangChain v1.x integration for Sapiom SDK
We found that @sapiom/langchain demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.