Skip to content

LangChain integration

Mask personal data in LangChain chains and agents

Point LangChain's OpenAI, Anthropic or Gemini chat models at the Maskflare gateway. Prompts, retrieved documents and tool calls are masked before they reach the provider.
What Maskflare covers
  • Prompts built by chains, including retrieved context and memory
  • Tool and function-call arguments sent to the model
  • Streaming responses, with values restored
  • Embeddings calls through the gateway, masked deterministically

LangChain apps pull data from many places into one prompt: user input, retrieved documents, tool results and conversation memory. Any of them can carry a customer's name or an API key.

Because Maskflare works at the HTTP layer, you don't need a LangChain-specific plugin. Set the chat model's base URL to your gateway route and authenticate with a Maskflare key. Everything LangChain sends through that model is masked, and real values come back in the answer.

Set up LangChain with Maskflare

LangChain's chat model classes accept a base URL. Point them at your Maskflare gateway route for the provider and every chain, agent and retriever call is masked.

Python: LangChain with the Maskflare gateway
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="gpt-4o",
    base_url="https://YOUR_GATEWAY_HOST/v1/openai",
    api_key="mf_live_...",  # a Maskflare key
)

llm.invoke("Summarize the ticket from ada@example.com about invoice 4471")

What gets masked

Good to know

Frequently asked questions

Is there a LangChain package for Maskflare?

You don't need one. LangChain's model classes call the provider over HTTP, so changing the base URL routes them through Maskflare.

Does it work with LangGraph agents?

Yes. Any model call that goes through the configured chat model is masked, whichever agent framework drives it.

What about documents in my vector store?

Mask them with the SDK in deterministic mode before indexing, so the same value always maps to the same token and retrieval still works.

Other integrations

See it on your own data

Try Maskflare free.
Bring your hardest prompts.

28-day free trial or 10,000 requests, whichever comes first. Point one app at the gateway or enroll a few laptops,
and watch what gets masked. Or talk to us first.