Skip to main content

Observability with OpenTelemetry

OpenTelemetry exporter for AIP integrity checkpoints and AAP verification results. Send AIP/AAP telemetry to any OTel-compatible observability platform — Langfuse, Arize Phoenix, Datadog, Grafana — with zero custom code.

Why

AIP and AAP produce rich alignment telemetry: integrity verdicts, concerns, verification results, coherence scores, drift alerts. But this data is only useful if it’s observable. This exporter bridges the gap between protocol output and your existing observability stack by mapping everything onto OpenTelemetry spans, events, and metrics.
AIP/AAP Protocol Output ──→ aip-otel-exporter ──→ OTel SDK ──→ Your Platform

                                                      ├── Langfuse
                                                      ├── Arize Phoenix
                                                      ├── Datadog
                                                      ├── Grafana / Tempo
                                                      └── Any OTLP endpoint

Three Integration Layers

LayerTypeScriptPythonOTel SDK?Use Case
Manual API@mnemom/aip-otel-exporteraip-otel-exporter[otel]YesFull control, works everywhere
Auto-instrumentation@mnemom/aip-otel-exporter/autoAIPInstrumentorYesWraps AIP/AAP calls automatically
CF Workers adapter@mnemom/aip-otel-exporter/workersNoCloudflare Workers edge runtime

Quick Start

TypeScript

npm install @mnemom/aip-otel-exporter @opentelemetry/api
import { createAIPOTelRecorder } from "@mnemom/aip-otel-exporter";

const recorder = createAIPOTelRecorder({ tracerProvider });

recorder.recordIntegrityCheck(signal);    // AIP integrity check → span
recorder.recordVerification(result);       // AAP verification → span
recorder.recordCoherence(result);          // AAP coherence → span
recorder.recordDrift(alerts, count);       // AAP drift detection → span

Python

pip install aip-otel-exporter[otel]
from aip_otel_exporter import AIPOTelRecorder

recorder = AIPOTelRecorder(tracer_provider=provider)

recorder.record_integrity_check(signal)
recorder.record_verification(result)
recorder.record_coherence(result)
recorder.record_drift(alerts, traces_analyzed=50)

Span Hierarchy

Spans are created as children of the current active span via context.active():
your_application_span
  ├── aip.integrity_check
  │    ├── event: aip.concern (one per concern)
  │    └── event: aip.drift_alert (when drift active)
  ├── aap.verify_trace
  │    └── event: aap.violation (one per violation)
  ├── aap.check_coherence
  └── aap.detect_drift
       └── event: aap.drift_alert (one per alert)

Attributes Reference

For the complete attributes and metrics reference, see OTel Attributes.

aip.integrity_check — 22 attributes + 2 GenAI SIG aliases

AttributeTypeSource
aip.integrity.checkpoint_idstringcheckpoint
aip.integrity.verdictstringcheckpoint (clear / review_needed / boundary_violation)
aip.integrity.agent_idstringcheckpoint
aip.integrity.card_idstringcheckpoint
aip.integrity.session_idstringcheckpoint
aip.integrity.thinking_hashstringcheckpoint (SHA-256)
aip.integrity.proceedbooleansignal
aip.integrity.recommended_actionstringsignal
aip.integrity.concerns_countintsignal
aip.integrity.analysis_modelstringanalysis_metadata
aip.integrity.analysis_duration_msfloatanalysis_metadata
aip.integrity.thinking_tokensintanalysis_metadata
aip.integrity.truncatedbooleananalysis_metadata
aip.integrity.extraction_confidencefloatanalysis_metadata
aip.conscience.consultation_depthstringconscience_context
aip.conscience.values_checked_countintconscience_context
aip.conscience.conflicts_countintconscience_context
aip.window.sizeintwindow_summary
aip.window.integrity_ratiofloatwindow_summary (0.0-1.0)
aip.window.drift_alert_activebooleanwindow_summary
gen_ai.evaluation.verdictstringGenAI SIG forward-compat
gen_ai.evaluation.scorefloatGenAI SIG forward-compat

aap.verify_trace — 8 attributes

AttributeType
aap.verification.resultboolean
aap.verification.similarity_scorefloat
aap.verification.violations_countint
aap.verification.warnings_countint
aap.verification.trace_idstring
aap.verification.card_idstring
aap.verification.duration_msfloat
aap.verification.checks_performedstring (comma-separated)

aap.check_coherence — 5 attributes

AttributeType
aap.coherence.compatibleboolean
aap.coherence.scorefloat (0.0-1.0)
aap.coherence.proceedboolean
aap.coherence.matched_countint
aap.coherence.conflict_countint

aap.detect_drift — 2 attributes

AttributeType
aap.drift.alerts_countint
aap.drift.traces_analyzedint

Metrics

9 metric instruments for aggregate monitoring:
MetricTypeLabels
aip.integrity_checks.totalCounterverdict, agent_id
aip.concerns.totalCountercategory, severity
aip.analysis.duration_msHistogramverdict
aip.window.integrity_ratioHistogram
aip.drift_alerts.totalCounter
aap.verifications.totalCounterverified
aap.violations.totalCountertype, severity
aap.verification.duration_msHistogram
aap.coherence.scoreHistogramcompatible

Dashboard Templates

Pre-built dashboards are available in the aip-otel-exporter repository:
  • grafana-aip-overview.json — Fleet-wide integrity monitoring
  • grafana-aip-detail.json — Per-agent deep-dive
  • datadog-aip-overview.json — Datadog importable dashboard
See the dashboards README for import instructions.

Platform Examples

Integration examples are available in the examples directory:
PlatformFile
Langfuselangfuse.ts
Arize Phoenixarize-phoenix.ts
Datadogdatadog.ts
Cloudflare Workerscloudflare-workers.ts

Performance

Measured via npm run bench (Vitest bench, Node 22, Apple M-series):
OperationMeanp99Ops/sec
recordIntegrityCheck()0.007 ms0.023 ms142,540
recordVerification()0.003 ms0.004 ms310,510
recordCoherence()0.003 ms0.003 ms321,385
recordDrift()0.003 ms0.007 ms295,807
Workers createOTLPSpan()0.003 ms0.004 ms341,778
Workers serializeExportPayload()0.004 ms0.006 ms234,860
All operations are sub-0.01ms mean. Zero measurable overhead on hot paths.

Design Principles

  • Duck-typed inputs — No hard dependency on AIP/AAP packages. Works with any compatible shape.
  • Graceful degradation — Missing fields are silently skipped, never throws.
  • Zero-overhead Workers — CF Workers adapter uses only fetch() + crypto, no OTel SDK.
  • GenAI SIG forward-compatgen_ai.evaluation.* aliases for future OTel GenAI SIG alignment.

Standards Alignment

The exporter follows OpenTelemetry Semantic Conventions for span naming and attribute structure. Forward-compatible aliases (gen_ai.evaluation.*) track the emerging OTel GenAI SIG conventions for AI/ML observability. This exporter is part of the Mnemom trust infrastructure:
  • AIP — Agent Integrity Protocol (real-time thinking analysis)
  • AAP — Agent Alignment Protocol (behavioral verification)
  • aip-otel-exporter — This package (observability bridge)

Additional Resources

DocumentDescription
CHANGELOGRelease history
CONTRIBUTINGDevelopment setup and contribution guide
Security PolicySecurity policy and threat model
TypeScript READMETypeScript package documentation
Python READMEPython package documentation
Dashboards READMEDashboard import instructions

Status

Version 0.1.0 — Initial release.
ComponentStatus
TypeScript Manual APIStable
TypeScript Auto-instrumentationStable
TypeScript Workers AdapterStable
Python Manual APIStable
Python Auto-instrumentationStable
Metrics APIStable
Dashboard TemplatesStable