@oconnector/adapter-langchain
v10.1.3
Published
ABS Core Governance Adapter for LangChain
Maintainers
Readme
@abscore/adapter-langchain
The official LangChain/LangGraph adapter for ABS Governance Layer.
Features
- Self-Healing Tools: Tools that intercept violations and return conversational instructions back to LangChain (
ABSBlockError) allowing the AI to organically fix mistakes without breaking the app loop. - Offline Engines (PAAT): Pass your offline Signed Token (PAAT JWT) & Public Key directly, bringing the WebAssembly rust core inside node.js — ZERO latency for your agent!
- Compliance Attestation Token (CAT): The adapter automatically hashes responses and signs cryptographic Proof of Attestation using
jose, guaranteeing the Agent execution was safe and bounded by limits.
Installation
npm install @abscore/adapter-langchainBasic Usage
Wrap any DynamicStructuredTool or structured invocation with withAbsGuard:
import { withAbsGuard } from '@abscore/adapter-langchain';
import { DynamicStructuredTool } from "@langchain/core/tools";
import { z } from "zod";
const originalTool = new DynamicStructuredTool({
name: "transfer_funds",
description: "Triggers a SEPA wire",
schema: z.object({ amount: z.number() }),
func: async ({ amount }) => {
return `Wired ${amount}`;
}
});
// Create an ABS Gov governed tool
const governedTool = withAbsGuard(originalTool, {
paatToken: process.env.PAAT_JWT, // The Offline execution token
publicKey: process.env.PUBLIC_KEY,
signingKey: process.env.LOCAL_PRIVATE_KEY, // The signature layer for emitting CATs
agentId: 'ai-financial-bot'
});(See Phase 2, 3 and 4 of ABS Core Roadmap for deeper dives into withAbsGuard limitations and configurations).
