@agentkernel/langchain-adapter
v0.1.1
Published
LangChain adapter for AgentKernel — intercepts tool calls with PolicyEngine
Maintainers
Readme
@agentkernel/langchain-adapter
LangChain adapter for AgentKernel — intercepts tool calls with PolicyEngine to enforce security policies on any LangChain tool.
Installation
pnpm add @agentkernel/langchain-adapterPeer Dependencies
@langchain/core>= 0.2.0
Usage
import { wrapToolWithPolicy } from '@agentkernel/langchain-adapter';
import { PolicyEngine } from '@agentkernel/runtime';
const policyEngine = new PolicyEngine(myPolicySet);
// Wrap any LangChain tool with policy enforcement
const safeTool = wrapToolWithPolicy(myLangChainTool, policyEngine, {
agentId: 'my-agent',
});
// Tool calls are now intercepted and checked against policies
const result = await safeTool.invoke({ input: 'read /etc/passwd' });See the main repo for full documentation.
License
MIT
