lumni-ai
v0.1.0
Published
AI agent observability SDK — track interactions, auto-instrument LLM calls, collect feedback signals.
Downloads
9
Maintainers
Readme
lumni-ai
AI agent observability SDK — track interactions, auto-instrument LLM calls, collect feedback signals.
Install
npm install lumni-aiQuick Start
import * as lumni from "lumni-ai";
lumni.init("your-ingest-key", { baseUrl: "https://your-backend.example.com" });
// Auto-instrument all LLM calls (OpenAI, Anthropic, Gemini)
// Works with LangChain.js, Vercel AI SDK, or any framework using these providers.Track an AI Interaction
const eventId = lumni.trackAi({
userId: "user-123",
event: "chat_response",
model: "gpt-4o",
input: "What's the weather?",
output: "It's sunny and 72F.",
});Auto-Instrumentation (Zero Code)
import * as lumni from "lumni-ai";
lumni.init("key", { baseUrl: "http://localhost:8085", tracingEnabled: true });
// Every OpenAI/Anthropic/Gemini call is now captured automatically
import OpenAI from "openai";
const client = new OpenAI();
await client.chat.completions.create({ model: "gpt-4o", messages: [...] }); // trackedUser Identification
lumni.identify("user-123", { name: "Alice", email: "[email protected]", plan: "paid" });Feedback Signals
const eventId = lumni.trackAi({ userId: "u1", event: "chat", model: "gpt-4o", input: "hi", output: "hello" });
lumni.trackSignal(eventId, "thumbs_up", { sentiment: "POSITIVE" });Streaming / Multi-Turn
const interaction = lumni.begin({ userId: "user-123", event: "code_gen", input: "Write fibonacci" });
// ... streaming happens ...
interaction.finish("function fib(n) { ... }");Tracing (Higher-Order Functions)
// Wrap functions with span tracking
const myFlow = lumni.withInteraction("my_flow", async (input: string) => {
return await callLLM(input);
});
const search = lumni.withTool("web_search", async (query: string) => {
return await fetch(`https://api.search.com?q=${query}`).then(r => r.json());
});Span Context Managers
const result = await lumni.toolSpan("database_query", async (ctx) => {
ctx.recordInput({ sql: "SELECT * FROM users" });
const data = await db.execute("SELECT * FROM users");
ctx.recordOutput(data);
return data;
});Lifecycle
await lumni.flush(); // Force send buffered events
await lumni.shutdown(); // Flush + stop background timerSupported Providers (Auto-Instrumented)
| Provider | Package | Status |
|----------|---------|--------|
| OpenAI | openai | Supported |
| Anthropic | @anthropic-ai/sdk | Supported |
| Google Gemini | @google/genai | Supported |
Works with any framework that uses these providers: LangChain.js, Vercel AI SDK, OpenAI Agents SDK, etc.
Development
git clone https://github.com/lumni-ai/lumni-js.git
cd lumni-js
npm install
npm run buildLicense
MIT
