Skip to main content

Traceloop

The Traceloop SDK (OpenLLMetry) auto-instruments supported LLM SDKs and groups related calls into named workflows.

You will need:

  • OODLE_INSTANCE: your Oodle instance ID (ap1, us1)
  • OODLE_API_KEY: an Oodle API key (ap1, us1)
  • OTLP_ENDPOINT: your OTLP collector domain, shown on the tile

Open the Traceloop tile on the ap1, us1 page to get these filled in for you, or let an agent do the setup with /oodle-onboarding set up the llm_observability_traceloop integration.

Python

Install

Install the Traceloop SDK alongside your LLM provider SDK:

pip install traceloop-sdk \
google-genai

Instrument

Initialize the Traceloop SDK. It auto-instruments your LLM SDK calls, so every request is traced automatically:

from google import genai
from traceloop.sdk import Traceloop
from traceloop.sdk.decorators import workflow

# Auto-instruments supported LLM SDK calls (Gemini, OpenAI,
# Anthropic, LangChain, and more). No manual spans required.
Traceloop.init(app_name="my-llm-app")

client = genai.Client()


# Optional: group related LLM calls under a named workflow span.
@workflow(name="chat")
def chat(message: str) -> str:
response = client.models.generate_content(
model="gemini-flash-latest",
contents=message,
)
return response.text

Environment

Point the application at Oodle:

# The Traceloop SDK appends /v1/traces to this base URL.
export TRACELOOP_BASE_URL=https://<OTLP_ENDPOINT>

export TRACELOOP_HEADERS="X-API-KEY=<OODLE_API_KEY>,X-OODLE-INSTANCE=<OODLE_INSTANCE>"

# Optional: disable prompt/response capture (enabled by default)
# export TRACELOOP_TRACE_CONTENT=false

TypeScript / JavaScript

Install

Install the Traceloop SDK alongside your LLM provider SDK:

npm install @traceloop/node-server-sdk openai

Instrument

Initialize the Traceloop SDK. It auto-instruments your LLM SDK calls, so every request is traced automatically:

const traceloop = require('@traceloop/node-server-sdk');

// Auto-instruments supported LLM SDK calls (OpenAI, Anthropic,
// Bedrock, LangChain, and more). No manual spans required.
traceloop.initialize({
appName: 'my-llm-app',
baseUrl: process.env.TRACELOOP_BASE_URL,
headers: {
'X-API-KEY': '<OODLE_API_KEY>',
'X-OODLE-INSTANCE': '<OODLE_INSTANCE>',
},
});

// Require your LLM SDK after initialize: auto-instrumentation
// patches modules as they load, so requiring it first yields no spans.
const OpenAI = require('openai');

// Short-lived processes must flush before they exit.
// await traceloop.forceFlush();

Environment

Point the application at Oodle:

# The Traceloop SDK appends /v1/traces to this base URL.
export TRACELOOP_BASE_URL=https://<OTLP_ENDPOINT>

# Optional: disable prompt/response capture (enabled by default)
# export TRACELOOP_TRACE_CONTENT=false

Verify

Run your application, then open ap1, us1. Spans carry gen_ai.* attributes: the model, token counts, and the prompt and response content. Click a trace for the Transcript, the waterfall, and the cost breakdown.

If nothing arrives, check that the exporter can reach https://<OTLP_ENDPOINT> and that the instance and key are set: the OTLP gateway answers 401 without them.


Support

If you need assistance or have any questions, please reach out to us through: