@syntropyai/node
v0.2.0
Published
Universal AI Observability and Security Agent — trace, guard, and govern LLM calls across every provider.
Maintainers
Readme
@syntropyai/node
Syntropy AI Observability SDK for Node.js — trace, guard, and govern your AI agents.
Installation
npm install @syntropyai/nodeQuick Start
import { Syntropy } from "@syntropyai/node";
const client = new Syntropy({
apiKey: "syn_your_key_here",
baseUrl: "https://ingest.syntropy.dev",
agentId: "my-agent",
});
// Buffered trace (non-blocking)
client.trace({
prompt: "What is the capital of France?",
response: "The capital of France is Paris.",
model: "gpt-4o",
tokensIn: 12,
tokensOut: 8,
latencyMs: 340,
});
// Synchronous trace (awaitable)
const result = await client.traceSync({
prompt: "Hello",
response: "Hi there!",
model: "gpt-4o-mini",
});
console.log(result.success, result.traceId);OpenAI Integration
Auto-trace all chat.completions.create() calls:
import OpenAI from "openai";
import { Syntropy, wrapOpenAI } from "@syntropyai/node";
const syn = new Syntropy({ apiKey: "syn_...", agentId: "my-agent" });
const openai = wrapOpenAI(new OpenAI(), { syntropy: syn });
// Auto-traced:
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello!" }],
});Batch Tracing
await client.traceBatch([
{ prompt: "Q1", response: "A1", model: "gpt-4o", agentId: "agent-1" },
{ prompt: "Q2", response: "A2", model: "gpt-4o", agentId: "agent-2" },
]);Configuration
| Option | Default | Description |
|--------|---------|-------------|
| apiKey | required | Your Syntropy API key |
| baseUrl | http://localhost:4000 | Ingestion service URL |
| agentId | "" | Default agent ID |
| flushIntervalMs | 2000 | Ms between buffer flushes |
| batchSize | 50 | Max traces per batch |
| maxQueueSize | 10000 | Max buffered traces |
| enabled | true | Set false to disable tracing |
