SDK overview
What the Python and TypeScript instrumentation SDKs add over the base-URL swap — trace/agent tagging and typed, honest receipts — and when to reach for one.
On this page
The base-URL swap already gets you routing and the x-tt-* receipt headers on every
response. The SDKs are an optional convenience layer on top: they emit the trace headers
for you, read back a typed receipt, and never fabricate a dollar. Both bindings — Python and
TypeScript — implement the same contract against a shared byte-equality conformance corpus.
What the SDK adds
Over a plain base-URL swap, the SDK gives you:
- Header emission — a deterministic, charset-guarded, byte-capped
x-tt-*map from the ambient context; it never throws (it coerces-or-drops). - Context/identity scopes — mint and propagate
x-tt-trace-id/step-id/parent-idacross async boundaries (Pythoncontextvars; TypeScriptAsyncLocalStorage). - Agent & dimension tagging in one place — the same wire columns the dashboard filters on.
- Typed receipt read-back — an immutable
Receiptwithmode/decision/cache/refusal/ model-rewrite, and a deep link to the ledger record. - Auto-injecting, origin-scoped transport — Python httpx/requests adapters, a TS
fetch/wrapFetch— that never touch the body, method, URL, or auth. - An exporter seam, a first-run doctor (
check()), a ledger pull + feedback write to your own admin plane, and framework adapters (Python: LangChain, CrewAI, OTel; TS: OTel). - Zero runtime dependencies, never-throws, no phone-home — the core opens no sockets; only the lazily-imported admin transport talks to your admin plane.
When to use it
- Reach for the SDK when you control the HTTP client and want per-step / per-agent attribution, typed receipts, or the ledger pull — especially in framework code (LangGraph, CrewAI, custom agents).
- Skip it when a plain base-URL swap is enough (you just want costing and routing), or
for Claude Code, where
wrapalready injects a per-session trace header.