Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lumiqtrace.com/llms.txt

Use this file to discover all available pages before exploring further.

LumiqTrace instruments your agents and LLM calls by wrapping your existing clients. Once initialized, every agent run, tool call, and model interaction is automatically captured and sent to your project’s dashboard. This guide walks through the setup using Node.js and OpenAI, with a Python alternative included.
1

Create your account and project

Go to app.lumiqtrace.com and sign up for a free account. After verifying your email, you’ll be taken through the onboarding wizard:
  1. Create an organization — your billing workspace.
  2. Create a project — an isolated container for agent events. Name it after the application you’re instrumenting (e.g. my-support-agent-production).
  3. Copy your API key — shown once after project creation. It starts with lqt_ followed by 64 hex characters.
Your API key is shown in full only once. If you lose it, rotate it from Settings → API Keys — the old key remains valid for 24 hours during rollover.
2

Install the SDK

npm install @lumiqtrace/sdk openai
3

Initialize and wrap your client

Add the following at the entry point of your application — before any agent or LLM calls are made.
import { lumiqtrace } from "@lumiqtrace/sdk";
import OpenAI from "openai";

lumiqtrace.init({
  apiKey: process.env.LUMIQTRACE_API_KEY!,
  environment: "production",
});

const openai = lumiqtrace.wrapOpenAI(new OpenAI());
lumiqtrace.init() initializes the global SDK client. wrapOpenAI() patches the OpenAI client so all calls — and every agent step that goes through it — are automatically traced. Your existing code is unchanged.
Replace lqt_your_key_here with the API key from the dashboard. The SDK logs a warning if the key format is invalid.
4

Run your agent or make an LLM call

Use your client exactly as you would normally. The SDK captures everything — model name, input and output tokens, cost, latency, tool calls, streaming TTFT, and finish reason.
import { lumiqtrace, withAgent } from "@lumiqtrace/sdk";
import OpenAI from "openai";

lumiqtrace.init({ apiKey: process.env.LUMIQTRACE_API_KEY!, environment: "production" });
const openai = lumiqtrace.wrapOpenAI(new OpenAI());

// Wrap as an agent to see the full agent trace
await withAgent(
  {
    name: "SupportAgent",
    role: "specialist",
    tools: [{ name: "lookup_order", description: "Look up an order by ID" }],
  },
  async (agent) => {
    agent.logPlan(["Understand request", "Look up order", "Draft response"]);

    const order = await agent.traceTool(
      "lookup_order",
      { id: "ORD-123" },
      () => Promise.resolve({ status: "delivered", total: 49.99 })
    );

    const response = await openai.chat.completions.create({
      model: "gpt-4o",
      messages: [
        { role: "system", content: "You are a helpful support agent." },
        { role: "user", content: `Order ${order}: help me with my refund.` },
      ],
    });

    console.log(response.choices[0].message.content);
  }
);
5

View your trace in the dashboard

Open app.lumiqtrace.com and navigate to your project. Within a few seconds you should see your trace in the Traces view. Click any row to open the flame graph — each bar is a span (agent scope, tool call, LLM call) with full cost and latency breakdown.
If no trace appears after 15 seconds, check that your API key is correct and that your process did not exit before the SDK flushed. Call await lumiqtrace.getClient().flush() (TypeScript) or lumiqtrace.flush() (Python) at the end of your script to force an immediate flush. See the Serverless guide if running in Lambda or Vercel.

SDK initialization options

OptionTypeDefaultDescription
apiKeystringRequiredYour project API key. Must start with lqt_.
environmentstring"production"Tags every event with an environment label.
storePromptsbooleanfalseStore full prompt and completion text. Off by default for privacy.
sampleRatenumber1.0Fraction of calls to trace (0.0–1.0).
redactKeysstring[]Common PII keysTag/metadata keys whose values are redacted before sending.
debugbooleanfalseLog SDK activity to the console.
batchSizenumber50Events to collect before flushing.
flushIntervalnumber2000Milliseconds between automatic flushes.
baseURLstringhttps://api.lumiqtrace.comOverride for self-hosted deployments.

Tracing other frameworks

Anthropic

const anthropic = lumiqtrace.wrapAnthropic(new Anthropic());

Google Gemini

const google = lumiqtrace.wrapGoogle(new GoogleGenerativeAI(key));

LangChain

Full chain, agent executor, and retriever tracing via callback handler.

Google ADK

Multi-agent tracing with instrumentADK, wrapADKRunner, or wrapADKAgent.