LangChain Integration
Generate Certified Execution Records (CERs) from LangChain workflows.
The createLangChainCer / certifyLangChainRun helpers documented here are thin DTO adapters in @nexart/ai-execution/langchain for inputs already shaped as a LangChain Run or callback payload.
For OpenAI SDK, Anthropic SDK, raw HTTP, n8n, custom code, or any other framework, use the framework-agnostic primitives certifyDecision and certifyAndAttestDecision from @nexart/ai-execution instead. See the AI Execution SDK page.
Best For
- AI agents that make decisions requiring audit trails
- LangChain chains and multi-step workflows
- Decision systems (moderation, policy review, approvals)
- Application logic that needs verifiable execution records
Overview
LangChain workflows can produce Certified Execution Records (CERs) using the NexArt AI Execution SDK. A CER is a cryptographically bound record of an AI execution, including inputs, outputs, and execution metadata. The record produces a deterministic certificate hash and can optionally be attested by a NexArt node.
Two Integration Paths
The SDK provides two helpers depending on whether you need node attestation:
createLangChainCer(...)creates a CER locally. No network call. Returns a deterministic certificate hash you can verify independently.certifyLangChainRun(...)creates a CER and sends it to a NexArt node for attestation. Returns a signed receipt and a public verification URL.
Installation
npm install @nexart/ai-executionThe LangChain integration is available as a subpath import:
import { createLangChainCer } from "@nexart/ai-execution/langchain";Create a CER Locally
Generate a CER from a LangChain run without contacting the node. This creates a Certified Execution Record locally and returns a deterministic certificate hash.
import { createLangChainCer } from "@nexart/ai-execution";
const { bundle, certificateHash } = createLangChainCer({
provider: "openai",
model: "gpt-4o-mini",
input: {
messages: [
{ role: "user", content: "Should this customer refund request be escalated?" }
]
},
output: {
decision: "escalate",
reason: "high_value_customer"
}
});
console.log(certificateHash);Certify with the NexArt Node
When a node URL is provided, the record is attested by the NexArt node and includes a signed receipt. This step is optional. Local CER creation is sufficient for many use cases.
import { certifyLangChainRun } from "@nexart/ai-execution";
const result = await certifyLangChainRun({
provider: "openai",
model: "gpt-4o-mini",
input: {
messages: [
{ role: "user", content: "Should this customer refund request be escalated?" }
]
},
output: {
decision: "escalate",
reason: "high_value_customer"
},
nodeUrl: "https://your-nexart-node.example",
apiKey: process.env.NEXART_API_KEY
});
console.log(result.verificationUrl);Verification
A CER produced by LangChain can be verified the same way as any other NexArt record. Open https://verify.nexart.io and verify using:
- Execution ID: look up by the execution identifier
- Certificate hash: paste the deterministic hash
- Uploaded CER bundle: upload the full bundle for offline-first verification
Use Cases
- AI agent decisions that require audit trails
- Moderation pipelines with verifiable outputs
- Workflow approvals backed by tamper-evident records
- AI-assisted automation with certification
Official Example Repo
github.com/artnames/nexart-langchain - runnable integration example for LangChain chains and agent workflows.
Next Steps
- Quickstart: create your first CER in three steps
- Verification: deep dive into verification semantics
- Examples: copy-ready API requests and response shapes