L0
Start here.
Install the SDK, add one line, and send your first trace. The API reference and SDK methods follow.
POST /v1/traces
{
"project":
"prj_llm_support_bot",
"name": "rag-agent",
"spans": [ … ]
}201 Created
L1
Install and send your first trace.
Install, one line to initialize, traces flow.
Python
install
pip install tracelayer
initialize
import tracelayer
tracelayer.init(api_key="tl_live_...") # one line — your existing calls are now traced
import tracelayer
# one line — your existing
# calls are now traced
tracelayer.init(
api_key="tl_live_...")
TypeScript
install
npm install tracelayer
initialize
import { init } from "tracelayer";
init({ apiKey: "tl_live_..." }); // one line — your existing calls are now traced
import { init }
from "tracelayer";
// one line — your existing
// calls are now traced
init({
apiKey: "tl_live_...",
});
L2
API reference.
Endpoints ▾
POST /v1/tracesSend a trace
GET /v1/traces/:idFetch a single trace by ID
GET /v1/tracesList and page through your traces
GET /v1/projectsList your projects
POST /v1/tracesSend a trace
GET /v1/traces/:idFetch a single trace by ID
GET /v1/tracesList and page through your traces
GET /v1/projectsList your projects
POST /v1/traces
Request
POST /v1/traces
Authorization: Bearer tl_live_...
{
"project": "prj_llm_support_bot",
"name": "rag-agent",
"spans": [
{ "type": "prompt", "latency_ms": 12, "tokens": 214 },
{ "type": "retriever", "latency_ms": 2870, "tokens": 0 },
{ "type": "model_call", "latency_ms": 2062, "tokens": 2646 },
{ "type": "tool", "latency_ms": 96, "tokens": 0 },
{ "type": "answer", "latency_ms": 30, "tokens": 0 }
]
}
POST /v1/traces
Authorization:
Bearer tl_live_...
{
"project":
"prj_llm_support_bot",
"name": "rag-agent",
"spans": [
{
"type": "prompt",
"latency_ms": 12,
"tokens": 214
},
{
"type": "retriever",
"latency_ms": 2870,
"tokens": 0
},
{
"type": "model_call",
"latency_ms": 2062,
"tokens": 2646
},
{
"type": "tool",
"latency_ms": 96,
"tokens": 0
},
{
"type": "answer",
"latency_ms": 30,
"tokens": 0
}
]
}
Response
201 Created
{
"id": "tr_3f9a2b7c",
"project": "prj_llm_support_bot",
"name": "rag-agent",
"total_latency_ms": 5070,
"total_tokens": 2860,
"total_cost_usd": 0.0205
}
201 Created
{
"id": "tr_3f9a2b7c",
"project":
"prj_llm_support_bot",
"name": "rag-agent",
"total_latency_ms": 5070,
"total_tokens": 2860,
"total_cost_usd": 0.0205
}
This is the shape of the API. Full API reference — in progress.
L3
SDK methods.
The methods you'll reach for.
- init(...)
Start tracing. One line; wraps your existing calls.
- trace(...)
Wrap a specific block or function by hand.
- span(...)
Record a single step inside a trace by hand.
- redact(...)
Strip sensitive fields before a trace is sent.
Full method signatures — in progress.