Skip to main content

Telemetry

OpenTelemetry integration for AI agent observability. Trace requests, measure latency, and export telemetry to your preferred backend.

Initialization

import { initTelemetry } from '@sekuire/sdk';

await initTelemetry({
serviceName: 'my-agent',
exporterUrl: 'https://otel-collector.example.com:4318',
// or use Sekuire's built-in collector
useSekuireExporter: true
});

Tracing

The SDK automatically creates spans for agent operations. You can also create custom spans:

import { getTracer } from '@sekuire/sdk';

const tracer = getTracer('my-agent');

// Create a span for custom operations
await tracer.startActiveSpan('process_data', async (span) => {
span.setAttribute('data.size', 1024);

// Your logic here
const result = await processData();

span.setAttribute('result.status', 'success');
span.end();

return result;
});

SekuireSpanExporter

Export telemetry directly to Sekuire for integrated dashboard visibility:

import { SekuireSpanExporter } from '@sekuire/sdk';

const exporter = new SekuireSpanExporter({
backendUrl: 'https://api.sekuire.ai',
agentId: '7f8a9b3c...',
batchSize: 100,
flushInterval: 5000
});

// Integrates with your OTEL setup
provider.addSpanProcessor(
new BatchSpanProcessor(exporter)
);
tip

When using useSekuireExporter: true, telemetry data appears in the Sekuire dashboard alongside beacon heartbeats and metrics.

Automatic Instrumentation

The SDK automatically instruments:

  • LLM API calls (provider, model, tokens, latency)
  • Tool executions (tool name, duration, success/failure)
  • Memory operations (store, retrieve, clear)
  • Beacon heartbeats
  • Policy enforcement checks

Next Steps