Native library reference. Extended CLI examples use
jacs-compat. This source reference can include unreleased changes; see the package guide for installation and MCP profiles for available tools.
LangChain.js Integration
Source and published packages: Version 0.16.1 has a recorded release inventory. Version 0.16.0 is the first release whose source includes the native PQ DID/JWK and Agent Card behavior. See the identity integration guide.
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 13 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_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
Signed wrappers fail closed by default: signing failures withhold the output.
The explicit allowUnsignedOutput: true compatibility option permits unsigned
fallback; strict: true overrides it. Tool-operation error reporting is separate:
const jacsTools = createJacsTools({ client, strict: true });
Examples In This Repo
archive/native/jacsnpm/examples/langchain/basic-agent.tsarchive/native/jacsnpm/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