# LiveKit Agent
## Prerequisites
- Python > 3.10
- `venv` (comes with Python)
- Internet connection for downloading models and dependencies
## Setup
```bash
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:**
```bash
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:
```bash
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
```json
{
"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
Raw data
{
"_id": null,
"home_page": "https://pypeai.com/home",
"name": "pype-observe",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "voice analytics, AI agents, conversation intelligence, pype",
"author": "Pype AI Voice Analytics",
"author_email": "Pype AI Voice Analytics <support@pype.ai>",
"download_url": "https://files.pythonhosted.org/packages/01/cc/ace68b0fcfdae88cb70455d414ff8606e3c2c8a4d23e250a4ec23fb3a77e/pype_observe-1.0.0.tar.gz",
"platform": null,
"description": "# LiveKit Agent\n\n## Prerequisites\n- Python > 3.10\n- `venv` (comes with Python)\n- Internet connection for downloading models and dependencies\n\n## Setup\n```bash\npython -m venv venv\nsource venv/bin/activate # On Windows: venv\\Scripts\\activate\npip install -r requirements.txt\npython agent.py download-files\npython agent.py console\n```\n\n## Usage & Metrics Collection\n\n1. **Start the agent in console mode:**\n ```bash\n python agent.py console\n ```\n\n2. **Interact with the agent** through voice or text input\n\n3. **Stop the agent** by pressing `Ctrl + C` to gracefully shutdown and save metrics\n\n4. **View collected metrics** in the generated file:\n ```bash\n cat livekit_agent_metrics.json\n ```\n\n## Metrics Data\n\nThe agent automatically collects comprehensive metrics including:\n\n- **LLM Metrics**: Token usage, response times (TTFT), model performance\n- **TTS Metrics**: Character count, audio generation times (TTFB), audio duration\n- **STT Metrics**: Audio processing duration, transcription accuracy\n- **Session Data**: Conversation turns, timestamps, duration\n- **Usage Summary**: Official LiveKit usage statistics\n\n### Metrics File Structure\n```json\n{\n \"sessions\": [\n {\n \"session_id\": \"uuid\",\n \"duration\": 12.22,\n \"total_llm_calls\": 3,\n \"total_llm_tokens_input\": 71,\n \"total_llm_tokens_output\": 51,\n \"total_tts_calls\": 1,\n \"total_tts_characters\": 56,\n \"total_stt_calls\": 2,\n \"total_stt_duration\": 9.95,\n \"conversation_turns\": 7,\n \"transcripts\": [...],\n \"usage_summary\": {...}\n }\n ]\n}\n```\n\n## Key Features\n\n- \u2705 **Automatic metrics collection** using LiveKit's official metrics system\n- \u2705 **Real-time monitoring** with console output during sessions\n- \u2705 **Persistent storage** in JSON format for analysis\n- \u2705 **Conversation tracking** with full transcript history\n- \u2705 **Usage analytics** for cost estimation and optimization\n- \u2705 **Error-safe serialization** handles all LiveKit metric types\n\n## Troubleshooting\n\nIf you encounter any issues:\n1. Ensure all dependencies are installed: `pip install -r requirements.txt`\n2. Check that your environment variables are set correctly\n3. Verify internet connection for model downloads\n4. Make sure you have proper API keys configured\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Voice Analytics SDK for AI Agents",
"version": "1.0.0",
"project_urls": {
"Documentation": "https://docs.pype.ai",
"Homepage": "https://pype.ai",
"Repository": "https://github.com/pype-ai/pype-observe"
},
"split_keywords": [
"voice analytics",
" ai agents",
" conversation intelligence",
" pype"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b7fe871d47ea479f14821d1ccf233cda0a0dfd865fdd6071d9fcc88ffe68b862",
"md5": "69276bdec292968c269414f777e6119d",
"sha256": "7c37632d55d79cbcbf4fcb93e7150d420f362cde0da40d5ed6ff507963cb3ad3"
},
"downloads": -1,
"filename": "pype_observe-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "69276bdec292968c269414f777e6119d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11845,
"upload_time": "2025-07-28T17:23:37",
"upload_time_iso_8601": "2025-07-28T17:23:37.556174Z",
"url": "https://files.pythonhosted.org/packages/b7/fe/871d47ea479f14821d1ccf233cda0a0dfd865fdd6071d9fcc88ffe68b862/pype_observe-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "01ccace68b0fcfdae88cb70455d414ff8606e3c2c8a4d23e250a4ec23fb3a77e",
"md5": "7418edc8e88b84aad79e72b9fe592501",
"sha256": "788a2fae964a54e271c8245d97e3d038973140707cbf5f9a05bcbb8fa5d7190f"
},
"downloads": -1,
"filename": "pype_observe-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "7418edc8e88b84aad79e72b9fe592501",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12175,
"upload_time": "2025-07-28T17:23:39",
"upload_time_iso_8601": "2025-07-28T17:23:39.281609Z",
"url": "https://files.pythonhosted.org/packages/01/cc/ace68b0fcfdae88cb70455d414ff8606e3c2c8a4d23e250a4ec23fb3a77e/pype_observe-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-28 17:23:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pype-ai",
"github_project": "pype-observe",
"github_not_found": true,
"lcname": "pype-observe"
}