Skip to main content

Voice Analytics SDK for AI Agents

Project description

LiveKit Agent

Prerequisites

  • Python > 3.10
  • venv (comes with Python)
  • Internet connection for downloading models and dependencies

Setup

python -m venv venv
source venv/bin/activate          # On Windows: venv\Scripts\activate
pip install -r requirements.txt
python agent.py download-files
python agent.py console

Usage & Metrics Collection

  1. Start the agent in console mode:

    python agent.py console
    
  2. Interact with the agent through voice or text input

  3. Stop the agent by pressing Ctrl + C to gracefully shutdown and save metrics

  4. View collected metrics in the generated file:

    cat livekit_agent_metrics.json
    

Metrics Data

The agent automatically collects comprehensive metrics including:

  • LLM Metrics: Token usage, response times (TTFT), model performance
  • TTS Metrics: Character count, audio generation times (TTFB), audio duration
  • STT Metrics: Audio processing duration, transcription accuracy
  • Session Data: Conversation turns, timestamps, duration
  • Usage Summary: Official LiveKit usage statistics

Metrics File Structure

{
  "sessions": [
    {
      "session_id": "uuid",
      "duration": 12.22,
      "total_llm_calls": 3,
      "total_llm_tokens_input": 71,
      "total_llm_tokens_output": 51,
      "total_tts_calls": 1,
      "total_tts_characters": 56,
      "total_stt_calls": 2,
      "total_stt_duration": 9.95,
      "conversation_turns": 7,
      "transcripts": [...],
      "usage_summary": {...}
    }
  ]
}

Key Features

  • Automatic metrics collection using LiveKit's official metrics system
  • Real-time monitoring with console output during sessions
  • Persistent storage in JSON format for analysis
  • Conversation tracking with full transcript history
  • Usage analytics for cost estimation and optimization
  • Error-safe serialization handles all LiveKit metric types

Troubleshooting

If you encounter any issues:

  1. Ensure all dependencies are installed: pip install -r requirements.txt
  2. Check that your environment variables are set correctly
  3. Verify internet connection for model downloads
  4. Make sure you have proper API keys configured

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

pype_observe-1.0.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

pype_observe-1.0.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file pype_observe-1.0.0.tar.gz.

File metadata

  • Download URL: pype_observe-1.0.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for pype_observe-1.0.0.tar.gz
Algorithm Hash digest
SHA256 788a2fae964a54e271c8245d97e3d038973140707cbf5f9a05bcbb8fa5d7190f
MD5 7418edc8e88b84aad79e72b9fe592501
BLAKE2b-256 01ccace68b0fcfdae88cb70455d414ff8606e3c2c8a4d23e250a4ec23fb3a77e

See more details on using hashes here.

File details

Details for the file pype_observe-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pype_observe-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for pype_observe-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c37632d55d79cbcbf4fcb93e7150d420f362cde0da40d5ed6ff507963cb3ad3
MD5 69276bdec292968c269414f777e6119d
BLAKE2b-256 b7fe871d47ea479f14821d1ccf233cda0a0dfd865fdd6071d9fcc88ffe68b862

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