Skip to main content

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

Metadata

Release files for zooid 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zooid 0.1.0
File Size Uploaded Provenance
zooid-0.1.0.tar.gz 41.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zooid 0.1.0
File Interpreter ABI Platform
zooid-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 93.0 kB

Release files / zooid-0.1.0.tar.gz

Download URL zooid-0.1.0.tar.gz
Size 41.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4399cab7a6b6ac430d99ab54c6a13fda60d8b563432c45bb5ddfa7c389433d03
BLAKE2b-256 checksum
How to use checksums
114ccc9c88fc849cd1e935afcb5ccef01c4edb77471e019daf37c8079919fb8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release files / zooid-0.1.0-py3-none-any.whl

Download URL zooid-0.1.0-py3-none-any.whl
Size 51.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a49aeee3fac0a3677965d7c6aacb579b28391601d696c20a443478f34a3d7f9
BLAKE2b-256 checksum
How to use checksums
99bd032c7a20cf6a9b11b9b60c8e0670cbcee094c8d79a52009075c985c9430b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Security for zooid 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page