Latence TRACE Python SDK
Real-time safety for knowledge agents. Groundedness verification, privacy redaction, and context compression — without replacing your stack.
PyPI · Quickstart · Integrations · Examples · Website
pip install latence
from latence import Latence
trace = Latence(api_key="lat_...")
score = trace.grounding.rag(
query="Can I promise this customer a refund?",
response_text="Yes, the refund will arrive within 48 hours.",
raw_context="Refunds require manual finance approval before timelines are promised.",
)
print(score.risk_band)
print(score.runtime_decision)
What TRACE Does
- Groundedness — verify RAG answers against retrieved context.
- Compression — reduce long context to what matters.
- Privacy — redact private data before it spreads through tools, logs, or prompts.
Getting Started
export LATENCE_TRACE_API_KEY="lat_..."
from latence import Latence
trace = Latence()
The SDK connects to https://api.latence.ai by default. Override with base_url or LATENCE_TRACE_URL.
API Surface
# Groundedness scoring
score = trace.grounding.rag(query=..., response_text=..., raw_context=...)
# Privacy redaction
redacted = trace.privacy.redact(text=...)
# Context compression
compressed = trace.compression.text(text=..., compression_rate=0.4)
Latence is synchronous. AsyncLatence exposes the same surface for asyncio services.
Base dependencies are only httpx and pydantic.
Integrations
Direct calls are the recommended path. Optional helpers live under
latence.integrations.
pip install "latence[langchain]"
pip install "latence[llama_index]"
pip install "latence[openai]"
pip install "latence[haystack]"
Docs: Integrations
More
Metadata
Release files for latence 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| latence-0.2.0.tar.gz | 47.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| latence-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.0 kB
Release files / latence-0.2.0.tar.gz
| Download URL | latence-0.2.0.tar.gz |
|---|---|
| Size | 47.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
440ddd321bc9964e1d58c4aa7def3adf4cebfd5ca13e7ff2f2880937abc206b0
|
|
BLAKE2b-256 checksum How to use checksums |
0b915d93a19c77d0446c921ae537258e87fe8ad919cb6e3c92b51217230cd50e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 9, 2026.
Transparency logRelease files / latence-0.2.0-py3-none-any.whl
| Download URL | latence-0.2.0-py3-none-any.whl |
|---|---|
| Size | 43.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2da7095ba2258a126a51524467d4d251050cfb8f07cec5f145ae79fe576d845
|
|
BLAKE2b-256 checksum How to use checksums |
c80b64f91fa507eeaeecbf67e080cf6059175843fcadabed27ec151af94db0ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 9, 2026.
Transparency log