reference
LangChain Integration
After this page you should know what this surface is for, which source files own the behavior, which public route or adjacent page to use next, and which validation command to run before changing the claim. | Symptom | FAudience
Outcome
After this page you should know what this surface is for, which source files own the behavior, which public route or adjacent page to use next, and which validation command to run before changing the claim.
Troubleshooting
| Symptom | First check |
|---|---|
| A link or route is missing from the docs website | Check docs/public-docs.manifest.json, llms.txt, search, and the per-page Markdown export before changing navigation. |
| A claim is not backed by code or tests | Remove the claim or add the missing code, example, schema, or validation command before publishing. |
Use HELM as the OpenAI-compatible boundary for LangChain when you want existing chains or agents to keep their framework shape while tool effects are governed, denied, or receipted by HELM.
Basic Chat
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="gpt-4",
openai_api_base="http://localhost:9090/v1",
)
response = llm.invoke("Return the current policy status.")
print(response.content)
With A Tool
from langchain_core.tools import tool
from langchain_openai import ChatOpenAI
@tool
def list_workspace_files(path: str) -> str:
"""List files under an allowed workspace path."""
import os
return "\n".join(os.listdir(path))
llm = ChatOpenAI(
model="gpt-4",
openai_api_base="http://localhost:9090/v1",
).bind_tools([list_workspace_files])
response = llm.invoke("List files in /tmp.")
print(response.content)
Receipt Behavior
LangChain remains responsible for agent orchestration. HELM is responsible for the execution boundary. For governed tool calls, expect:
- input schema validation before execution;
- policy allow, deny, or escalation behavior;
- output validation where the manifest defines it;
- receipt metadata returned through headers, logs, or runtime receipt callbacks;
- a denial reason when the tool, path, budget, or identity is not allowed.
Failure Modes
| Symptom | Cause | Fix |
|---|---|---|
| LangChain calls the provider directly | openai_api_base is not set or a newer adapter option is required |
inspect LangChain provider docs and log the request host |
| a Python tool runs locally before HELM sees it | framework executed the local callable in-process | expose tools through the governed gateway or MCP path instead |
| denied tool appears as model confusion | app catches and rewrites HELM denial | preserve denial status, reason code, and receipt ID |
| streaming callback misses receipt metadata | callback only observes text chunks | log final response metadata or runtime receipt callback |
Source Truth
This page is a framework recipe. Keep endpoint and receipt claims aligned with the OpenAI base URL guide, MCP guide, and runtime tests. When LangChain changes provider option names, update the example rather than adding a custom HELM adapter.
Diagram
flowchart TD
subgraph Ingestion["1. Ingestion & Context Plane"]
source["Integration: LangChain"]
s0["Basic Chat"]
s1["With A Tool"]
s3["Failure Modes"]
output["Reader outcome"]
end
subgraph Ledger["4. Tamper-Evident Ledger Plane"]
s2["Receipt Behavior"]
end
%% Operational Flow Edges
source --> s0
s0 --> s1
s1 --> s2
s2 --> s3
s3 --> output
%% Premium Styling Rules
style s2 fill:#2f855a,stroke:#276749,stroke-width:2px,color:#fffMermaid source
flowchart TD
subgraph Ingestion["1. Ingestion & Context Plane"]
source["Integration: LangChain"]
s0["Basic Chat"]
s1["With A Tool"]
s3["Failure Modes"]
output["Reader outcome"]
end
subgraph Ledger["4. Tamper-Evident Ledger Plane"]
s2["Receipt Behavior"]
end
%% Operational Flow Edges
source --> s0
s0 --> s1
s1 --> s2
s2 --> s3
s3 --> output
%% Premium Styling Rules
style s2 fill:#2f855a,stroke:#276749,stroke-width:2px,color:#fffOperational Readiness
Use this page as the public operating layer for LangChain Integration. The source of truth is helm-ai-enterprise/docs/public/product/integrations/langchain.md; if this page and the implementation disagree, update the source-backed doc and rerun the validation command before publishing.
Before relying on this surface, confirm three things: the source path above still exists, the referenced commands or contracts are still present in the owning repo, and the docs-platform export surfaces still show this page in search, Markdown, llms-full.txt, and MCP without exposing protected routes.
Validation command: corepack pnpm run docs:coverage && corepack pnpm run docs:truth. For website parity, also run npm run exports:boundary and npm run thin-pages:check from docs-platform.
Expected Output
A reader should leave with a concrete next action, the source file or contract to inspect, the command that proves the claim, and a clear boundary for what is public versus protected. For reference pages, the expected output is a correctly scoped request, schema, command, or diagnostic path. For operations pages, the expected output is a reproducible readiness or failure signal that can be attached to an evaluation or support thread.
Failure Modes
If the validation command fails, do not patch this page in isolation. First identify whether the drift is in code, generated contracts, source-owner docs, or the docs manifest. If the public page needs a protected deep link, describe the protected document by name instead of exposing its route. Commercial operator details, tenant data, key ceremonies, and deployment-sensitive internals stay in protected customer or staff docs; this public page only exposes the safe developer contract.