Docs · LangChain
Precleared with LangChain and LangGraph
The precleared package gives a LangChain or LangGraph agent a check it can run before it sends a cold or marketing email: is it allowed for this address? It covers the UK, US, Canada, Germany, France, Australia, Ireland and the Netherlands, quotes the rule and returns a signed receipt. It works without a key on the free daily allowance.
Python
pip install "precleared[langchain]" langchain
from langchain.agents import create_agent from precleared.langchain import precleared_tools agent = create_agent(model, tools=precleared_tools()) # or precleared_tools(api_key="pc_live_...")
precleared_tools() returns two StructuredTools, precleared_check and precleared_verify_receipt, with pydantic argument schemas, so they also work with model.bind_tools(...) and LangGraph's prebuilt agents. The key can also come from the PRECLEARED_API_KEY environment variable.
TypeScript
npm install precleared zod @langchain/core langchain
import { createAgent } from 'langchain';
import { Precleared } from 'precleared';
import { preclearedTools } from 'precleared/langchain';
const client = new Precleared({ apiKey: process.env.PRECLEARED_API_KEY });
const agent = createAgent({ model, tools: await preclearedTools(client) });preclearedTools() returns [contact_check, verify_receipt] as DynamicStructuredTools, so they also work with model.bindTools(...) and LangGraph.
What the tools return
Compact text the model can act on: the verdict, the rule that decided it with its source, what the footer must include, the next step and the receipt link. Pass { format: 'json' } to preclearedTools() for objects instead. API errors such as the daily limit come back as text too, with the link to fix them, so the agent can tell the person instead of crashing.
Verdicts
Keys and limits
Without a key: 10 checks a day per network. A free key from /get-key gives 25 a day. After that, packs: £9 for 300 checks (a key's first purchase) or £39 for 2,000. 60 checks a minute per key.
Links: PyPI, the Python source, the npm package, the API reference and Precleared with the Vercel AI SDK.
Decision support with sources, not legal advice.