Skip to main content

Zero-code OpenTelemetry auto-instrumentation for Voice AI pipelines & Telemetry Trust Center

Project description

zooid

zooid provides OpenTelemetry auto-instrumentation and SDK helpers specifically engineered for conversational Voice AI applications (such as speech-to-speech agents, streaming LLM cascades, and voice bots) along with Telemetry Trust Center scoring for SigNoz.

It helps you track critical voice metrics like Time-To-First-Audio (TTFA), token stream latencies, interruptions, and multi-stage (STT -> LLM -> TTS) timing boundaries.


Installation

pip install zooid

For local development within this workspace:

pip install -e .

Quick Start

1. Initialize Instrumentation

Initialize OpenTelemetry providers and the Telemetry Trust Center at your application entry point:

from zooid import instrument_voice_app

handle = instrument_voice_app(
    service_name="voice-assistant-service",
    signoz_endpoint="localhost:4317",
    insecure=True,
    enable_trust_center=True
)

2. Trace Voice Turns

Wrap your conversational turns using the async context manager or decorator:

import asyncio
from zooid import VoiceTurnContext, voice_turn

# Option A: Async Context Manager (Recommended)
async def process_turn(audio_stream):
    async with VoiceTurnContext(architecture_mode="cascade") as turn:
        # 1. Speech-to-Text
        text = await process_stt(audio_stream)
        turn.mark_stt_complete()

        # 2. LLM Streaming
        async for chunk in stream_llm(text):
            if turn.llm_first_token_ms is None:
                turn.mark_llm_first_token()

        # 3. Text-to-Speech Output
        audio_out = await generate_tts(chunk)
        turn.mark_first_audio()  # Captures TTFA metric

# Option B: Decorator
@voice_turn(architecture_mode="hybrid")
async def handle_turn(input_data):
    current_turn = VoiceTurnContext.get_current()
    # Execute turn logic...

Core Features

  • Automatic TTFA Tracking: Dedicated timing hooks to accurately record Time-To-First-Audio.
  • Stage Latency Isolation: Measure STT duration, LLM Time-To-First-Token (TTFT), and TTS generation independently.
  • Telemetry Trust Center: Live span quality evaluation calculating a score (0-100) with critical violation detection.
  • Asyncio Context Propagation: Preserves OpenTelemetry trace context across asyncio.create_task() background loops.

API Reference

instrument_voice_app(...)

Initializes OpenTelemetry Tracer and Meter Providers configured for SigNoz OTLP gRPC export.

def instrument_voice_app(
    service_name: str = 'voice-agent',
    signoz_endpoint: str = 'localhost:4317',
    insecure: bool = True,
    enable_trust_center: bool = True,
    trust_center_mode: str = 'template',
    llm_endpoint: Optional[str] = None,
    export_interval_ms: int = 5000
) -> InstrumentationHandle

VoiceTurnContext

Context manager for tracking voice turn timing and metrics.

  • VoiceTurnContext.get_current(): Returns the active VoiceTurnContext instance for the current asyncio context.
  • turn.mark_stt_complete(): Marks STT processing completion and records STT duration.
  • turn.mark_llm_first_token(): Marks the arrival of the first LLM token stream chunk.
  • turn.mark_first_audio(): Marks the output of the first synthesized audio chunk and exports the TTFA metric.

Metrics Reference

Metric Name Type Unit Description
voice.time_to_first_audio_ms Histogram ms Time from user turn start to first synthesized audio
voice.stt_duration_ms Histogram ms Speech-To-Text processing duration
voice.llm_first_token_ms Histogram ms LLM Time-To-First-Token latency
voice.turns_total Counter 1 Total number of conversational turns processed
voice.interruptions_total Counter 1 Total number of user interruptions recorded
instrumentation.score Gauge 1 Telemetry quality score (0-100) evaluated by Trust Center

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zooid-0.1.0.tar.gz (41.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zooid-0.1.0-py3-none-any.whl (51.2 kB view details)

Uploaded Python 3

File details

Details for the file zooid-0.1.0.tar.gz.

File metadata

  • Download URL: zooid-0.1.0.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for zooid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4399cab7a6b6ac430d99ab54c6a13fda60d8b563432c45bb5ddfa7c389433d03
MD5 97b2799848001c00a0136bfdc8dbeef1
BLAKE2b-256 114ccc9c88fc849cd1e935afcb5ccef01c4edb77471e019daf37c8079919fb8b

See more details on using hashes here.

File details

Details for the file zooid-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zooid-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 51.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for zooid-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a49aeee3fac0a3677965d7c6aacb579b28391601d696c20a443478f34a3d7f9
MD5 7e5be88c1e8d429849e8d54fb0bd6f67
BLAKE2b-256 99bd032c7a20cf6a9b11b9b60c8e0670cbcee094c8d79a52009075c985c9430b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page