LangChain integration for Kerq trust scoring and telemetry
Project description
langchain-kerq
LangChain integration for Kerq — trust scoring and telemetry for AI agent tool calls.
Why Kerq?
AI agents connect to dozens of tools. Kerq scores each one for trust, security, and reliability before your agent runs it — and tracks performance telemetry so you can see exactly what's happening.
Installation
pip install langchain-kerq
Quick Start
Get your API key at kerq.dev. Full API docs at kerq.dev/docs.
KerqTrustTool
Check a tool's trust score before connecting to it. Works as a standard LangChain tool that agents can invoke directly.
from langchain_kerq import KerqTrustTool
kerq = KerqTrustTool(api_key="your-api-key")
# Invoke directly
result = kerq.invoke("github-mcp-server")
print(result)
# {"trust_score": 87, "tier": "high", "score_breakdown": {...}}
# Or let your agent use it as a tool
from langchain_core.agents import AgentExecutor
agent = ... # your LangChain agent
agent_executor = AgentExecutor(agent=agent, tools=[kerq])
KerqTelemetryHandler
Automatically intercept every tool call and report telemetry to Kerq. Telemetry is always fire-and-forget — it never blocks your agent.
from langchain_kerq import KerqTelemetryHandler
handler = KerqTelemetryHandler(api_key="your-api-key")
# Attach to any agent invocation
result = agent.invoke(
{"input": "search the web for news"},
config={"callbacks": [handler]},
)
Options:
Parameter
Type
Default
Description
api_key
str
required
Your Kerq API key
telemetry
bool
True
Enable/disable telemetry reporting
KerqGuard
The full package: trust gating + telemetry in one callback. Blocks tools that score below your threshold and reports all executions to Kerq.
from langchain_kerq import KerqGuard
guard = KerqGuard(
api_key="your-api-key",
min_score=70, # block any tool scoring below 70
telemetry=True, # report execution telemetry
)
result = agent.invoke(
{"input": "run my workflow"},
config={"callbacks": [guard]},
)
Options:
Parameter
Type
Default
Description
api_key
str
required
Your Kerq API key
min_score
int
70
Minimum trust score to allow a tool to run (0–100)
telemetry
bool
True
Enable/disable telemetry reporting
Trust score rules:
Score >= min_score -> tool runs
Score < min_score -> tool is blocked
Score missing, null, or unparseable -> treated as 0 -> blocked
Error Handling
All components handle API errors gracefully:
401 Invalid key -> warning logged, operation skipped
404 Not found -> clear error returned
429 Rate limited -> warning logged, operation skipped
500 Server error -> warning logged, operation skipped
Network errors -> warning logged, operation skipped
Errors never crash your agent.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_kerq-0.1.0.tar.gz.
File metadata
- Download URL: langchain_kerq-0.1.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.11.15 Linux/6.17.0-1010-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d0e97a9cdd556794450d86a1d8bf13ea0936fa7ad87d0cf0515d5d560e7cf1d
|
|
| MD5 |
5ffa69df35e794a51863b49be85ee950
|
|
| BLAKE2b-256 |
e6a23fce585828885e6d484e6483ea333cd504fcf96bf91019f06170ada255df
|
File details
Details for the file langchain_kerq-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_kerq-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.11.15 Linux/6.17.0-1010-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a3a3348c2665c2218bb761f6e8f8faab0b26139d9121c6d144861f629117891
|
|
| MD5 |
c7f17a3c01ee5fe0c227a9abea96cbcf
|
|
| BLAKE2b-256 |
d734c76fb8e18e28ad95d7c5e015621e326b212dcc48a7b249a77c39e32236f0
|