traceloop
БесплатноБез исполняемых скриптовНе проверенTraceloop's OpenLLMetry SDK adds OpenTelemetry tracing to LLM applications: it auto-instruments OpenAI, Anthropic, LangChain, LlamaIndex and vector databases…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Traceloop (OpenLLMetry)
Overview
OpenLLMetry is a set of OpenTelemetry instrumentations for LLM providers, vector databases and agent frameworks, plus the Traceloop SDK that wires them up in one call. Output is standard OTLP, so it goes to whatever you already run, or to Traceloop Cloud. Python package traceloop-sdk (0.62.x at the time of writing, Apache-2.0) and JavaScript package @traceloop/node-server-sdk (0.27.x).
By default prompts and completions are recorded on spans as gen_ai.input.messages / gen_ai.output.messages (OpenTelemetry GenAI semantic conventions), together with model, token counts and latency.
Instructions
Install
pip install traceloop-sdk httpx
npm install @traceloop/node-server-sdk
httpx is listed here on purpose: in a clean virtualenv with traceloop-sdk 0.62.4, from traceloop.sdk import Traceloop failed with ModuleNotFoundError: No module named 'httpx' until it was installed by hand.
Initialize (Python)
Call Traceloop.init() once, before creating provider clients.
from traceloop.sdk import Traceloop
Traceloop.init(app_name="support-bot", disable_batch=False)
Configuration normally comes from environment variables, which keeps keys out of code:
| Variable | Meaning |
|---|---|
TRACELOOP_API_KEY |
Traceloop Cloud key (needed only for the default endpoint https://api.traceloop.com) |
TRACELOOP_BASE_URL |
OTLP/HTTP base URL of any other backend; the SDK appends the signal path itself |
TRACELOOP_HEADERS |
Auth headers as key1=value1,key2=value2 |
TRACELOOP_TRACE_CONTENT |
false stops recording prompts, completions and embeddings |
TRACELOOP_TRACING_ENABLED |
false disables tracing |
With neither an API key, an exporter, a processor nor a custom base URL, init() prints a missing-key error and returns without tracing.
Initialize (Node.js)
import * as traceloop from "@traceloop/node-server-sdk";
traceloop.initialize({
appName: "support-bot",
disableBatch: process.env.NODE_ENV !== "production",
});
Import the SDK before any LLM library. The option for a custom backend is baseUrl (not apiEndpoint), with headers for authentication. Under Next.js or bundlers, auto-instrumentation needs instrumentModules; see the Next.js guide in the Traceloop docs.
Structure traces with decorators (Python)
@workflow, @task, @agent and @tool work on sync and async functions alike. The @aworkflow, @atask, @aagent, @atool variants are deprecated.
from traceloop.sdk import Traceloop
from traceloop.sdk.decorators import workflow, task, agent, tool
@task(name="classify-intent")
async def classify_intent(message: str) -> str:
response = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": f"Classify the intent: {message}"}],
)
return response.choices[0].message.content
@workflow(name="support-pipeline")
async def handle_ticket(ticket: dict):
Traceloop.set_association_properties({"user_id": ticket["user_id"], "session_id": ticket["session_id"]})
return await classify_intent(ticket["message"])
Spans are named <name>.workflow, <name>.task and so on, and carry traceloop.span.kind. Association properties attach to every span in the current trace and let you filter by user or session in the backend. @conversation(conversation_id=...) sets a conversation ID on all spans inside a function.
Structure traces (Node.js)
withWorkflow, withTask, withAgent and withTool call the function immediately and return a promise; they are not wrappers you store for later:
const answer = await traceloop.withWorkflow({ name: "rag-query" }, async (query: string) => {
const docs = await traceloop.withTask({ name: "retrieve" }, retrieveDocs, query);
return traceloop.withTask({ name: "generate" }, generateAnswer, query, docs);
}, "How do I reset my password?");
withAssociationProperties({ user_id: "u-1842" }, fn) tags the spans created inside fn.
Export to a backend
Set the environment before starting the process. The SDK sends OTLP over HTTP.
# Honeycomb
export TRACELOOP_BASE_URL=https://api.honeycomb.io
export TRACELOOP_HEADERS="x-honeycomb-team=$HONEYCOMB_API_KEY"
# Datadog: send to a Datadog Agent with the OTLP HTTP receiver enabled (port 4318)
export TRACELOOP_BASE_URL=http://datadog-agent.monitoring:4318
# Any OpenTelemetry Collector (Tempo, Jaeger, Grafana Cloud sit behind it)
export TRACELOOP_BASE_URL=http://otel-collector.monitoring:4318
Datadog is reached through an Agent or Collector, not by posting directly to a Datadog intake URL. For Grafana Cloud follow the "Grafana" integration page: it needs the Tempo URL, stack ID and token.
To use your own exporter or processor, pass exporter= or processor= (not both) to Traceloop.init().
Examples
Example 1: Trace a RAG pipeline locally
User prompt: "A
Установить traceloop в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл traceloop?
Traceloop's OpenLLMetry SDK adds OpenTelemetry tracing to LLM applications: it auto-instruments OpenAI, Anthropic, LangChain, LlamaIndex and vector databases, and exports spans to any OTLP backend (Grafana Tempo, Datadog, Honeycomb, Jaeger, Traceloop Cloud). Use when someone asks to "trace LLM calls", "add observability to my AI app", "OpenLLMetry", "Traceloop", "monitor token usage and latency", or "send LLM traces to Grafana/Honeycomb/Datadog".
Как установить скилл traceloop?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл traceloop запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic