Skip to content

Semantic Telemetry SDK — Integration Guide

Version: 1.0
Last updated: January 2026
Audience: Developers integrating the SDK into their own backend


1 Prerequisites


2 Installation

Option A — pip (coming soon)

bash
pip install aicoevolution-sdk

Option B — Source

bash
git clone https://github.com/aicoevolution/semantic-telemetry.git
cd semantic-telemetry
pip install -e .

3 Initialize the Telemetry Engine

python
from aicoevolution_sdk import TelemetryEngine

# Cloud API (recommended)
engine = TelemetryEngine(
    api_key="YOUR_API_KEY",
    embedding_provider="nomic"   # or "openai", "cohere"
)

# Self-hosted sidecar
engine = TelemetryEngine(
    embedding_endpoint="http://localhost:8000/embed",
    embedding_dim=768
)

4 Ingest Messages

Call ingest() after each user or assistant turn:

python
# User message
user_result = engine.ingest(
    role="user",
    content="I'm trying to understand how meaning emerges in conversation"
)

# Assistant response
assistant_result = engine.ingest(
    role="assistant",
    content="Meaning emerges through the dynamic interplay between..."
)

5 Read Telemetry

Each ingest() returns real-time metrics:

python
print(f"SGI:           {assistant_result['sgi']:.3f}")
print(f"Velocity:      {assistant_result['velocity']:.1f}°")
print(f"Context Phase: {assistant_result['context_phase']}")
print(f"Context ID:    {assistant_result['context_id']}")

Available Fields

KeyDescriptionTypical Range
sgiOrbital radius0.5 – 1.5
velocitySemantic movement (degrees)0 – 180°
context_phasestable / protostar / split
context_idCurrent topic identifierstring
context_massTurns in current topic0 – N
attractor_countCompeting topic centers1+

6 Handle Context Shifts

When context_phase becomes split, a new topic has been detected:

python
if result['context_phase'] == 'split':
    print(f"Topic shifted! New context: {result['context_id']}")
    # Log, trigger webhook, update UI, etc.

7 Export Session Data

At the end of a conversation:

python
import json

session_data = engine.export_session()

with open('session.json', 'w') as f:
    json.dump(session_data, f, indent=2)

8 Integration Patterns

Pattern A — Middleware

python
class TelemetryMiddleware:
    def __init__(self):
        self.engine = TelemetryEngine(api_key=os.environ['AICOEVO_API_KEY'])

    def process(self, role: str, content: str) -> dict:
        return self.engine.ingest(role=role, content=content)

middleware = TelemetryMiddleware()
metrics = middleware.process("user", user_message)
# Continue with LLM call...

Pattern B — Async (non-blocking)

python
import asyncio

async def ingest_async(engine, role, content):
    loop = asyncio.get_event_loop()
    return await loop.run_in_executor(
        None,
        lambda: engine.ingest(role=role, content=content)
    )

Pattern C — Batch Processing

python
from aicoevolution_sdk import BatchProcessor

processor = BatchProcessor(api_key="YOUR_KEY")
results = processor.analyze_conversation([
    {"role": "user", "content": "..."},
    {"role": "assistant", "content": "..."},
])

9 Configuration Options

python
engine = TelemetryEngine(
    api_key="...",

    # Embedding
    embedding_provider="nomic",               # openai, cohere, nomic, local
    embedding_model="nomic-embed-text-v1.5",

    # Context detection
    context_split_threshold=0.4,              # lower = more sensitive
    protostar_threshold=0.25,

    # Velocity
    velocity_window=3,                        # rolling average

    # Debug
    verbose=False
)

10 Troubleshooting

SymptomCauseFix
Metrics returning zerosEmbedding endpoint unreachableVerify URL / API key
Slow first responseModel loading on cold startWarm up with a test message
Context not detectingThreshold too highLower context_split_threshold
422 errorsPayload mismatchCheck request schema in SDK Manual

11 Next Steps

ResourceLink
SDK Manual (API Reference)docs.aicoevolution.com/sdk/manual
SDK Architecturedocs.aicoevolution.com/sdk/architecture
Semantic Telemetry (web app)aicoevolution.com/baseline-generator
Paper 03 Research Repogithub.com/AICoevolution/paper03-orbital-mechanics

Maintainer: AICoevolution Research
License: MIT