import requests
from langchain.tools import tool
ENCRATA_API_KEY = "YOUR_API_KEY"
BASE_URL = "https://encrata.com/api/agent"
HEADERS = {
"Authorization": f"Bearer {ENCRATA_API_KEY}",
"Content-Type": "application/json",
}
@tool
def lookup_email(email: str) -> dict:
"""Look up detailed intelligence about a person by their email address.
Returns name, company, job role, industry, location, social profiles,
breach history, and email validity. Costs 1 credit."""
resp = requests.post(
f"{BASE_URL}/lookup",
headers=HEADERS,
json={"email": email},
)
resp.raise_for_status()
return resp.json()
@tool
def validate_email(email: str) -> dict:
"""Validate whether an email address is deliverable, invalid,
or disposable. Free — does not cost credits."""
resp = requests.post(
f"{BASE_URL}/validate",
headers=HEADERS,
json={"email": email},
)
resp.raise_for_status()
return resp.json()
@tool
def check_breaches(email: str) -> dict:
"""Check if an email has been exposed in known data breaches.
Returns breach count, affected services, and exposed data types.
Free — does not cost credits."""
resp = requests.post(
f"{BASE_URL}/breaches",
headers=HEADERS,
json={"email": email},
)
resp.raise_for_status()
return resp.json()