SDK QUICKSTART

Verify emails from LangChain.

Drop-in tool for a LangChain agent, with structured reasons the model can quote.

1. Install

Grab a free API key at tooltrace.io/signup. The free plan includes 1,000 verifications per month.

Installbash
pip install tooltrace-langchain

2. Quickstart

Set TOOLTRACE_KEY in your environment, then verify a single address.

Add the tool to an agentpython
from langchain.agents import create_openai_tools_agent, AgentExecutor
from langchain_openai import ChatOpenAI
from tooltrace_langchain import ToolTraceVerifyEmailTool

tools = [
    ToolTraceVerifyEmailTool(api_key=os.environ["TOOLTRACE_KEY"]),
    # ... your other tools
]

llm = ChatOpenAI(model="gpt-5", temperature=0)
agent = create_openai_tools_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)

result = executor.invoke({
    "input": "Can [email protected] actually receive mail? If not, explain why.",
})
print(result["output"])

3. Advanced

Patterns for production use: idempotency, retries, and typed errors.

Why the reasons field matters for agentspython
# The tool returns a structured payload the model can quote back:
#
# {
#   "status": "risky",
#   "score": 42,
#   "reasons": ["typo_suggested"],
#   "suggestion": "[email protected]"
# }
#
# A well-prompted agent will reply:
#
# "I checked [email protected] and the result was 'risky' with a score of
#  42. The reason is 'typo_suggested': the domain acme.co looks like a
#  typo of acme.com. Want me to verify [email protected] instead?"
#
# This is why ToolTrace exposes 'reasons' rather than a free-text
# explanation: the agent can quote the structured field directly without
# hallucinating.

What you get

  • One-line tool install for LangChain + LangGraph agents
  • Structured response: status, 0-100 score, atomic checks, reasons, suggestion
  • Works with any LangChain-compatible LLM (OpenAI, Anthropic, Mistral, local)
  • Shares the credit pool with every other ToolTrace API
  • Deterministic: same input returns the same output, cached for 7 days

External links