vouch-sdk package wraps OpenLLMetry auto-instrumentation and points it at your Trident project. One call to vouch_sdk.init() patches every LLM client loaded in your Python process — OpenAI, Anthropic, LangChain, CrewAI, LlamaIndex, Bedrock, VertexAI, Cohere, and more — and ships the resulting OpenTelemetry spans to app.usetrident.dev. PII redaction runs entirely inside your runtime before any trace data leaves, keeping emails, API keys, credit card numbers, and other sensitive values out of the wire.
Requirements
- Python 3.10 or later
- pip
Install
Install the base package
Set your environment variables
Add your project keys from Settings → API Keys at app.usetrident.dev to your.env file or deployment secrets manager:
.env
VOUCH_PROJECT_PUBLIC_KEY / VOUCH_PROJECT_SECRET_KEY names for backwards compatibility.
Initialize Trident
Callvouch_sdk.init() once, before you create any LLM client. Every LLM call made after init() is automatically traced.
project_pk and project_sk are omitted, init() reads them from TRIDENT_PROJECT_PUBLIC_KEY / TRIDENT_PROJECT_SECRET_KEY automatically.
All options
| Parameter | Type | Default | Description |
|---|---|---|---|
project_pk | str | env | Project public key. Reads TRIDENT_PROJECT_PUBLIC_KEY. |
project_sk | str | env | Project secret key. Reads TRIDENT_PROJECT_SECRET_KEY. |
agent_id | str | env | Logical agent identifier shown in the dashboard. Reads TRIDENT_AGENT_ID. |
endpoint | str | https://app.tryvouch.ai | Override the Trident host. Reads TRIDENT_ENDPOINT. |
agent_url | str | env | Public HTTP endpoint for Red Team auto-targeting. Reads VOUCH_AGENT_URL. |
app_name | str | agent_id | OTel resource service.name. Falls back to "vouch-app". |
disable_batch | bool | False | Emit each span immediately. Useful for short-lived scripts. |
instruments | set | None | Restrict which traceloop instruments are activated. |
redact_pii | bool | dict | True | Edge PII redaction. True uses the built-in rule set; pass {"rules": [...]} for custom rules; False disables. |
**traceloop_kwargs | Extra keyword arguments forwarded verbatim to Traceloop.init(). |
Full working example
The snippet below starts Trident tracing and makes a standard OpenAI chat completion. The call is traced automatically — no wrapping required.LangChain example
Install thelangchain extra, then call init() before building your chain:
Supported LLM frameworks
The SDK auto-instruments all of the following when they are imported in the same process:OpenAI
Anthropic
LangChain
CrewAI
LlamaIndex
Amazon Bedrock
Google VertexAI
Cohere
MCP (Model Context Protocol)
OpenAI Agents SDK
LangChain and CrewAI require the
[langchain] extra: pip install "vouch-sdk[langchain]".PII redaction defaults
redact_pii=True is the default. Before any span attribute leaves your process, the SDK scans and replaces the following patterns with [REDACTED_<TYPE>] tokens:
- EMAIL — email addresses
- AWS_KEY — AWS access key IDs (
AKIA…,ASIA…) - JWT — JSON Web Tokens
- API_KEY — API keys (
sk-…,sk-ant-…) - SSN — US Social Security Numbers (
XXX-XX-XXXX) - CREDIT_CARD — credit card numbers (Luhn-validated)
- IBAN — International Bank Account Numbers
- IP — IPv4 addresses
- PHONE — phone numbers
redact_pii=False to disable, or redact_pii={"rules": [...]} to supply a custom list of PiiRule objects.
Next steps
Python SDK API Reference
Explore the full API:
vouch_sdk.init(), firewall_headers(), redact_text(), redact_value(), and all configuration options.