LangChain.js Integration
Use the LangChain.js adapter when the model already runs inside your Node.js app and you want provenance at the tool boundary.
Choose The Pattern
Give The Agent JACS Tools
Use createJacsTools() when the model should explicitly ask to sign, verify, inspect trust, or create agreements.
import { JacsClient } from '@hai.ai/jacs/client';
import { createJacsTools } from '@hai.ai/jacs/langchain';
const client = await JacsClient.quickstart({
name: 'my-agent',
domain: 'my-agent.example.com',
});
const jacsTools = createJacsTools({ client });
const llmWithTools = model.bindTools([...myTools, ...jacsTools]);
The tool set includes 14 tools:
jacs_signjacs_verifyjacs_create_agreementjacs_sign_agreementjacs_check_agreementjacs_verify_selfjacs_trust_agentjacs_trust_agent_with_keyjacs_list_trustedjacs_is_trustedjacs_share_public_keyjacs_share_agentjacs_auditjacs_agent_info
Auto-Sign Existing Tools
Use this when the model should keep using your existing tool set but every result needs a signature.
Wrap one tool:
import { signedTool } from '@hai.ai/jacs/langchain';
const signed = signedTool(mySearchTool, { client });
Wrap a LangGraph ToolNode:
import { jacsToolNode } from '@hai.ai/jacs/langchain';
const node = jacsToolNode([tool1, tool2], { client });
For custom graph logic:
import { jacsWrapToolCall } from '@hai.ai/jacs/langchain';
const wrapToolCall = jacsWrapToolCall({ client });
Install
npm install @hai.ai/jacs @langchain/core
npm install @langchain/langgraph
@langchain/langgraph is only required for jacsToolNode().
Strict Mode
Pass strict: true when you want wrapper failures to throw instead of returning error-shaped output:
const jacsTools = createJacsTools({ client, strict: true });
Examples In This Repo
jacsnpm/examples/langchain/basic-agent.tsjacsnpm/examples/langchain/signing-callback.ts
When To Use MCP Instead
Choose Node.js MCP Integration instead when:
- the model is outside your process and connects over MCP
- you want a shared MCP server usable by multiple clients
- you need transport-level signing in addition to signed tool outputs