How tracing works
The Trident SDK wraps OpenLLMetry (the open-source OpenTelemetry instrumentation layer for LLMs, built by Traceloop). When you calltrident.init(), the SDK patches every LLM client loaded in the same process — OpenAI, Anthropic, LangChain, and others — so each LLM call automatically becomes an OTEL span. Those spans are shipped to your Trident project’s OTLP ingest endpoint (/api/public/otel/v1/traces) using Basic auth derived from your project key pair.
You do not need to wrap individual calls or modify your agent logic. One init() call at startup covers everything in the process.
Installation and setup
- TypeScript
- Python
Install the SDK from npm:Call
trident.init() once at application startup, before any LLM calls:Environment variables
Instead of passing keys directly toinit(), you can set environment variables and call init() with no arguments:
VOUCH_PROJECT_PUBLIC_KEY and VOUCH_PROJECT_SECRET_KEY as back-compat aliases.
Zero-code option for Node.js
If you want to add tracing to an existing Node.js application without modifying its source code, use the--require flag to load the SDK’s auto-instrumentation register at process start:
TRIDENT_PROJECT_PUBLIC_KEY and TRIDENT_PROJECT_SECRET_KEY environment variables before running the command. No code changes required.
What each trace contains
Every traced LLM call produces a span with the following attributes:| Attribute | Description |
|---|---|
| Prompt text | The full messages array sent to the model |
| Model name | The model identifier (e.g. gpt-4o, claude-3-5-sonnet) |
| Tool calls | Any function/tool calls the model made, including arguments |
| MCP invocations | Model Context Protocol tool calls and their results |
| Response | The full model response text |
| Latency | End-to-end call duration in milliseconds |
| Token counts | Prompt tokens, completion tokens, and total |
PII redaction
The SDK scrubs sensitive data from span attributes inside your process, before any trace data is transmitted to Trident. The following patterns are redacted and replaced with a labelled placeholder (e.g.[EMAIL], [CREDIT_CARD]):
- Email addresses —
user@example.com - Credit card numbers — validated with Luhn checksum to avoid false positives
- US Social Security Numbers —
123-45-6789 - AWS access key IDs —
AKIA...,ASIA...,AIDA... - JSON Web Tokens — three-part
eyJ...strings - API keys —
sk-andsk-ant-prefixed secrets - IBANs — international bank account numbers
- IPv4 addresses
- Phone numbers
redactPII option to init():
- TypeScript
- Python
redactPII: false (TypeScript) or redact_pii=False (Python). Only do this if you have verified that your traces contain no sensitive data.
Viewing traces
Open the Traces tab in the Trident dashboard to see all captured spans. You can filter by:- Agent — scope the view to a specific
agentId - Time range — narrow to a deployment window or incident window
- Model — compare behaviour across model versions
- Trace ID — jump directly to the span linked from a finding
Tracing overhead is sub-millisecond. The SDK uses OpenTelemetry’s
BatchSpanProcessor by default, which buffers spans and exports them asynchronously. Your agent’s request latency is not measurably affected.